Skip Menu |

This queue is for tickets about the Devel-Cycle CPAN distribution.

Report information
The Basics
Id: 19414
Status: resolved
Priority: 0/
Queue: Devel-Cycle

People
Owner: LDS [...] cpan.org
Requestors: DDUMONT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.05
Fixed in: (no value)



Subject: New import function breaks explicitely imported find_cycle find_weakened_cycle
Hello Devel::Cycle 1.05 breaks Test::Memory::Cycle. Test::Memory::Cycle explicitely imports find_cycle and find_weakened_cycle. These 2 methods are now exported via @EXPORT. When loading Devel::Cycle, they are also passed to export_to_level, and are then no longer exported to Test::Memory::Cycle (though I don't know why). Anyway, here's a patch that fixes Devel::Cycle behavior. The trick is to avoid calling export_to_level on methods declared in @EXPORT. Cheers --- Devel-Cycle-1.05/lib/Devel/Cycle.pm 2006-05-18 20:17:27.000000000 +0200 +++ Devel-Cycle-1.05.new/lib/Devel/Cycle.pm 2006-05-22 16:17:18.000000000 +0200 @@ -35,12 +35,15 @@ my $self = shift; my @args = @_; my %args = map {$_=>1} @args; - $QUIET++ if exists $args{-quiet}; - $FORMATTING = 'roasted' if exists $args{-roasted}; - $FORMATTING = 'raw' if exists $args{-raw}; - $FORMATTING = 'cooked' if exists $args{-cooked}; - warn join ' ',grep {!exists $import_args{$_}} @_; - $self->export_to_level(1,grep {!exists $import_args{$_}} @_); + $QUIET++ if delete $args{-quiet}; + $FORMATTING = 'roasted' if delete $args{-roasted}; + $FORMATTING = 'raw' if delete $args{-raw}; + $FORMATTING = 'cooked' if delete $args{-cooked}; + + my %already_exported = map {$_=>1} @EXPORT; + my @export_above = grep {!exists $already_exported{$_} } keys %args ; + warn join ' ', @export_above if @export_above ; + $self->export_to_level(1, @export_above); } sub find_weakened_cycle {
Subject: export_to_level called with slightly incorrect args - fix included
$self->export_to_level(1, grep {!exists $import_args{$_}} @_); is *almost* right but not quite. From "perldoc Exporter" the correct calling convention is MyPackage->export_to_level($where_to_export, $package, @what_to_expor t); so if you change that line to $self->export_to_level(1, $self, grep {!exists $import_args{$_}} @_); the export works correctly and Test::Memory::Cycle works again.
Fixed in version 1.07. Hopefully there aren't any more obvious bugs.