Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How Do I Bundle Perl Modules and Their Tests Into the Same File?

by bmann (Priest)
on Feb 13, 2006 at 04:38 UTC ( #529740=note: print w/ replies, xml ) Need Help??


in reply to How Do I Bundle Perl Modules and Their Tests Into the Same File?

Try this:

package abc; # ... package main; sub test_me { # test code here } test_me unless defined caller;
Like python, if the module is used or required test_me will not be executed. If you run the module using perl Module.pm, the code in test_me will be executed. Update: Just realized BrowserUK posted a very similar solution above...


Comment on Re: How Do I Bundle Perl Modules and Their Tests Into the Same File?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-29 08:15 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 (261 votes), past polls