Bug#690735: "state" example in pod is broken
Anthony DeRobertis
anthony at derobert.net
Tue Oct 16 21:51:00 UTC 2012
Package: libparams-validate-perl
Version: 1.06-1
Severity: normal
File: /usr/lib/perl5/Params/Validate.pm
>From the docs:
You can also use the "state" feature to do this:
use feature 'state';
sub foo {
state %spec = ( ... );
my %params = validate( @_, \%spec );
}
Doesn't quite work:
anthony at Zia:~$ perl -E 'state %foo = (a => 1)'
Initialization of state variables in list context currently forbidden at -e line 1, at EOF
Execution of -e aborted due to compilation errors.
The example should read something like this:
use feature 'state';
sub foo {
state $spec = { ... };
my %params = validate( @_, $spec );
}
Which, I confess, I haven't (yet) tested. Appears to be tradition :-P
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing'), (200, 'unstable'), (150, 'stable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.5-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libparams-validate-perl depends on:
ii libc6 2.13-35
ii libmodule-implementation-perl 0.06-1
ii perl 5.14.2-13
ii perl-base [perlapi-5.14.2] 5.14.2-13
libparams-validate-perl recommends no packages.
libparams-validate-perl suggests no packages.
-- no debconf information
More information about the pkg-perl-maintainers
mailing list