NAME
Clone::AsUTF8Bytes - recursively copy Perl data converting to UTF-8 bytes
SYNOPSIS
package Foo;
use parent 'Clone::AsUTF8Bytes';
package main;
my $original = Foo->new;
$copy = $original->clone_as_utf8_bytes;
# or
use Clone::AsUTF8Bytes qw(clone_as_utf8_bytes);
$a = { 'M\x{f8}\x{f8}se' => "\x{1F44D}" };
$b = [ "L\x{e9}on', "\N{SNOWMAN}" ];
$c = Foo->new;
$d = clone_as_utf8_bytes($a);
$e = clone_as_utf8_bytes($b);
$f = clone_as_utf8_bytes($c);
DESCRIPTION
This module provides a clone_as_utf8_bytes() method which makes recursive copies of nested hash, array, scalar and reference types, including tied variables and objects, modifying the characters in the strings as it does so into UTF-8 bytes. For example the Perl string L\x{e9}on
in the data strucutre will be converted to the string L\x{c3}\x{a9}on
.
clone_as_ut8_bytes() takes a scalar argument and duplicates and modifies it. To duplicate lists, arrays or hashes, pass them in by reference. e.g.
my $copy = clone (\@array);
# or
my %copy = %{ clone (\%hash) };
SEE ALSO
This module is essentially the Clone module slightly altered to do the utf-8 byte conversion.
COPYRIGHT
Copyright 2013 OmniTI. All Rights Reserved.
Majority of code in this module copyright 2001-2012 Ray Finch. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Coversion from Clone to Clone::AsUTF8Bytes was performed by Mark Fowler. <mark@twoshortplanks.com>
.
Original Clone module - which makes up the overall majority of the module - was written by Ray Finch <rdf@cpan.org>
. Breno G. de Oliveira <garu@cpan.org>
and Florian Ragwitz <rafl@debian.org>
performed routine maintenance releases on the Clone module since 2012.