Skip Menu |

This queue is for tickets about the YAML-AppConfig CPAN distribution.

Report information
The Basics
Id: 65539
Status: resolved
Priority: 0/
Queue: YAML-AppConfig

People
Owner: xaerxess [...] gmail.com
Requestors: grousse [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.16
Fixed in: 0.18



Subject: incorrect usage of UNIVERSAL::isa as a function
YAML::AppConfig uses UNIVERSAL::isa as function, whereas it is supposed to be a method. Moreover, importing it explicitely triggers a warning: UNIVERSAL->import is deprecated and will be removed in a future perl at /usr/lib/perl5/vendor_perl/5.12.2/YAML/AppConfig.pm line 5 Last but not least, its usage is absolutly useless, ref can be used directly, as demonstrated by the attached patch.
Subject: YAML-AppConfig-0.16-fix-warning.patch
diff -Naur -x '*~' YAML-AppConfig-0.16/lib/YAML/AppConfig.pm YAML-AppConfig-0.16-fix-warning/lib/YAML/AppConfig.pm --- YAML-AppConfig-0.16/lib/YAML/AppConfig.pm 2006-07-09 09:34:56.000000000 +0200 +++ YAML-AppConfig-0.16-fix-warning/lib/YAML/AppConfig.pm 2011-02-07 20:36:26.000000000 +0100 @@ -2,7 +2,6 @@ use strict; use warnings; use Carp; -use UNIVERSAL qw(isa); use Storable qw(dclone); # For Deep Copy #################### @@ -113,7 +112,7 @@ if ( not ref $value ) { $value = $self->_resolve_scalar($value); } - elsif ( isa $value, 'HASH' ) { + elsif (ref $value eq 'HASH' ) { $value = dclone($value); my @hidden = $self->_push_scope($value); for my $key ( keys %$value ) { @@ -122,13 +121,13 @@ $self->_pop_scope(@hidden); return $value; } - elsif ( isa $value, 'ARRAY' ) { + elsif (ref $value eq 'ARRAY' ) { $value = dclone($value); for my $item (@$value) { $item = $self->_resolve_refs( $item ); } } - elsif ( isa $value, 'SCALAR' ) { + elsif (ref $value eq 'SCALAR' ) { $value = $self->_resolve_scalar($$value); } else {
From: Ryan R
On Mon Feb 07 14:42:08 2011, GROUSSE wrote: Show quoted text
> YAML::AppConfig uses UNIVERSAL::isa as function, whereas it is supposed > to be a method. Moreover, importing it explicitely triggers a warning: > UNIVERSAL->import is deprecated and will be removed in a future perl at > /usr/lib/perl5/vendor_perl/5.12.2/YAML/AppConfig.pm line 5 > > Last but not least, its usage is absolutly useless, ref can be used > directly, as demonstrated by the attached patch.
Skipping the import and using the fully qualified function name also works; for example if the author is trying to treat blessed hashes/arrays as hashes and arrays 'ref' won't do the job (I'd have to trudge through the code a little more to see if this is in fact the case).
On Pon 07 Lut 2011, 14:42:08, GROUSSE wrote: Show quoted text
> YAML::AppConfig uses UNIVERSAL::isa as function, whereas it is supposed > to be a method. Moreover, importing it explicitely triggers a warning: > UNIVERSAL->import is deprecated and will be removed in a future perl at > /usr/lib/perl5/vendor_perl/5.12.2/YAML/AppConfig.pm line 5 > > Last but not least, its usage is absolutly useless, ref can be used > directly, as demonstrated by the attached patch.
Fixed in 0.18, thanks for reporting this!