5 WWW::Rapidshare::Free - Automates downloading from Rapidshare.com and
6 checking links for free users
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
21 my @links = add_links(
23 http://rapidshare.com/files/175658683/perl-51.zip
24 http://rapidshare.com/files/175662062/perl-52.zip
28 print "Added links:\n";
29 map print("\t$_\n"), @links;
31 my @erroneous_links = check_links;
33 my ( $uri, $error ) = @{$_};
34 print "URI: $uri\nError: $error\n";
38 properties => \&properties,
39 file_complete => \&file_complete,
43 my ( $file_name, $file_size ) = @_;
44 print "Filename: $file_name\nFile size: $file_size bytes\n";
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.
51 connect => 'sudo pppoe-start',
52 disconnect => 'sudo pppoe-stop',
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
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.
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.
75 Returns current links which have been added by "add_links" or
76 "add_links_from_file".
80 Clears current links and returns them as an array.
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;
91 my ( $uri, $error ) = @{$_};
92 print "URI: $uri\nError: $error\n";
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
102 delay => \&delay_callback,
103 properties => \&properties_callback,
104 progress => \&progress_callback,
105 file_complete => \&file_complete
108 Callbacks are passed values as follows:
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.
118 "properties" is passed the file name and file size as two
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.
129 This callback passes control after each file is downloaded.
130 Disconnection/connection establishment or reconnection is
131 possible by invoking "connection".
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.
141 Most useful within the callback of "download" pertaining to the hash
142 key "file_complete". Accepts a hash:
145 connect => '', # Command to start a connection
146 disconnect => '', # Command to disconnect
147 reconnect => '' # Command to reconnect
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
165 To install this module, run the following commands:
173 Alan Haggai Alavi, "<alanhaggai at alanhaggai.org>"
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
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
198 http://cpanratings.perl.org/d/WWW-Rapidshare-Free
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.