Skip Menu |

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

Report information
The Basics
Id: 53490
Status: resolved
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: toddr [...] null.net
Cc:
AdminCc:

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



Subject: YAML::Tiny does not handle old Scalar::Util
 I've embedded YAML::Tiny in an installer program so it can run it on whichever perl happens to be available on a given Linux distribution. I'm running into an issue on Mandrake 9.0. 

The error is: "refaddr" is not exported by the Scalar::Util installed
Subject: yaml_tiny_scalar.patch
diff --git a/lib/YAML/Tiny.pm b/lib/YAML/Tiny.pm index dc3a445..2ccd889 100644 --- a/lib/YAML/Tiny.pm +++ b/lib/YAML/Tiny.pm @@ -586,6 +586,7 @@ sub LoadFile { BEGIN { eval { require Scalar::Util; + Scalar::Util->can('refaddr') or die("Scalar::Util is too old"); }; if ( $@ ) { # Failed to load Scalar::Util
I've adjusted the refaddr emulation code so it should now enable it for older versions of Scalar::Util rather than throwing an error.
From: paul [...] city-fan.org
On Mon Jan 31 19:12:17 2011, ADAMK wrote: Show quoted text
> I've adjusted the refaddr emulation code so it should now enable it for > older versions of Scalar::Util rather than throwing an error.
This fix doesn't actually work: t/01_compile...............ok t/02_basic.................# Failed test (t/lib/Test.pm at line 253) # got: 'Undefined subroutine &CPAN::Meta::YAML::refaddr called at /builddir/build/BUILD/CPAN-Meta-YAML-0.004/blib/lib/CPAN/Meta/YAML.pm line 470. # ' # expected: '' # Failed test (t/lib/Test.pm at line 253) # got: 'Undefined subroutine &CPAN::Meta::YAML::refaddr called at /builddir/build/BUILD/CPAN-Meta-YAML-0.004/blib/lib/CPAN/Meta/YAML.pm line 470. # ' # expected: '' # Failed test (t/lib/Test.pm at line 253) # got: 'Undefined subroutine &CPAN::Meta::YAML::refaddr called at /builddir/build/BUILD/CPAN-Meta-YAML-0.004/blib/lib/CPAN/Meta/YAML.pm line 470. # ' # expected: '' etc. Attached patch works for me. The problem has now propagated into CPAN::Meta::YAML 0.004, which is based on YAML::Tiny 1.50.
Subject: YAML-Tiny-1.48-old-Scalar::Util.patch
--- YAML-Tiny-1.48/lib/YAML/Tiny.pm.orig 2011-01-31 23:59:23.000000000 +0000 +++ YAML-Tiny-1.48/lib/YAML/Tiny.pm 2011-02-01 14:32:42.886958633 +0000 @@ -614,7 +614,7 @@ require Scalar::Util; }; if ( $@ or $Scalar::Util::VERSION < 1.18 ) { - eval <<'END_PERL' if $@; + eval <<'END_PERL'; # Scalar::Util failed to load or too old sub refaddr { my $pkg = ref($_[0]) or return undef;
Fixed in YAML::Tiny 1.48