It prints Foo's constructor called, because of the following circumstances (and that's my interpretation) :
To circumvent this problem, either make it that [Pp]erl dosen't see Bar as a function name :
print "Bar"->new(), "\n"; # Calls Bar::new()
or call Bar::new() manually, and specify the wanted class name on the parameter list :
my $bar = Bar::new("Bar");
I don't know where in the documentation to look to find some text on this behaviour, but most likely one of the elder Perl users can explain the sequence of events from the documentation (or correct my sequence).
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: Capitalized subroutine names and packages
by Corion
in thread Capitalized subroutine names and packages
by elusion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |