Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How can I see a CPAN module's print message

by anaconda_wly (Scribe)
on Jan 06, 2013 at 09:06 UTC ( #1011854=note: print w/ replies, xml ) Need Help??


in reply to Re: How can I see a CPAN module's print message
in thread How can I see a CPAN module's print message

But why? As I can do it like this: MyPackage.pm

use strict; use warnings; { package MyPackage; use Carp; carp "print message"; } 1;
main.pl
use MyPackage; &main; sub main { }


Comment on Re^2: How can I see a CPAN module's print message
Select or Download Code
Replies are listed 'Best First'.
Re^3: How can I see a CPAN module's print message
by Corion (Pope) on Jan 06, 2013 at 09:20 UTC

    Also consider that Perl will load the first file TieRegistry.pm it finds in @INC. Inspect the values of %INC to find out which file Perl loaded, and which one you edited. See perlvar and Data::Dumper.

    use TieRegistry; print Dumper \%INC;
Re^3: How can I see a CPAN module's print message
by tobyink (Abbot) on Jan 06, 2013 at 10:01 UTC

    That line will print because it's not in a sub. A line inside a sub can only print when that sub is actually executed.

    (The exception to this rule being a line that is evaluated at compile time. But it would be unusual to do this.)

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      Yes, so my print or carp in file scope(I mean not in any sub) should print the message if I "use" it I think.
Re^3: How can I see a CPAN module's print message
by Anonymous Monk on Jan 06, 2013 at 09:15 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2015-07-07 17:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls