Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Test::More not working with Perl local special variables

by tobyink (Abbot)
on Apr 22, 2013 at 19:13 UTC ( #1029957=note: print w/ replies, xml ) Need Help??


in reply to Test::More not working with Perl local special variables

This is a timing thing. Your double-quoted string "1000.0362 SSID was displayed on the wireless settings page \($&\)" is interpolated before like is called; then the regexp match happens inside the like call.

So when the interpolation happens, $& is still undefined.

The following might work:

like($sel->get_value("name=wlSsid_wl0v0"), qr/\S{1,}/, "1000.0362 SSID + was displayed on the wireless settings page") and diag("got: $&");
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Test::More not working with Perl local special variables
Select or Download Code
Re^2: Test::More not working with Perl local special variables
by Doozer (Beadle) on Apr 23, 2013 at 07:01 UTC
    Thank you for the responses on this. I had a bad feeling I wasn't going to be able to use them in this way. I tried tobyink's suggestion but it still doesn't work. I think I can work around it but it turns 1 line of code in to about 6. Thanks again :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-09-21 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls