Created
February 18, 2016 18:37
-
-
Save exodist/afffae9db1f7b6ed13b9 to your computer and use it in GitHub Desktop.
caller woes
This file contains hidden or 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
use strict; | |
use warnings; | |
my ($line1, $line2, $line3); | |
sub foo { | |
(undef, undef, $line1) = caller(0); | |
} | |
$line2 = __LINE__ + 1; | |
foo( | |
'f23' => { | |
active => 0, | |
custom => sub { 1 }, | |
notify_on => 0, | |
notify_for => 'active', | |
}, | |
); | |
$line3 = __LINE__ - 1; | |
print "$line1 - $line2 - $line3\n"; | |
__END__ | |
$ perl test.pl | |
15 - 11 - 18 | |
WTF? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment