From: Vincent Pit Date: Wed, 14 Apr 2010 21:08:26 +0000 (+0200) Subject: Test storing the reference to a keyword X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Op.git;a=commitdiff_plain;h=e807a54178bf762ae4b6f764be5c0d6a3df60fcb Test storing the reference to a keyword --- diff --git a/t/10-base.t b/t/10-base.t index 2acce9a..6e6b5d1 100644 --- a/t/10-base.t +++ b/t/10-base.t @@ -5,7 +5,7 @@ use warnings; use blib 't/Sub-Op-LexicalSub'; -use Test::More tests => (1 + 3) * 15 + (1 + 2 * 3) * 2 + 2 * 28; +use Test::More tests => (1 + 3) * 16 + (1 + 2 * 3) * 2 + 2 * 29; our $called; @@ -128,6 +128,16 @@ fetch 1, do { no strict 'refs'; *{__PACKAGE__.'::fetch'}{CODE} }, 2 ---- fetch # () # [ 1, undef, 2 ] #### +my ($cb, $err); +BEGIN { + $cb = do { no strict 'refs'; \&{__PACKAGE__.'::cvref'} }; + eval { $cb->() }; + $err = $@ =~ /^Undefined subroutine &main::cvref/ ? undef : $@; +} +cvref $err; +---- +cvref # () # [ undef ] +#### our $scalr = 1; scalr $scalr; ----