Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: Filling in missing values in an array

by Neighbour (Friar)
on Jun 30, 2011 at 06:39 UTC ( #912109=note: print w/replies, xml ) Need Help??


in reply to Re^3: Filling in missing values in an array
in thread Filling in missing values in an array

Yea, but when it dies, the tests are never executed (in my case). That's probably not what's supposed to happen :).
  • Comment on Re^4: Filling in missing values in an array

Replies are listed 'Best First'.
Re^5: Filling in missing values in an array
by FunkyMonk (Canon) on Jun 30, 2011 at 10:07 UTC
    If you don't want the code to die, you need to use something to catch the exception. I like Try::Tiny:
    use Try::Tiny; my @bad = try { fill_in_the_blanks(qw<_ _ _>) } # fails catch { print "bad data!\n" }; my @good = try { fill_in_the_blanks(qw<_ 1 _>) } # succeeds catch { print "bad data!\n" };
Re^5: Filling in missing values in an array
by Neighbour (Friar) on Jul 04, 2011 at 11:17 UTC
    Ah, found out where things went wrong:
    My code dies with a 'No values found' for is_deeply [fill_in_the_blanks(qw< >)], [qw< >], "( )";.
    I thought that throws_ok didn't catch the die but that wasn't the case.
    Seems our approach of the 'empty array'-situation differs :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://912109]
help
Chatterbox?
thezip looks around to see no one else dancing to Piazzola...
[thezip]: Our cat is single-handedly (pawed-ly?) solving our field mouse problem. About four critters in the last week alone.
[thezip]: Amazing speed and stealth in that one.
[GotToBTru]: You can't tunafish, but some seafood companies can tunafish. More fun with English.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (15)
As of 2017-11-17 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?