从认识MusicBrainz的CPAN模块推出的类型? [英] Understanding the type of out put from Musicbrainz cpan module?

查看:151
本文介绍了从认识MusicBrainz的CPAN模块推出的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用的MusicBrainz CPAN模块查找一张专辑,但有试图破译我收到输出的几个问题进出口。我使用的数据::自卸车看看它,它似乎是一个哈希或某种阵列,但是当我尝试检查我遇到的问题类型。

Im using the Musicbrainz cpan module to look up an album but Im having a few issues trying to decipher the output I recieve. I used data::Dumper to have a look at it, and it appears to be a hash or array of some sort but when I try to check the type I run into problems.

my $ws = WebService::MusicBrainz::Release->new();

my $response = $ws->search({ TITLE => 'ok computer' });


if (ref($response) eq "REF" || ref($response) eq "SCALAR" || ref($response) eq "ARRAY" || ref($response) eq "HASH" || ref($response) eq "CODE" || ref($response) eq "GLOBE")

 {
 print "\n What sort of thing is it? \n";
 }

感谢

推荐答案

这是一个的的WebService :: MusicBrainz的响应:: 对象。

use WebService::MusicBrainz::Release;

my $ws = WebService::MusicBrainz::Release->new();
my $response = $ws->search({ TITLE => 'ok computer' });
my $release = $response->release(); # grab first one in the list
print $release->title(), " (", $release->type(), ") - ", $release->artist()->name(), "\n";

这篇关于从认识MusicBrainz的CPAN模块推出的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆