Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 wandering the Monastery: (6)
As of 2015-07-03 20:32 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 (56 votes), past polls