vishi83 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Wise monks !!
I hav a problem in using Modules dynamically..
I have written a script which will fetch all the module names (*.pm) from a particular directory and its sub-dirs .
Now I hav all these names in an array and i need to call a method table_name defined in those modules.
Heres the pseudo-code form of my script .. step 1 : Getting all .pm filenames from a directory that satisfies a p +articular condition. ( in an array ) step 2 : Traverse through the array of filenames and use the module dy +namically
Something lik this ;
This is jus a snippet of my script; my @tables; foreach my $modulenames ( @avail ) { my $object = "Project::$modulenames"; use $object; my $objvalue = $object->table_name(); push (@tables, $objvalue); } print "@tables";
The Problem i hav now is I can't use my modules dynamically something like use $object ;
Thanks in advance !!!
Vishi83
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting Module Names Dynamically and using it
by broquaint (Abbot) on Dec 07, 2005 at 10:36 UTC | |
by xdg (Monsignor) on Dec 07, 2005 at 11:17 UTC | |
|
Re: Getting Module Names Dynamically and using it
by sh1tn (Priest) on Dec 07, 2005 at 10:37 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |