Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^5: "Practices and Principles" to death

by shmem (Canon)
on Mar 01, 2008 at 13:11 UTC ( #671374=note: print w/ replies, xml ) Need Help??


in reply to Re^4: "Practices and Principles" to death
in thread "Practices and Principles" to death

Nice! slightly more convoluted to make assertOk return what the passed code block returns:

package Assert; require Exporter; our @ISA = 'Exporter'; our @EXPORT = qw[ assertOk assert ]; my $nTests = 0; sub assertOk (&$;) { my( $package, $file, $line ) = caller; my( $code, $desc ) = @_; my( $scalar, @list); warn sprintf "%s %d # %s [%s(%d)]\n", ( ( wantarray ? (@list = $code->()) : ($scalar = $code->()) ) ? 'ok' : 'not ok' ), ++$nTests, $desc, $file, $line ; warn $@ if $@; wantarray ? @list : $scalar; } 1;

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}


Comment on Re^5: "Practices and Principles" to death
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2015-07-08 08:40 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 (98 votes), past polls