A
Alien
Hello all!
Can anybody tell how can I use modele which name stored in variable?
For example, I have this code:
########################################
package MyModule;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT $DEBUG);
@ISA = qw/Exporter/;
@EXPORT = qw(foo);
sub foo($)
{
my $arg = shift;
print "MyModule foo: my arg: '$arg'\n";
return undef;
}
1;
########################################
Here are the code of main programm
########################################
#!/usr/local/bin/perl
use strict;
my $module = 'MyModule.pm';
require $module; # load module
my $arg = 'MyArg';
# I want call procedure by full name. How I can do this?
my $mname = 'MyModule';
$mname::foo($arg); # This doesn't work!!!
exit 0;
########################################
Thanks for help
Can anybody tell how can I use modele which name stored in variable?
For example, I have this code:
########################################
package MyModule;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT $DEBUG);
@ISA = qw/Exporter/;
@EXPORT = qw(foo);
sub foo($)
{
my $arg = shift;
print "MyModule foo: my arg: '$arg'\n";
return undef;
}
1;
########################################
Here are the code of main programm
########################################
#!/usr/local/bin/perl
use strict;
my $module = 'MyModule.pm';
require $module; # load module
my $arg = 'MyArg';
# I want call procedure by full name. How I can do this?
my $mname = 'MyModule';
$mname::foo($arg); # This doesn't work!!!
exit 0;
########################################
Thanks for help