Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Was a module use'd or require'd?

by TheDamian (Vicar)
on Aug 13, 2007 at 20:18 UTC ( [id://632301]=note: print w/replies, xml ) Need Help??


in reply to Was a module use'd or require'd?

Does this achieve what you were hoping for?
package Whatever; use Filter::Simple; my $was_used; my @use_args; FILTER { $was_used = 1; @use_args = @_; }; sub report { warn $was_used ? "I feel used (with: @use_args)\n" : "I feel required\n" ; } 1;
and then:
use Whatever qw<this that tother>; Whatever::report(); # I feel used (with: this that tother)
vs:
require Whatever; Whatever::report(); # I feel required

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2025-05-23 01:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.