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

sid*_*com 2 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
Run Code Online (Sandbox Code Playgroud)

小智 5

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