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

NAME

WWW::Sucksub::Frigo - Automated access to frigorifix subtibles database

VERSION

Version 0.03

SYNOPSIS

WWW::SuckSub::Frigo is a web robot based on the WWW::Mechanize Module This module search and collect distant result on the frigorifix.com web database. Subtitles Files urls and associated titles are stored in a dbm file. Distant and local subtitles search are possible. Accessing to the local database thru simple html generated repport.

        use WWW::Sucksub::Frigo;
        my $foo = WWW::Sucksub::Frigo->new(
                                        dbfile=> '/where/your/DBM/file is.db',
                                        html =>'/where/your/html/repport/is.html',
                                        motif=> 'the word(s) you search',
                                        debug=> 1, 
                                        logout => '/where/your/debug/info/are/written.log',
                                        );                                                      );
        $foo->search();         # collect all link corresponding to the $foo->motif()   
        $foo->motif('x');       # modify the search criteria 
        $foo->searchdbm();      # launch a search only on the local database 
        

Html report should be generated at the end of search() and searchdbm().

CONSTRUCTOR AND STARTUP

Frigo Constructor

The new() constructor, is associated to default values : you can modify these one as shown in the synopsis example. initial values you can modify are these :

        my $foo = WWW::Sucksub::Frigo->new(
                html=> "$ENV{HOME}"."/frigorifix_report.html",
                dbfile => "$ENV{HOME}"."/frigorifix_db.db",
                motif=> undef,
                tmpfile_frigo = > "$ENV{HOME}"."/tmp_frigo.html",
                debug=> 0,
                usedbm=>0,
                username_frigo=>"",
                password_frigo=>"", 
                logout => \*STDOUT                                              
                useragent=> "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007"
                );
See _init() internal function for more details.

new() constructor attributes and associated methods

Few attributes can be set thru new() attributes. All attributes can be modified by corresponding methods:

        $foo->WWW::Sucksub::Frigo->new()
        $foo->useragent() # get the useragent attribute value
        $foo->useragent('tructruc') # set the useragent attribute value to 'tructruc'

cookies_file()

arg must be a file, this default value can be modified by calling the

        $foo->cookies_file('/where/my/cookies/are.txt')

modify the default value positionned by the new constructor.

        $foo->cookies_file() 
        

return the actual value of the cookies file path.

usedbm(0/1)

Default value is 0. In this case, calling search() method won't affect the dbm file. You need to set the value 1 to activate dbm update

        $foo->usedbm(1)

This method will fails if no dbm file ( see dbfile() ) has been defined.

useragent()

arg should be a valid useragent. There's no reason to change this default value.

        $foo->useragent()
        

return the value of the current useragent.

tmpfile_frigo()

Frigo.pm needs to write temporary file. the tmpfile_frigo() method allows you to change path of this temporary file :

        $foo=WWW::Sucksub::Frigo->new(
                                                        ...
                                                        tmpfile_frigo => '/where/tmp/file/is/written.html',
                                                        ...
                                                );

To retrieve temporary file path :

        my $tmp=$foo->tmpfile_frigo();
        

To change temporary file path:

        $foo->tmpfile_frigo('/where/my/new/tmp/file/is/written.html');

motif()

you should here give a real value to this function : if $foo->motif stays undef, the package execution will be aborted

        $foo->motif('xxx')

allows to precise that you're searching a word that contains 'xxx'

        $foo->motif()

return the current value of the string you search.

debug()

WWW-Sucksub-Frigo can produce a lot of interresting informations The default value is "0" : that means that any debug informations will be written on the output ( see the logout() method too.)

        $foo->debug(0) # stop the product of debbugging informations
        $foo->debug(1) # debug info will be written to the log file ( see logout() method)

logout()

if you want some debug informations, you should set the debug attribute to 1 See debug() method for more precisions. logout() method is associated to the debug() attribute value. It indicates path where debug info will be written. Default value is :

                $foo=WWW::Sucksub::Frigo->new(
                                                        ...
                                                        logout => \*STDOUT, 
                                                        ...,
                                                        )

output and optional debugging info will be produced ont STDOUT or any other descriptor if you give filename as arg, by example :

$foo=WWW::Sucksub::Frigo->new( ... logout => '/where/my/log/is/written.txt', ..., )

dbfile()

define dbm file for store and retrieving extracted informations you must provide a full path to the db file to store results. the search() method can not be used without defined dbm file.

        $foo->dbfile('/where/your/db/is.db')

The file will should be readable/writable.

html()

Define simple html output where to write search report. you must provide au full path to the html file if you want to get an html output.

        $foo->html('/where/the html/repport/is/written.html')

If $foo->html() is defined. you can get the value of this attribute like this :

        my $html_page = $foo->html()

html file will be used for report with search and searchdbm() methods.

username_frigo()

Allow you to login and obtain cookies from frigorifix web site

        $foo->username_frigo('my_login')

Default value is empty. there's no obligation to fill it. Otherwise, you should fill password_frigo() too.

password_frigo()

Allow you to login and obtain cookies from frigorifix web site

        $foo->password_frigo('my_password')

Default value is empty. there's no obligations to fill it. Otherwise, you should fill username_frigo() too.

METHODS and FUNCTIONS

these functions use the precedent attributes value.

search()

this function takes no arguments. it alows to launch a local dbm search.

        $foo-> search()

the dbm file is read to give you every couple (title,link) which corresponds to the motif() pattern.

searchdbm()

this function takes no arguments. it allows to initiate the distant search on the web site frigorifix the local dbm file is automatically written. Results are accumulated to the dbm file you defined. a search pattern must be define thru motif() method before launching a dbm search.

get_all_result()

return a hash of every couple ( title, http link of subtitle file ) the search or update method returned.

        my %hash=$foo->get_all_result()

SEE ALSO

AUTHOR

Timothée foucart, <timothee.foucart@apinc.org>

BUGS

Please report any bugs or feature requests to bug-sucksub-frigo@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Sucksub-Frigo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 257:

Non-ASCII character seen before =encoding in 'Timothée'. Assuming CP1252