Mojo :: DOM:有些角色需要特殊的转义吗?

时间:2012-04-27 11:24:40

标签: perl dom mojolicious

为什么media:group不起作用,虽然它出现在dom中?

#!/usr/bin/env perl
use warnings;
use 5.12.0;
use Mojo::UserAgent;

my $ua = Mojo::UserAgent->new();

my $id = 'E7511681ABEA8635';
my $url = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?v=2';
my $tx = $ua->get( $url );

say $tx->res->dom->at( 'category' )->type;
say $tx->res->dom->at( 'media:group' )->type;

# category
# Can't call method "type" on an undefined value at ./perl.pl line 13

1 个答案:

答案 0 :(得分:5)

因为media:是命名空间吗?如果您将最后一行更改为('group'),则返回'media:group'