From: | CARNIL [...] cpan.org |
Subject: | "state" example in pod is broken |
Hi
This bug has been forwarded from http://bugs.debian.org/690735
There seem to be a small that the state example in POD is not working
this way. Following [1] it seems correct what is suggested by Anthony.
[1]: http://www.perlmonks.org/?node_id=794116
The original report follows:
Package: libparams-validate-perl
Version: 1.06-1
Severity: normal
File: /usr/lib/perl5/Params/Validate.pm
Show quoted text
>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@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
Thanks in advance,
Salvatore Bonaccorso, Debian Perl Group