Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 16957
Status: resolved
Priority: 0/
Queue: Class-Meta

People
Owner: Nobody in particular
Requestors: office [...] urldirect.at
Cc:
AdminCc:

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



Subject: Class attribute setter doesn't work
Hello, I hope that this really a bug and not my fault. In the following script I try to set a class attribute with a class accessor, but it doesn't work: #!/usr/bin/perl -w use ClassMetaTest; # the next line doesn't work ClassMetaTest::name("hugo"); print ClassMetaTest::name()."\n"; # Use of uninitialized value in concatenation (.) or string at cmt.pl line 7. # setting with object accessor works fine my $t = new ClassMetaTest(); $t->name("hugo"); print ClassMetaTest::name()."\n"; # prints hugo File ClassMetaTest.pm: package ClassMetaTest; use Class::Meta; use Class::Meta::Types::String; BEGIN { my $cm = new Class::Meta(); $cm->add_constructor( name => 'new', create => 1, view => Class::Meta::PUBLIC ); $cm->add_attribute( name => 'name', type => 'string', view => Class::Meta::PUBLIC, authz => Class::Meta::RDWR, create => Class::Meta::GETSET, context => Class::Meta::CLASS ); $cm->build(); } 1; Many thanks in advance Wolfgang
From: David Wheeler <david [...] kineticode.com>
Subject: Re: [cpan #16957] Class attribute setter doesn't work
Date: Sat, 7 Jan 2006 17:50:17 -0800
To: bug-Class-Meta [...] rt.cpan.org
RT-Send-Cc:
On Jan 7, 2006, at 5:44 PM, Guest via RT wrote: Show quoted text
> # the next line doesn't work > ClassMetaTest::name("hugo"); > print ClassMetaTest::name()."\n"; # Use of uninitialized value in > concatenation (.) or string at cmt.pl line 7.
It's a class *method*, not function. This will work: ClassMetaTest->name("hugo"); print ClassMetaTest->name()."\n"; Best, David