Solved

load library

Posted on 2002-05-10
1
182 Views
Last Modified: 2010-03-05
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
Comment
Question by:wangtian
1 Comment
 
LVL 1

Accepted Solution

by:
japhyRPI earned 50 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video discusses moving either the default database or any database to a new volume.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now