Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

load library

Dear friends,

I meet a question in OO perl:

I have a module named:"LDCIDPORTController",
and i define constructor as:

#-------------------------------------
# constructor
# ------------------------------------
sub new
{
  my ($class, $config, $log ) = @_;
  my $self = {};

  $self->{config} = $config;
  $self->{log} = $log;

  bless ( $self, $class);
  return $self;
}


in my main programming, i load this lib by :
#!/tools/perl/bin/perl -I/export/home/yw5726/export/lduser/filter/lib:/export/home/yw5726/export/commonlib

but when i run it, got the error:

Can't locate object method "new" via package "LDCIDPORTController" at /export/home/yw5726/export/commonlib/Manager.pm line 75



Can someone give me some advice how to debug it?

Thanks ahead.

0
wangtian
Asked:
wangtian
1 Solution
 
japhyRPICommented:
You need to more than just tell Perl where to find your module; you have to tell it to USE your module.  If you have a module Foo::Bar in /path/to/module/Foo/Bar.pm, then you'd do:

  use lib "/path/to/module";
  use Foo::Bar;
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now