Solved

load library

Posted on 2002-05-10
1
202 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
ID: 7002313
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…

831 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