In article <0a8801c27d4a$daf0c7e0$0201a8c0@dellm8o2praz1w>, [EMAIL PROTECTED] (Email/Phone: [EMAIL PROTECTED]) writes: >My previous post had a typo, the listing showed @Icuc instead of @Other, >this listing I believe to be correct (although it still yields the same >'undefined subroutine' error.
When you say "believe to be correct" it suggests that it may not be correct. There's no need for us to have to wonder whether or not what you've showed us is the same as what's causing you the problem; you just cut and paste a terminal session that shows exactly what you're working with. I'll demonstrate below. >Specifically I have a main program that I execute from the command line >called mprog.pl which makes use of a subroutine named 'testvolts' which >lives in a module of mine named 'Electric.pm'. The subroutine 'testvolts' in >turn calls a subroutine named 'writedate' in another module of mine named >'Other.pm'. From the mainline mprog.pl the call to writedate() works fine >giving expected results, however, when writedate is called from within >testvolts I get the error message: Undefined subroutine &Electric::writedate >called at /var/www/html/dlib/Electric.pm line 102. It seems as if the >'testvolts' sub in module 'Electric' can't _see_ or find the 'writedate' sub >that lives in module 'Other' despite the inclusion of the 'use' pragma. There shouldn't be any problem with doing this. You need to reduce it to the minimal case which demonstrates the problem before posting it here in order for us to help, getting rid of any other code. Besides, 90% of the time that approach will reveal to you what your problem really was before you make the post. I was in exactly this situation yesterday, had a composition window open and was typing up a message (about finding a workaround for closures not working in evaled END blocks in 5.6.1) when I imagined what the first reaction to the posting would be ("Why don't you try--"), tried it, and it worked. Below shows that in principle what you are trying should work. Your problem must lie elsewhere. [peter@tweety /tmp]$ cat prog #!/usr/bin/perl -w use strict; use Foo qw(foo); use Bar qw(bar); foo("From main"); bar("From main"); [peter@tweety /tmp]$ cat Foo.pm package Foo; require Exporter; use strict; @Foo::ISA = qw(Exporter); @Foo::EXPORT_OK = qw(foo); sub foo { use Bar qw(bar); print "$_[0]: Foo::foo\n"; bar("From Foo::foo"); } 1; [peter@tweety /tmp]$ cat Bar.pm package Bar; require Exporter; use strict; @Bar::ISA = qw(Exporter); @Bar::EXPORT_OK = qw(bar); sub bar { print "$_[0]: Bar::bar\n" } 1; [peter@tweety /tmp]$ ./prog >From main: Foo::foo >From Foo::foo: Bar::bar >From main: Bar::bar [peter@tweety /tmp]$ -- Peter Scott http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]