Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: Self Testing Modules

by Happy-the-monk (Canon)
on Dec 18, 2005 at 01:00 UTC ( #517540=note: print w/replies, xml ) Need Help??

in reply to Re: Self Testing Modules
in thread Self Testing Modules

if (caller) { ... }

All right except demerphq got it the wrong way round.
What he meant was:

unless ( caller ) { # here go the tests that are only called when the module is run as +: # perl }

It's part of my cargo cult programming style. You know the documentation of caller, as you've already written in this thread.

Cheers, Sören

Update: I just saw a similar thing on a thread at German language
eserte writes:

return 1 if caller; # end of the module's own code # Test Code goes here

Replies are listed 'Best First'.
Re^3: Self Testing Modules
by demerphq (Chancellor) on Dec 18, 2005 at 09:59 UTC

    Doh. Doh. Doh.

    happy-the-monk is correct, i got it backwards. :-(


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-06-23 09:38 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (117 votes). Check out past polls.