
WWW::Mixi::OO::Util - WWW::Mixi::OO's Helper Functions

use base qw(WWW::Mixi::OO::Util); $this->absolute_uri(..., ...);

misc helper functions.

$util->absolute_uri($uri, [$base]);
Generate absolute URI from base uri. This is simple wrapper for URI class.
$util->relative_uri($uri, [$base]);
Generate relative URI from base uri. This is simple wrapper for URI class.
$util->remove_tag($str);
Remove HTML(or XML, or SGML?) tag from string.
$util->extract_balanced_html_parts(
ignore_outside => 1,
element => 'table',
text => ...);
extract _balanced_ HTML parts from text.
options:
element name for balanced check.
text to extract.
ignore nth outside element.
example:
$util->extract_balanced_html_parts(
ignore_outside => 1,
element => 'table',
text => '<table><table>abc</table><table>cde</table></table>');
# returns:
# ('<table>abc</table>', '<table>cde</table>')
exclude border element from generate part.
example:
$util->extract_balanced_html_parts(
ignore_outside => 1,
exclude_border_element => 1,
element => 'table',
text => '<table><table>abc</table><table>cde</table></table>');
# returns:
# ('abc', 'cde')
my %hash = $util->html_attrs_to_hash('href="..."');
or more useful:
my $case_ignore_hash = $util->generate_ignore_case_hash($util->html_attrs_to_hash('href="..."'));
parse html attributes string to hash.
my $case_insensitive_hash = $util->generate_ignore_case_hash(%hash);
hash to ignore case hash.
obsolete. renamed to generate_ignore_case_hash
$util->copy_hash_val(\%src_hash, \%dest_hash, qw(foo bar baz));
or
$util->copy_hash_val(\%src_hash, \%dest_hash, [qw(foo bar)], [qw(baz qux)]);
copy hash value on key exist
$util->regex_parts->{$foo};
return some regex parts's hashref.
parts:
html non-meta char (not ["'<>]).
html non-meta chars ($non_meta*).
html non-meta-and-spc char (not ["'<> ]).
html non-meta-and-spc chars ($non_meta_spc*).
html non-meta-and-spc-eq char (not ["'<> =]).
html non-meta-and-spc-eq chars ($non_meta_spc_eq*).
html quoted string without grouping paren.
html quoted string with grouping.
html attribute value.
html attribute
maybe html attributes found
$util->escape($str);
equivalent of CGI::escapeHTML.
$util->unescape($str);
HTML unescape.
$util->unquote($str);
HTML unquote.
$util->rewrite($str);
standard rewrite method. do remove_tag and unescape.
sub foo { shift->please_override_this }
universal 'please override this' error method.


Topia <topia@clovery.jp>

Copyright (C) 2005 by Topia.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.