Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 17865
Status: open
Priority: 0/
Queue: Class-Field

People
Owner: Nobody in particular
Requestors: rrwo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.12
Fixed in: 0.12



Subject: Does not set the namespace of the field accessors
Some packages such as Class::Tie::InsideOut and Class::C3 require that the caller() information from accessors match the actual packages they are in. Class::Fields doesn't set this. Attached is a patch to fix that. Note that an alternative way to do this is to use Sub::Name, but that requires an additional dependency (and a compiler). The patch uses a pure-Perl version. No tests for this are attached, though.
Subject: Class-Field.diff
diff -r Class-Field-0.12/lib/Class/Field.pm Class-Field-0.12.orig/lib/Class/Field.pm 7,8c7 < our $VERSION = '0.12_01'; < $VERSION = eval $VERSION; --- > our $VERSION = '0.12'; 13c12 < "sub {\n local \*__ANON__ = \"%s::%s\";\n", --- > "sub {\n", 56c55 < my $code = sprintf $code{sub_start}, $package, $field; --- > my $code = $code{sub_start};
From: rrwo [...] cpan.org
Note that the patch doesn't fix the namespace for the const method. To do that would remove a potential Perl optimisation for the default. The only other option then would be to use Sub::Name to set the namespace.