Ryszard has asked for the wisdom of the Perl Monks concerning the following question:
Problem
I'm doing a search with file::find in for any file within a specified path.
I can find the modules i'm after and require them, however when i go to
access the new method I'm finding out:
Can't locate object method "new" via package "api::bess::query::Query" (perhaps you forgot to load "api::bess::query::Query"?)
To stave off the obvious, yes there is a new method in the Object being loaded, and I know its loaded as I created a BEGIN block that printed to a logfile. I'm now wondering what might be causing the problem and how i can fix it.
Snippet below:
sub load_api_modules{ my $self = shift; my @superclass = split(/\//, $File::Find::dir); my @class = split(/./, $_); if ($File::Find::name =~ /\.pm$/) { require "$_"; my $name = $File::Find::name; $name =~ s/\//\:\:/g; # Convert slashes (/) to :: substr($name, -3,3, ''); # Remove the .pm at the end $self->{_$superclass[1].$superclass[2]} = new $name; print STDERR $File::Find::name."\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamically load unknown modules
by demerphq (Chancellor) on Aug 27, 2002 at 14:51 UTC | |
|
Re: Dynamically load unknown modules
by fruiture (Curate) on Aug 27, 2002 at 14:31 UTC | |
by chromatic (Archbishop) on Aug 27, 2002 at 14:50 UTC | |
by fruiture (Curate) on Aug 27, 2002 at 15:42 UTC | |
|
Re: Dynamically load unknown modules
by Ryszard (Priest) on Aug 27, 2002 at 15:01 UTC | |
by fruiture (Curate) on Aug 27, 2002 at 16:31 UTC | |
by Ryszard (Priest) on Aug 28, 2002 at 08:29 UTC |