This queue is for tickets about the Filter CPAN distribution.

Report information
The Basics
Id:
54452
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
RURBAN [...] cpan.org
Requestors:
user42 [...] zip.com.au
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: filter_add() leave existing object blessing
Date: Wed, 10 Feb 2010 08:55:16 +1100
To: bug-Filter@rt.cpan.org
From: Kevin Ryde <user42@zip.com.au>
In Filter 1.37, if filter_add() is given an object which is already bless()ed I think it should not re-bless it into the callers class, but instead leave it as-is. Sample foo.pl and Foo.pm below prints before Foo=HASH(0x9b2a8c8) after Foo::Base=HASH(0x9b2a8c8) filter Foo::Base=HASH(0x9b2a8c8) where I hoped that package Foo could inherit an import() from Foo::Base (for all the usual code sharing etc reasons that a "base" class might be used).
use lib '.'; use Foo; print "this is filtered out\n";
package Foo; use strict; use warnings; our @ISA = ('Foo::Base'); package Foo::Base; use Filter::Util::Call; sub import { my ($class) = @_; my $self = bless {}, $class; print "before $self\n"; filter_add ($self); print "after $self\n"; } sub filter { my ($self) = @_; print "filter $self\n"; return 0; } 1;
I've added this feature to 0.50, which is currently only on github. Please review and test it before I release it to the public. https://github.com/rurban/Filter You might think that this changed feature will break some code. This is a major change, but I found no use counter examples which would break, and the advantages are convincing. On Tue Feb 09 16:56:49 2010, user42@zip.com.au wrote:
Show quoted text
> In Filter 1.37, if filter_add() is given an object which is already > bless()ed I think it should not re-bless it into the callers class, but > instead leave it as-is. Sample foo.pl and Foo.pm below prints > > before Foo=HASH(0x9b2a8c8) > after Foo::Base=HASH(0x9b2a8c8) > filter Foo::Base=HASH(0x9b2a8c8) > > where I hoped that package Foo could inherit an import() from Foo::Base > (for all the usual code sharing etc reasons that a "base" class might be > used). >
-- Reini Urban
1.50 now released. Thanks -- Reini Urban


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.