Last active
July 21, 2016 20:59
-
-
Save petdance/4ddc8fd4e2b1eb0d12ba04516f222e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have tons of data where I have setups like this: | |
my %expected = ( country => ‘US’, state => ‘IL’, province => undef ); | |
my %expected = ( country => ‘CA’, state => undef, province => ‘ON’ ); | |
And then loop through and scrape them | |
if ( defined($value) ) { | |
$mech->scraped_id_is( $id, $value ); | |
} else { | |
$mech->lacks_id( $id ); | |
} | |
I need a wrapper function that wraps up that functionality. | |
sub some_method { | |
my ($id,$value) = @_; | |
if ( defined($value) ) { | |
return $mech->scraped_id_is( $id, $value ); | |
} else { | |
return $mech->lacks_id( $id ); | |
} | |
} | |
What do I call it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment