Subject: | assigning to typeglob |
Date: | Sun, 22 Jun 2008 09:04:53 +1000 |
To: | bug-Perl-Critic-Dynamic [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With perl-critic-dynamic 0.04 and the debian perl 5.10.0 the program
below put through
perlcritic --single-policy=ValidateAgainstSymbolTable alias.pl
gets a report
Symbol "*Foo::def" does not appear to be defined at line 10, column 1. Perhaps you forgot to load "Foo". (Severity: 4)
This sort of function alias creation is a bit icky, but for checking
purposes I'd suspect the left side of an explicit assignment doesn't
have to exist.
(I struck this on some of my own code which plays tricks sticking funcs
into external modules ...)
package Foo;
use strict;
use warnings;
package main;
use strict;
use warnings;
sub Foo::abc { return 123; }
*Foo::def = \&Foo::abc;