Protocol::XMLRPC::Value::Base64 - XML-RPC array


Protocol-XMLRPC documentation Contained in the Protocol-XMLRPC distribution.

Index


Code Index:

NAME

Top

Protocol::XMLRPC::Value::Base64 - XML-RPC array

SYNOPSIS

Top

    my $base64 = Protocol::XMLRPC::Value::Base64->new('foo');
    my $base64 = Protocol::XMLRPC::Value::Base64->parse("Zm9v\n");

DESCRIPTION

Top

XML-RPC base64

METHODS

Top

new

Creates new Protocol::XMLRPC::Value::Base64 instance.

parse

Parses base64 string and creates a new Protocol::XMLRPC:::Value::Base64 instance.

type

Returns 'base64'.

value

    my $base64 = Protocol::XMLRPC::Value::Base64->new('foo');
    # $base64->value returns 'Zm9v\n'

Returns serialized Perl5 scalar.

to_string

    my $base64 = Protocol::XMLRPC::Value::Base64->new('foo');
    # $base64->to_string is now
    # '<base64>Zm9v
    # </base64>'

XML-RPC base64 string representation.

AUTHOR

Top

Viacheslav Tykhanovskyi, vti@cpan.org.

COPYRIGHT

Top


Protocol-XMLRPC documentation Contained in the Protocol-XMLRPC distribution.

package Protocol::XMLRPC::Value::Base64;

use strict;
use warnings;

use base 'Protocol::XMLRPC::Value';

require MIME::Base64;

sub type {'base64'}

sub parse {
    my $class = shift;
    my ($value) = @_;

    return $class->new(MIME::Base64::decode_base64($value));
}

sub to_string {
    my $self = shift;

    my $value = $self->value;

    $value = MIME::Base64::encode_base64($value);

    return "<base64>$value</base64>";
}

1;
__END__