[pm-h] Why the Yada Yada Operator is My New Best Friend (And he wants to be your pal too!)

Robert Stone drzigman at drzigman.com
Fri May 16 12:12:03 PDT 2014


Greetings Mongers, 

After reading a fun post on Dot based "operators" in perl ( http://perlhacks.com/2014/01/dots-perl/ ) a few weeks ago I found myself getting really into the "yada yada" operator. It's not technically an operator, rather "it stands in place of a statement and has no operands" but I have found it to be an excellent addition to my TDD tool kit. 

Basically, rather than doing: 

sub do_awesome_thing { 
croak "Not Yet Implemented" 
} 

You can do: 

sub do_even_more_awesome_thing { 
... 
} 

Which will generate the following when ran: 

[rstone at rstone core]$ prove -l t/things/01-that_are_awesome.t 
t/things/01-that_are_awesome.t .. 
# Failed test 'Lives Through Taking Over The World' 
# at t/things/01-that_are_awesome.t line 46. 
# died: Unimplemented at /home/rstone/repos/awesomness/lib/Super/Cool/Module.pm line 169. 

Those three dot's take the place of a `die "Unimplemented"` and stand out quite a bit more to me as something I need to come back and actually implement. 

Anyway, hope someone else find this helpful or interesting. Feel free to share any other nifty tips and tricks you may have come across in recent days. 

Best Regards, 
Robert Stone 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/houston/attachments/20140516/3e7158b4/attachment.html>


More information about the Houston mailing list