Yitzchak Scott-Thoennes wrote:

The throw_ok { ... } syntax only works because the throw_ok sub exists
and has a prototype that specifies a subref is expected; if you don't
load Test::Exception by the time the throw_ok call is compiled, it
is parsed as an indirect object call of the "throw_ok" method on the
object or class returned by the {} block:

$ perl -MO=Deparse,-p -we'throws_ok { Net::Pcap::lookupdev() } "/^Usage: Net::Pcap::lookupdev\(err\)/", "calling lookupdev() with no argument"'
BEGIN { $^W = 1; }
do {
    Net::Pcap::lookupdev()
}->throws_ok('/^Usage: Net::Pcap::lookupdev(err)/', 'calling lookupdev() with no
 argument');
-e syntax OK

which is perfectly valid perl, but unlikely to do what you want.

Understood. Thanks for the explanation.


Sébastien Aperghis-Tramoni
 -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ]
Close the world, txEn eht nepO

Reply via email to