Posted on 2007-09-29 08:05:24-07 by s41nt
Can't get directors functionality working
Hello all I'm trying to use the www-yahoo-movies library to extract some key information from yahoo movies. It all works with the exception of the director, cast and producer information. I created a very basic perl script (using the provided example) below to illustrate this.
#!/usr/bin/perl -w use strict; use warnings; use WWW::Yahoo::Movies; my $title = shift || 'The Talented Mr Ripley'; my $matched = get_movie_info($title, 1); for(@$matched) { print "\nGet [$_->{title}] ...\n"; get_movie_info($_->{id}); } sub get_movie_info { my $title = shift; my $ret_match = shift || 0; my $ym = new WWW::Yahoo::Movies(id => $title); my $directors = $ym->directors(); print "Get info about [$title] ..."; print "\n\tID: ".$ym->id; print "\n\tTITLE: ".$ym->title; print "\n\tYEAR: ".$ym->year; print "\n\tMPAA: ".$ym->mpaa_rating; print "\n\tCOVER: ".$ym->cover_file; print "\n\tPLOT: ".substr($ym->plot_summary, 0, 90)." ..."; print "\n\tDATE: ".$ym->release_date; print "\n\tDISTR: ".$ym->distributor; print "\n\tGENRES: ".join(", ", @{ $ym->genres }) if $ym->genres; for(@$directors) { print "$_->[0]: $_->[1]\n"; } return $ym->matched if $ret_match; }
What am I doing wrong? s41nt
Direct Responses: 6138 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.