<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># $File: //member/autrijus/Encode-compat/lib/Encode/compat.pm $ $Author: autrijus $
# $Revision: #7 $ $Change: 10735 $ $DateTime: 2004/06/03 14:08:57 $

package Encode::compat;
$Encode::compat::VERSION = '0.07';

use strict;

if ($] &gt;= 5.007001 or $INC{'Encode.pm'}) {
    # nothing happens -- Encode.pm already available.
}
elsif ($] &gt;= 5.006001 and $] &lt;= 5.007) {
    require Encode::compat::Alias;
    $INC{'Encode/Alias.pm'} = $INC{'Encode/compat/Alias.pm'};

    require Encode::compat::common;
    require Encode::compat::5006001;
    $INC{'Encode.pm'} = __FILE__;
}
else {
    die "Encode.pm compatibility layer for $] not yet available.";
}

1;

__END__

=head1 NAME

Encode::compat - Encode.pm emulation layer

=head1 VERSION

This document describes version 0.07 of Encode::compat, released
June 3, 2004.

=head1 SYNOPSIS

    use Encode::compat; # a no-op for Perl v5.7.1+
    use Encode qw(...); # all constants and imports works transparently

    # use Encode functions as normal

=head1 DESCRIPTION

WARNING: THIS IS A PROOF-OF-CONCEPT.  Most functions are incomplete.
All implementation details are subject to change!

This module provide a compatibility layer for B&lt;Encode.pm&gt; users on perl
versions earlier than v5.7.1.  It translates whatever call it receives
into B&lt;Text::Iconv&gt;, or (in the future) B&lt;Unicode::MapUTF8&gt; to perform
the actual work.

The C&lt;is_utf8()&gt;, C&lt;_utf8_on()&gt; and C&lt;_utf8_off()&gt; calls are performed
by the method native to the perl version -- 5.6.1 would use
C&lt;pack&gt;/C&lt;unpack&gt;, 5.6.0 uses C&lt;tr//CU&gt;, etc.

Theoretically, it could be backported to 5.005 and earlier, with none of
the unicode-related semantics available, and serves only as a
abstraction layer above C&lt;Text::Iconv&gt;, C&lt;Unicode::MapUTF8&gt; and possibly
other transcoding modules.

=head1 CAVEATS

Currently, this module only support 5.6.1+, and merely provides the three
utility function above (C&lt;encode()&gt;, C&lt;decode()&gt; and C&lt;from_to()&gt;), with
a very kludgy C&lt;FB_HTMLCREF&gt; fallback against C&lt;latin-1&gt; in
C&lt;from_to()&gt;.

=head1 SEE ALSO

L&lt;Encode&gt;, L&lt;perlunicode&gt;

=head1 AUTHORS

Autrijus Tang E&lt;lt&gt;autrijus@autrijus.orgE&lt;gt&gt;

=head1 COPYRIGHT

Copyright 2002, 2003, 2004 by Autrijus Tang E&lt;lt&gt;autrijus@autrijus.orgE&lt;gt&gt;.

This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.

See L&lt;http://www.perl.com/perl/misc/Artistic.html&gt;

=cut
</pre></body></html>