Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 chanting in the Monastery: (6)
As of 2024-03-19 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found