SPUG: Modules - more than one object in file?

Todd Wells toddw at wrq.com
Wed Oct 11 14:21:26 CDT 2000


Okay, I still don't know why I'm having these problems, but here's the
specific problem I'm having, and I just don't understand why or what I need
to do to fix it.

The TestCase package is in the same file as TestEngine (TestEngine.pm).
TestCase @ISA TestEngine, or so I've said in the TestCase package. A method
of TestCase is trying to call the logger() method of TestEngine.  On the
line where logger() is called, it generates this error stack:

Can't locate package "TestEngine" for @TestCase::ISA at TestEngine.pm line
254,
<IN> line 54.
Can't locate package "TestEngine" for @TestCase::ISA at TestEngine.pm line
254,
<IN> line 54.
Can't locate object method "logger" via package "TestCase" at TestEngine.pm
line
 254, <IN> line 54.
Can't locate package "TestEngine" for @TestCase::ISA, <IN> line 54.


Line 254 calls logger() and line 54 is where the logger() method actually
begins.  I'm completely stumped why I'm getting 'can't locate package
"TestEngine"' after I successfully 'use TestEngine;' in my very first line
of code.  Any help you can give is appreciated, this has already taken up
way too much of my time.  

-Todd

P.S. For anyone interested enough to care, I've attached the two files I'm
working with (the module and the code which exercises it).  The error occurs
in the test() method of TestCase.


-----Original Message-----
From: Todd Wells [mailto:toddw at wrq.com]
Sent: Wednesday, October 11, 2000 11:43 AM
To: 'ced at carios2.ca.boeing.com'; briani at activestate.com; 'SPUG'
Subject: RE: SPUG: Modules - more than one object in file?


Well, yes, it would help if I actually SAVED A.pm, wouldn't it??  :-)

Unfortunately, while the example works, I'm still having the problem in my
specific case.  I'll try to distill my problem into a better example.

-Todd

-----Original Message-----
From: ced at carios2.ca.boeing.com [mailto:ced at carios2.ca.boeing.com]
Sent: Wednesday, October 11, 2000 11:27 AM
To: briani at activestate.com; toddw at wrq.com
Cc: spug-list at pm.org
Subject: RE: SPUG: Modules - more than one object in file?



> If I save packages A and B in A.pm (and append 1;), and then create
test1.pl
>that has this:

># test1.pl
>use A;
>$b = B->new;
>$b->foo;

>Now when I run test1.pl, I get this:
>~/myperl$ perl test1.pl
>Can't locate A.pm in @INC (@INC contains: d:/Perl/lib d:/Perl/site/lib .)
at
>tes
>t1.pl line 1.
>BEGIN failed--compilation aborted at test1.pl line 1.
> ~/myperl$

 

use lib "/path/to/module";   # e.g.  use lib "C:/myhome/lib";
use A;
...


hope this helps,
--
Charles DeRykus



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestEngine.pm
Type: application/octet-stream
Size: 5205 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20001011/25d7bc59/TestEngine.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testtest.pl
Type: application/octet-stream
Size: 499 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20001011/25d7bc59/testtest.obj


More information about the spug-list mailing list