imgtools/buildrom/tools/flexmodload.pm
changeset 629 541af5ee3ed9
parent 600 6d08f4a05d93
equal deleted inserted replaced
628:7c4a911dc066 629:541af5ee3ed9
       
     1 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # Runtime module-loading routine for loading e32toolp modules into 'main' module
       
    15 # 
       
    16 #
       
    17 
       
    18 
       
    19 package flexmodload;
       
    20 
       
    21 use romutl;
       
    22 
       
    23 require Exporter;
       
    24 @ISA=qw(Exporter);
       
    25 
       
    26 @EXPORT=qw(
       
    27 	FlexLoad_ModuleL
       
    28 );
       
    29 
       
    30 sub FlexLoad_ModuleL (@) {
       
    31 # Loads a module into the 'main' package, including all the functions the module defines for export
       
    32 
       
    33 	my @ModBaseList=@_;
       
    34 	my $ModBase;
       
    35 	foreach $ModBase (@ModBaseList) {
       
    36 		$ModBase=lc $ModBase;
       
    37 
       
    38 		package main;
       
    39 		require $ModBase.".pm" or die "ERROR: Can't load function from \"$ModBase.pm\"\n";
       
    40 		my $Package=ucfirst lc $ModBase;
       
    41 		$Package->import;
       
    42 	}
       
    43 }
       
    44 
       
    45 1;