http://qs321.pair.com?node_id=1011867


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

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'
  • Comment on Re^3: How can I see a CPAN module's print message

Replies are listed 'Best First'.
Re^4: How can I see a CPAN module's print message
by anaconda_wly (Scribe) on Jan 06, 2013 at 10:15 UTC
    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.