Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Carp can't deal with UNIVERSAL::AUTOLOAD

by jesuashok (Curate)
on Jun 07, 2006 at 16:43 UTC ( [id://554088]=perlquestion: print w/replies, xml ) Need Help??

jesuashok has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Carp can't deal with UNIVERSAL::AUTOLOAD
by ikegami (Patriarch) on Jun 07, 2006 at 17:29 UTC

    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();
Re: Carp can't deal with UNIVERSAL::AUTOLOAD
by derby (Abbot) on Jun 07, 2006 at 16:50 UTC

    Maybe because UNIVERSAL is the base class for all classes and bar is not a method but a subroutine. Maybe ... your code works fine for my version of perl (5.8.2) but I do get a deprecation warning -- Use of inherited AUTOLOAD for non-method main::bar() is deprecated.

    -derby
Re: Carp can't deal with UNIVERSAL::AUTOLOAD
by perrin (Chancellor) on Jun 07, 2006 at 17:14 UTC
    UNIVERSAL::AUTOLOAD? You're really going to make life hard for yourself if you start messing with that. All kinds of strange things may happen.
Re: Carp can't deal with UNIVERSAL::AUTOLOAD
by diotalevi (Canon) on Jun 07, 2006 at 17:36 UTC

    Ok, so it doesn't examine $UNIVERSAL::AUTOLOAD. And? Patch Carp from bleadperl and send it in to p5p. Read perlhack for details.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found