Discussion:
How to run "use" and "my" functions
(too old to reply)
Stephen Liu
2008-11-02 09:17:58 UTC
Permalink
Hi folks,


About "use" and "my" functions, can I run it inside cpan? I can't run
them on console, no command found.

e.g.
use File::Find;
my @files;

etc.


Or I have to create a perl script running them inside? TIA


B.R.
Stephen L

Send instant messages to your online friends http://uk.messenger.yahoo.com
Jonathan Yu
2008-11-02 15:58:54 UTC
Permalink
Hi there:

For "use", you can do this:

perl -MModule -e 'my @files'

Which is equivalent to a program:
use Module;
my @files;

You can add other statements to your -e parameter as well; just
separate them with semicolons.

Hope this helps,

Jonathan
Post by Stephen Liu
Hi folks,
About "use" and "my" functions, can I run it inside cpan? I can't run
them on console, no command found.
e.g.
use File::Find;
etc.
Or I have to create a perl script running them inside? TIA
B.R.
Stephen L
Send instant messages to your online friends http://uk.messenger.yahoo.com
Stephen Liu
2008-11-02 16:16:58 UTC
Permalink
Hi Jonathan,


Thanks for your advice. I'm now working on a desktop PC without cpan
installed.
Post by Jonathan Yu
use Module;
You can add other statements to your -e parameter as well; just
separate them with semicolons.
To issue following commands;

use ExtUtils::Installed;

my $inst = ExtUtils::Installed->new();
my @modules = $inst->modules();


Whether run;

perl -MExtUtils::Installed;my $inst = ExtUtils::Installed->new();my
@modules = $inst->modules();


TIA


B.R.
Stephen L

Send instant messages to your online friends http://uk.messenger.yahoo.com
Continue reading on narkive:
Loading...