Skip Menu |

This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id: 6092
Status: resolved
Priority: 0/
Queue: XML-Twig

Owner: MIROD [...]
Requestors: michael.kruckenberg [...]

Bug Information
Severity: Critical
Broken in: 3.15
Fixed in: (no value)

Subject: safe_encode() fails because encode() not imported to namespace from Encode
Download (untitled) / with headers
text/plain 1.6k
I'm using XML-Twig-3.15 on Solaris 8 (SunOS 5.8), Perl 5.8.0 (5.008), and getting an error when attempting to use the output_filter => 'safe'. Encode is version 1.99. The error: Undefined subroutine &XML::Twig::encode called at /usr/local/lib/perl5/site_perl/5.8.0/XML/ line 3343 It appears that safe_encode() is using encode() from the Encode module as if it's imported into the namespace, but the use statement specifies to only import the :fallback_all group, which doesn't include encode. It seems like the use statement needs to be changed to "use Encode qw( :all)", or to "use Encode qw( :fallback_all encode)". Or is there something I'm missing? From eval "use Encode qw( :fallback_all)"; sub safe_encode { my $str= shift; if( $] < 5.008) { $str =~ s{([\xC0-\xDF].|[\xE0-\xEF]..|[\xF0-\xFF]...)} {_XmlUtf8Decode($1)}egs; } else { $str= encode( ascii => $str, $FB_HTMLCREF); } return $str; } From our @EXPORT = qw( decode decode_utf8 encode encode_utf8 encodings find_encoding clone_encoding ); our @FB_FLAGS = qw(DIE_ON_ERR WARN_ON_ERR RETURN_ON_ERR LEAVE_SRC PERLQQ HTMLCREF XMLCREF); our @FB_CONSTS = qw(FB_DEFAULT FB_CROAK FB_QUIET FB_WARN FB_PERLQQ FB_HTMLCREF FB_XMLCREF); our @EXPORT_OK = ( qw( _utf8_off _utf8_on define_encoding from_to is_16bit is_8bit is_utf8 perlio_ok resolve_alias utf8_downgrade utf8_upgrade ), @FB_FLAGS, @FB_CONSTS, ); our %EXPORT_TAGS = ( all => [ @EXPORT, @EXPORT_OK ], fallbacks => [ @FB_CONSTS ], fallback_all => [ @FB_CONSTS, @FB_FLAGS ], );
Download (untitled) / with headers
text/plain 191b
Hi, You are absolutely right, and I can't believe the existing tests did not find this. It's fixed (and tested) in the development version at Thanks __ Mirod
From: michael.kruckenberg [...]
Thanks, the fix works.
Date: Thu, 22 Apr 2004 14:06:35 +0200 (CEST)
From: Michel Rodriguez <mirod [...]>
To: Guest via RT <bug-XML-Twig [...]>
Subject: Re: [cpan #6092] safe_encode() fails because encode() not imported to namespace from Encode
Download (untitled) / with headers
text/plain 238b
On Thu, 22 Apr 2004, Guest via RT wrote: Show quoted text
> Thanks, the fix works.
Great, I am waiting to hear for an other bug and if the fix for that one worked I will release a new version. -- Michel Rodriguez Perl &amp; XML

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to