HTML::MobileJp::Plugin::EZweb::Object - generate object object download HTML tag.


HTML-MobileJp documentation Contained in the HTML-MobileJp distribution.

Index


Code Index:

NAME

Top

HTML::MobileJp::Plugin::EZweb::Object - generate object object download HTML tag.

SYNOPSIS

Top

    use HTML::MobileJp;
    ezweb_object(
        url         => 'http://aa.com/movie.amc',
        mime_type   => 'application/x-mpeg',
        copyright   => 'no',
        standby     => '$B%@%&%s%m!<%I(B',
        disposition => 'devdl1q',
        size        => '119065',
        title       => '$B%5%s%W%kF02h(B',
    );
    # =>
    #   <object data="http://aa.com/movie.amc" type="application/x-mpeg" copyright="no" standby="$B%@%&%s%m!<%I(B">
    #   <param name="disposition" value="devdl1q" valuetype="data" />
    #   <param name="size" value="119065" valuetype="data" />
    #   <param name="title" value="$B%5%s%W%kF02h(B" valuetype="data" />
    #   </object>

DESCRIPTION

Top

generate object download HTML tag.

AUTHOR

Top

Tokuhiro Matsuno <tokuhirom aaaatttt gmail dotottto commmmm>

SEE ALSO

Top

HTML::MobileJp, http://www.au.kddi.com/ezfactory/tec/spec/wap_tag5.html

LICENSE

Top

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


HTML-MobileJp documentation Contained in the HTML-MobileJp distribution.

package HTML::MobileJp::Plugin::EZweb::Object;
use strict;
use warnings;
use base 'Exporter';
use Params::Validate;
use HTML::Entities;

our @EXPORT = qw/ezweb_object/;

sub _escape { encode_entities( $_[0], q{<>&"'} ) }

sub _param {
    sprintf q{<param name="%s" value="%s" valuetype="data" />},
      _escape( $_[0] ), _escape( $_[1] );
}

sub ezweb_object {
    validate(
        @_,
        +{
            url    => 1,
            mime_type   => 1,
            copyright   => { regex => qr{^(?:yes|no)$} },
            standby     => 0,
            disposition => { regex => qr{^dev.+$} },
            size        => { regex => qr{^[0-9]+$} },
            title       => 1,
        }
    );
    my %args = @_;

    my @ret;
    push @ret, sprintf(
        q{<object data="%s" type="%s" copyright="%s" standby="%s">},
        _escape( $args{url} ),
        _escape( $args{mime_type} ),
        _escape( $args{copyright} ),
        _escape( $args{standby} )
    );
    push @ret, map { _param($_, $args{$_}) } qw/disposition size title/;
    push @ret, "</object>";

    join("\n", @ret) . "\n";
}

1;
__END__