Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Test::Warn, 'use' vs 'require'

by Joost (Canon)
on Sep 27, 2006 at 23:49 UTC ( [id://575274]=note: print w/replies, xml ) Need Help??


in reply to Re: Test::Warn, 'use' vs 'require'
in thread Test::Warn, 'use' vs 'require'

Ah right, I didn't spot the codeblock prototype.

In other words, to make sure the code compiles without warnings if the mode isn't there, this should work:

warning_like( sub { warn "warning!" }, qr(warning), 'basic warning');

Replies are listed 'Best First'.
Re^3: Test::Warn, 'use' vs 'require' (&)
by tye (Sage) on Sep 28, 2006 at 01:49 UTC

    Make that:

    &warning_li­ke( sub { warn "warning!" }, qr(warning­), 'basic warning' +);

    (note the &) so it will work even if the prototype gets loaded soon enough.

    Update: Ah, yes, & prototypes don't have this problem like some other prototypes do.

    - tye        

      (note the &) so it will work even if the prototype gets loaded soon enough.

      Actually in this instance you don't need the & since the bracketed version is legal code with or without prototypes - so either will work.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-28 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found