Problems with require/use ... (or may be with brains?)

Problems with require/use ... (or may be with brains?)

Post by Maksym Y. Shevchenk » Fri, 30 Jul 1999 04:00:00



I have 3 files in same directory:

aaa.pl      bbb.pm      ccc.pl.lib

Here are sources of them:
# -----------------aaa.pl----------------
#!/usr/local/bin/perl
use bbb;
require "ccc.pl.lib";
print "In main!\n";
print &ccc,"\n";
print bbb->b(),"\n";
#----------------------------------------

# -----------------bbb.pm--------------
package bbb;
require "ccc.pl.lib";
sub import {
 return 1;

Quote:}

sub b {
 return "In bbb::b!".&ccc;
Quote:}

1;
#----------------------------------------

# -----------------ccc.pl.lib-------------
sub ccc {
 return "In \&ccc!";

Quote:}

1;
#----------------------------------------

Why I got a:

./aaa.pl
In main!
Undefined subroutine &main::ccc called at ./aaa.pl line 7.

How I undersand refence to &ccc must be defined from main class and from bbb
class,
but defined only from bbb class... Why?


--
WBR Maksym Y. Shevchenko