The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::TV::Episode - Parse TV.com for TV Episode information.

SYNOPSIS

  use WWW::TV::Episode qw();
  my $episode = WWW::TV::Series->new(id => '475567');

  # with optional paramers

  print $episode->summary;

DESCRIPTION

The WWW::TV::Episode module parses TV.com episode information using LWP::UserAgent. Unfortunately I can't see a way to search for an episode by name, so I haven't implemented it. It is probably possible to do so if you populate a series object and grep $series->episodes for the episode name you are searching for.

METHODS

new

    The new() method is the constructor. It takes the id of the show
    assuming you have previously looked that up.

        # default usage
        my $episode = WWW::TV::Episode->new(id => 924072);

        # change user-agent from the default of "libwww-perl/#.##"
        my $episode = WWW::TV::Episode->new(id => 924072, agent => 'WWW::TV');

    It also (optionally) takes the name of the episode. This is not used
    in any way to search for the episode, but is used as initial data
    population for that field so that the html isn't parsed if you only
    want an object with the name. This is used by the L<WWW::TV::Series>
    object to populate a big array of episodes that have names without
    needing to fetch any pages.

        # pre-populate episode name
        my $episode = WWW::TV::Episode->new(id => 924072, name => 'Run!');

id

    The ID of this episode, according to TV.com

name

    Returns a string containing the name of the episode.

summary

    Returns a string containing basic information about this series.

season_number

    Returns the season number that this episode appeared in.

episode_number

    Returns the overall number of this episode. Note, this is not
    necessarily the production order of the episodes, but is the order
    in which they aired.

format_details ($format_str)

    Returns episode details using a special format string, similar to printf:
       %I - series ID
       %N - series name
       %s - season number
       %S - season number (0-padded to two digits, if required)
       %i - episode ID
       %e - episode number
       %E - episode number (0-padded to two digits, if required)
       %n - episode name
       %d - date episode first aired

    The default format is:
       %N.s%Se%E - %n (eg: "Heroes.s1e02 - Don't Look Back")

first_aired

    Returns a string of the date this episode first aired in ISO 8601 (yyyy-mm-dd) format.

stars

    Returns a list of the stars that appeared in this episode.

    # in scalar context, returns a comma-delimited string
    my $stars = $episode->stars;

    # in array context, returns an array
    my @stars = $episode->stars;

guest_stars

    Returns a list of the guest stars that appeared in this episode.

    # in scalar context, returns a comma-delimited string
    my $guest_stars = $episode->guest_stars;

    # in array context, returns an array
    my @guest_stars = $episode->guest_stars;

recurring_roles

    Returns a list of the people who have recurring roles
    that appeared in this episode

    # in scalar context, returns a comma-delimited string
    my $recurring_roless = $episode->recurring_roless;

    # in array context, returns an array
    my @recurring_roless = $episode->recurring_roless;

writers

    Returns a list of the people that wrote this episode.

    # in scalar context, returns a comma-delimited string
    my $writers = $episode->writers;

    # in array context, returns an array
    my @writers = $episode->writers;

directors

    Returns a list of the people that directed this episode.

    # in scalar context, returns a comma-delimited string
    my $directors = $episode->directors;

    # in array context, returns an array
    my @directors = $episode->directors;

agent ($value)

Returns the current user agent setting, and sets to $value if provided.

site ($value)

Returns the current mirror site setting, and sets to $value if provided.

Default site is "www"; other options include: us, uk, au

url

    Returns the url that was used to create this object.

season

    Returns an array of other episodes for the same season of this series.

series_id

    Returns the series ID for this episode.

series

    Returns an L<WWW::TV::Series> object which is the complete series
    that this episode is a part of.

SEE ALSO

WWW::TV::Series

KNOWN ISSUES

There isn't yet any caching support. I don't see a need for it, but if you feel the need to implement it then don't let me stop you.

There also isn't support for proxy servers yet. LWP should use it from your environment if you really need it, but who still uses them anyway? Isn't it all done transparently these days.

BUGS

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Dist/Display.html?Queue=WWW-TV.

AUTHORS

Danial Pearce cpan@tigris.id.au

Stephen Steneker stennie@cpan.org

LICENCE AND COPYRIGHT

Copyright (c) 2006-2008 Danial Pearce cpan@tigris.id.au. All rights reserved.

Some parts copyright 2007-2008 Stephen Steneker stennie@cpan.org.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.