Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Carp can't deal with UNIVERSAL::AUTOLOAD

by ikegami (Patriarch)
on Jun 07, 2006 at 17:29 UTC ( [id://554099]=note: print w/replies, xml ) Need Help??


in reply to Carp can't deal with UNIVERSAL::AUTOLOAD

Your problem has nothing to do with either UNIVERSAL or AUTOLOAD. You're seeing that behaviour because your AUTOLOAD was built in package main. Examine the following:

sub Test1::print_context { print(__PACKAGE__, "\n"); } { package Test2; sub print_context { print(__PACKAGE__, "\n"); } } Test1::print_context(); # main Test2::print_context(); # Test2

Fixed code:

#!/usr/bin/perl -w { package UNIVERSAL; use Carp; sub AUTOLOAD { carp "foo"; } } bar();

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://554099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-04-18 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found