Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 14713
Status: resolved
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: jmital [...] reed.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.0.4
Fixed in: (no value)



Subject: Typo in perldoc relating to :default ATTR
Hello, There is a minor typo in the perldoc in Std.pm from Class::Std version 0.0.4. I hesitate to mention something so small, but looking at the example code did cause some confusion and time spent figuring out what was wrong. At line 1435 of of Std.pm I see: my %seen_of :ATTR( :default(0) ); Which should be: my %seen_of :ATTR( :default<0> ); And again at line 1442 of Std.pm we have: my %customers_of :ATTR( :default([]) ); Which should be: my %customers_of :ATTR( :default<[]> ); Following the incorrect examples in the documentation leads to errors such as: Missing initializer label for Oracle::DevObjects: 'foobar'. Fatal error in constructor call at test.pl line 11 when defining attributes (incorrectly, as in the perldoc example) like: my %foobar_of : ATTR(:init_arg<foobar> :default([0,1,2,3,4]) ); Discovering the cause of the above 'Missing initializer label' error is particularly tricky because it only seems to pop up when you're calling new() without a hash ref of arguments. Thanks, - jeff -
On Thu Sep 22 18:03:35 2005, guest wrote: Show quoted text
> Hello, > > There is a minor typo in the perldoc in Std.pm from Class::Std version > 0.0.4. I hesitate to mention something so small, but looking at the > example code did cause some confusion and time spent figuring out > what was wrong. > > At line 1435 of of Std.pm I see: > > my %seen_of :ATTR( :default(0) ); > > Which should be: > > my %seen_of :ATTR( :default<0> ); > > And again at line 1442 of Std.pm we have: > > my %customers_of :ATTR( :default([]) ); > > Which should be: > > my %customers_of :ATTR( :default<[]> ); > > Following the incorrect examples in the documentation leads to errors > such as: > > Missing initializer label for Oracle::DevObjects: 'foobar'. > Fatal error in constructor call at test.pl line 11 > > when defining attributes (incorrectly, as in the perldoc example) > like: > > my %foobar_of : ATTR(:init_arg<foobar> :default([0,1,2,3,4]) ); > > Discovering the cause of the above 'Missing initializer label' error > is particularly tricky because it only seems to pop up when you're > calling new() without a hash ref of arguments. > > Thanks, > > - jeff -
Thanks Jeff, can you verify that this is still a problem and if so give some example code to reproduce? thanks!
From: dmuey [...] cpan.org
multivac:~ dmuey$ perl -le 'package X;use Class::Std; { my %x : ATTR(:name<foo> :default([])) }package main;my $x=X->new();print $x->get_foo(); print $x->set_foo(3);print $x->get_foo();' Missing initializer label for X: 'foo'. Fatal error in constructor call at -e line 1 multivac:~ dmuey$ perl -le 'package X;use Class::Std; { my %x : ATTR(:name<foo> :default<[]>) }package main;my $x=X->new();print $x->get_foo(); print $x- Show quoted text
>set_foo(3);print $x->get_foo();'
ARRAY(0x8460d0) ARRAY(0x8460d0) 3 multivac:~ dmuey$ Fixed: multivac:class-std.git-repos dmuey$ git commit -m "Fix POD example of :defualt() to :default<>, details in rt 14713" Created commit d605965: Fix POD example of :defualt() to :default<>, details in rt 14713 1 files changed, 2 insertions(+), 2 deletions(-) multivac:class-std.git-repos dmuey$ Pushed: refs/heads/master: d0d66dffcf81fb210621fef9325e4f94eb43e59b -> d6059652243e46b00319e2c3aa218e9c3dbff918 Should be in the release after 0.0.9, thanks!