Web-XDO
view release on metacpan or search on metacpan
lib/Web/XDO.pm view on Meta::CPAN
sub new {
my ($class, $url_root, $url_rel_path, $xdo, %opts) = @_;
my ($tokens, $token_idx, $page);
# TESTING
# println $class, '->new()'; ##i
# create page object
$page = $class->SUPER::new();
# don't recognize cdata tags
$page->xml_mode(1);
# must either designate a caller or explicitly set as top page
if (my $caller = $opts{'caller'}) {
if (UNIVERSAL::isa($caller, 'Web::XDO::Page')) {
$page->{'caller'} = $caller;
}
else {
croak q|caller is not a page object|;
}
lib/Web/XDO.pm view on Meta::CPAN
sub start {
my ($page, $tag_name, $atts, $att_order, $raw) = @_;
my ($self_ender, $def, $token, $xdo);
$xdo = $page->{'xdo'};
# TESTING
# println $tag_name, '->start'; ##i
# normalize tag name
# NOTE: We need to normalize here because the parser is in xml_mode. That
# mode is on so that content of cdata tags (specificall <title>) are
# parsed. It has the side-effect that tag names are sent as they appear
# in the document being parsed. If anybody knows a more global way to send
# lowercased tag names I'll be glad to hear about it. - Miko
$tag_name = lc($tag_name);
# if the tag has a trailing slash then it's a self-ender
if ($raw =~ m|/\s*\>$|s)
{ $self_ender = 1 }
# NOTE: Funky code ahead. The following few lines take into account several
lib/Web/XDO.pm view on Meta::CPAN
Web::XDO::Token::EndTag class.
=cut
sub end {
my ($page, $tag_name, $raw) = @_;
my ($token);
# normalize tag name
# NOTE: We need to normalize here because the parser is in xml_mode. That
# mode is on so that content of cdata tags (specificall <title>) are
# parsed. It has the side-effect that tag names are sent as they appear
# in the document being parsed. If anybody knows a more global way to send
# lowercased tag names I'll be glad to hear about it. - Miko
$tag_name = lc($tag_name);
# create token object
$token = Web::XDO::Token::EndTag->new();
$token->{'type'} = 'end_tag';
$token->{'name'} = $tag_name;
$token->{'raw'} = $raw;
( run in 0.660 second using v1.01-cache-2.11-cpan-454fe037f31 )