Initial commit
[www-rapidshare-free.git] / README
blobe7de74a0851b6ea15ee2b98c3db5a5ac39fd62a2
1 WWW-Rapidshare-Free
4 NAME
5     WWW::Rapidshare::Free - Automates downloading from Rapidshare.com and
6     checking links for free users
8 VERSION
9     Version 0.01
11 SYNOPSIS
12         use strict;
13         use warnings;
14         use WWW::Rapidshare::Free qw( verbose add_links check_links 
15           download connection );
17         # We are going to let the module be verbose and display a delay metre and 
18         # progress bar.
19         verbose(1);
21         my @links = add_links(
22             qw{
23               http://rapidshare.com/files/175658683/perl-51.zip
24               http://rapidshare.com/files/175662062/perl-52.zip
25               }
26         );
28         print "Added links:\n";
29         map print("\t$_\n"), @links;
31         my @erroneous_links = check_links;
32         map {
33             my ( $uri, $error ) = @{$_};
34             print "URI: $uri\nError: $error\n";
35         } @erroneous_links;
37         download(
38             properties    => \&properties,
39             file_complete => \&file_complete,
40         );
42         sub properties {
43             my ( $file_name, $file_size ) = @_;
44             print "Filename: $file_name\nFile size: $file_size bytes\n";
45         }
47         sub file_complete {
48             # Let us restart the modem. I have updated my /etc/sudoers file to allow me
49             # to execute sudo pppoe-start and sudo pppoe-stop without a password.
50             connection(
51                 connect    => 'sudo pppoe-start',
52                 disconnect => 'sudo pppoe-stop',
53             );
54         }
56 FUNCTIONS
57     By default, the module does not export any function. An export tag "all"
58     has been defined to export all functions. The following functions can be
59     exported:
61     *   add_links
63         Adds links to be downloaded and returns the added links as an array.
64         Accepts an array of values as argument. Ignores commented links
65         (links that start with a "#") and invalid links.
67     *   add_links_from_file
69         Adds links from a file which is given as an argument and returns the
70         added links as an array. Ignores commented links (links that start
71         with a "#") and invalid links.
73     *   links
75         Returns current links which have been added by "add_links" or
76         "add_links_from_file".
78     *   clear_links
80         Clears current links and returns them as an array.
82     *   check_links
84         Checks if the links are alive or not. Returns an array of array
85         references if there are dead links. The latter arrays are of the
86         form "[ link, error message ]". If all links are alive, returns
87         false. Additionally it also removes the dead links.
89             my @erroneous_links = check_links;
90             map {
91                 my ( $uri, $error ) = @{$_};
92                 print "URI: $uri\nError: $error\n";
93             } @erroneous_links;
95     *   download
97         Downloads files off valid links. Accepts a hash with a maximum of
98         four keys having callbacks as their values. The hash should be of
99         the form:
101             (
102                 delay          => \&delay_callback,
103                 properties     => \&properties_callback,
104                 progress       => \&progress_callback,
105                 file_complete  => \&file_complete
106             )
108         Callbacks are passed values as follows:
110         *   "delay"
112             "delay" callback is passed the number of seconds until download
113             begins. It is called every second until the delay is zero. Delay
114             is decremented each time the callback is executed.
116         *   "properties"
118             "properties" is passed the file name and file size as two
119             arguments.
121         *   "progress"
123             Sole argument is the number of bytes of the current file
124             downloaded so far. This callback is executed every instant in
125             which data is written to the file which is being downloaded.
127         *   "file_complete"
129             This callback passes control after each file is downloaded.
130             Disconnection/connection establishment or reconnection is
131             possible by invoking "connection".
133     *   verbose
135         Controls the output verbosity. Pass it a false value such as 0 or ''
136         (empty string) to turn off the delay metre and progress bar.
137         Everything else turns on verbosity. Verbosity is true by default.
139     *   connection
141         Most useful within the callback of "download" pertaining to the hash
142         key "file_complete". Accepts a hash:
144             connection(
145                 connect    => '',  # Command to start a connection
146                 disconnect => '',  # Command to disconnect
147                 reconnect  => ''   # Command to reconnect
148             );
150         Either both "connect" and "disconnect" have to be specified, or
151         "reconnect" has to be specified. If a single command can reconnect,
152         then a value for "reconnect" will be apt, else "connect" and
153         "disconnect" should be assigned the respective commands to connect
154         and disconnect. The commands should be your operating system's
155         commands to connect/disconnect/reconnect the internet connection.
157         Windows users can use the rasdial utility to connect/disconnect:
158         <http://technet.microsoft.com/en-us/library/bb490979.aspx>.
160     Check "download.pl" file inside "example" directory for usage example of
161     the module.
163 INSTALLATION
165 To install this module, run the following commands:
167         perl Makefile.PL
168         make
169         make test
170         make install
172 AUTHOR
173     Alan Haggai Alavi, "<alanhaggai at alanhaggai.org>"
175 BUGS
176     Please report any bugs or feature requests to "bug-www-rapidshare-free
177     at rt.cpan.org", or through the web interface at
178     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Rapidshare-Free>. I
179     will be notified, and then you will automatically be notified of
180     progress on your bug as I make changes.
182 SUPPORT AND DOCUMENTATION
184 After installing, you can find documentation for this module with the
185 perldoc command.
187     perldoc WWW::Rapidshare::Free
189 You can also look for information at:
191     RT, CPAN's request tracker
192         http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Rapidshare-Free
194     AnnoCPAN, Annotated CPAN documentation
195         http://annocpan.org/dist/WWW-Rapidshare-Free
197     CPAN Ratings
198         http://cpanratings.perl.org/d/WWW-Rapidshare-Free
200     Search CPAN
201         http://search.cpan.org/dist/WWW-Rapidshare-Free/
204 COPYRIGHT AND LICENCE
206 Copyright (C) 2008 Alan Haggai Alavi, all rights reserved.
208 This program is free software; you can redistribute it and/or modify it
209 under the same terms as Perl itself.