Initial commit
[www-rapidshare-free.git] / blib / man3 / WWW::Rapidshare::Free.3pm
blob7ebf0b944ab904bbfe719a9e9c5b4f20edc24a17
1 .\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
29 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
30 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
31 .\" nothing in troff, for use with C<>.
32 .tr \(*W-
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" Escape single quotes in literal strings from groff's Unicode transform.
52 .ie \n(.g .ds Aq \(aq
53 .el       .ds Aq '
54 .\"
55 .\" If the F register is turned on, we'll generate index entries on stderr for
56 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
57 .\" entries marked with X<> in POD.  Of course, you'll have to process the
58 .\" output yourself in some meaningful fashion.
59 .ie \nF \{\
60 .    de IX
61 .    tm Index:\\$1\t\\n%\t"\\$2"
63 .    nr % 0
64 .    rr F
65 .\}
66 .el \{\
67 .    de IX
69 .\}
70 .\"
71 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
72 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
73 .    \" fudge factors for nroff and troff
74 .if n \{\
75 .    ds #H 0
76 .    ds #V .8m
77 .    ds #F .3m
78 .    ds #[ \f1
79 .    ds #] \fP
80 .\}
81 .if t \{\
82 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
83 .    ds #V .6m
84 .    ds #F 0
85 .    ds #[ \&
86 .    ds #] \&
87 .\}
88 .    \" simple accents for nroff and troff
89 .if n \{\
90 .    ds ' \&
91 .    ds ` \&
92 .    ds ^ \&
93 .    ds , \&
94 .    ds ~ ~
95 .    ds /
96 .\}
97 .if t \{\
98 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
99 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
100 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
101 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
102 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
103 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .    \" troff and (daisy-wheel) nroff accents
106 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
107 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
108 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
109 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
110 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
111 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
112 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
113 .ds ae a\h'-(\w'a'u*4/10)'e
114 .ds Ae A\h'-(\w'A'u*4/10)'E
115 .    \" corrections for vroff
116 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
117 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
118 .    \" for low resolution devices (crt and lpr)
119 .if \n(.H>23 .if \n(.V>19 \
121 .    ds : e
122 .    ds 8 ss
123 .    ds o a
124 .    ds d- d\h'-1'\(ga
125 .    ds D- D\h'-1'\(hy
126 .    ds th \o'bp'
127 .    ds Th \o'LP'
128 .    ds ae ae
129 .    ds Ae AE
131 .rm #[ #] #H #V #F C
132 .\" ========================================================================
134 .IX Title "WWW::Rapidshare::Free 3"
135 .TH WWW::Rapidshare::Free 3 "2008-12-23" "perl v5.10.0" "User Contributed Perl Documentation"
136 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
137 .\" way too many mistakes in technical documents.
138 .if n .ad l
140 .SH "NAME"
141 WWW::Rapidshare::Free \- Automates downloading from Rapidshare.com and checking links for free users
142 .SH "VERSION"
143 .IX Header "VERSION"
144 Version 0.01
145 .SH "SYNOPSIS"
146 .IX Header "SYNOPSIS"
147 .Vb 4
148 \&    use strict;
149 \&    use warnings;
150 \&    use WWW::Rapidshare::Free qw( verbose add_links check_links 
151 \&      download connection );
153 \&    # We are going to let the module be verbose and display a delay metre and 
154 \&    # progress bar.
155 \&    verbose(1);
157 \&    my @links = add_links(
158 \&        qw{
159 \&          http://rapidshare.com/files/175658683/perl\-51.zip
160 \&          http://rapidshare.com/files/175662062/perl\-52.zip
161 \&          }
162 \&    );
164 \&    print "Added links:\en";
165 \&    map print("\et$_\en"), @links;
167 \&    my @erroneous_links = check_links;
168 \&    map {
169 \&        my ( $uri, $error ) = @{$_};
170 \&        print "URI: $uri\enError: $error\en";
171 \&    } @erroneous_links;
173 \&    download(
174 \&        properties    => \e&properties,
175 \&        file_complete => \e&file_complete,
176 \&    );
178 \&    sub properties {
179 \&        my ( $file_name, $file_size ) = @_;
180 \&        print "Filename: $file_name\enFile size: $file_size bytes\en";
181 \&    }
183 \&    sub file_complete {
184 \&        # Let us restart the modem. I have updated my /etc/sudoers file to allow me
185 \&        # to execute sudo pppoe\-start and sudo pppoe\-stop without a password.
186 \&        connection(
187 \&            connect    => \*(Aqsudo pppoe\-start\*(Aq,
188 \&            disconnect => \*(Aqsudo pppoe\-stop\*(Aq,
189 \&        );
190 \&    }
192 .SH "FUNCTIONS"
193 .IX Header "FUNCTIONS"
194 By default, the module does not export any function. An export tag \f(CW\*(C`all\*(C'\fR has 
195 been defined to export all functions. The following functions can be exported:
196 .IP "\(bu" 4
197 add_links
199 Adds links to be downloaded and returns the added links as an array. Accepts an 
200 array of values as argument. Ignores commented links (links that start with a 
201 \&\f(CW\*(C`#\*(C'\fR) and invalid links.
202 .IP "\(bu" 4
203 add_links_from_file
205 Adds links from a file which is given as an argument and returns the added 
206 links as an array. Ignores commented links (links that start with a \f(CW\*(C`#\*(C'\fR) and 
207 invalid links.
208 .IP "\(bu" 4
209 links
211 Returns current links which have been added by \f(CW\*(C`add_links\*(C'\fR or 
212 \&\f(CW\*(C`add_links_from_file\*(C'\fR.
213 .IP "\(bu" 4
214 clear_links
216 Clears current links and returns them as an array.
217 .IP "\(bu" 4
218 check_links
220 Checks if the links are alive or not. Returns an array of array references if 
221 there are dead links. The latter arrays are of the form 
222 \&\f(CW\*(C`[ link, error message ]\*(C'\fR. If all links are alive, returns false. Additionally
223 it also removes the dead links.
225 .Vb 5
226 \&    my @erroneous_links = check_links;
227 \&    map {
228 \&        my ( $uri, $error ) = @{$_};
229 \&        print "URI: $uri\enError: $error\en";
230 \&    } @erroneous_links;
232 .IP "\(bu" 4
233 download
235 Downloads files off valid links. Accepts a hash with a maximum of four keys 
236 having callbacks as their values. The hash should be of the form:
238 .Vb 6
239 \&    (
240 \&        delay          => \e&delay_callback,
241 \&        properties     => \e&properties_callback,
242 \&        progress       => \e&progress_callback,
243 \&        file_complete  => \e&file_complete
244 \&    )
247 Callbacks are passed values as follows:
248 .RS 4
249 .IP "\(bu" 4
250 \&\f(CW\*(C`delay\*(C'\fR
252 \&\f(CW\*(C`delay\*(C'\fR callback is passed the number of seconds until download begins. It is 
253 called every second until the delay is zero. Delay is decremented each time the 
254 callback is executed.
255 .IP "\(bu" 4
256 \&\f(CW\*(C`properties\*(C'\fR
258 \&\f(CW\*(C`properties\*(C'\fR is passed the file name and file size as two arguments.
259 .IP "\(bu" 4
260 \&\f(CW\*(C`progress\*(C'\fR
262 Sole argument is the number of bytes of the current file downloaded so far. This
263 callback is executed every instant in which data is written to the file which is
264 being downloaded.
265 .IP "\(bu" 4
266 \&\f(CW\*(C`file_complete\*(C'\fR
268 This callback passes control after each file is downloaded. 
269 Disconnection/connection establishment or reconnection is possible by invoking 
270 \&\f(CW\*(C`connection\*(C'\fR.
272 .RS 4
274 .IP "\(bu" 4
275 verbose
277 Controls the output verbosity. Pass it a false value such as 0 or '' (empty 
278 string) to turn off the delay metre and progress bar. Everything else turns on 
279 verbosity. Verbosity is true by default.
280 .IP "\(bu" 4
281 connection
283 Most useful within the callback of \f(CW\*(C`download\*(C'\fR pertaining to the hash key 
284 \&\f(CW\*(C`file_complete\*(C'\fR. Accepts a hash:
286 .Vb 5
287 \&    connection(
288 \&        connect    => \*(Aq\*(Aq,  # Command to start a connection
289 \&        disconnect => \*(Aq\*(Aq,  # Command to disconnect
290 \&        reconnect  => \*(Aq\*(Aq   # Command to reconnect
291 \&    );
294 Either both \f(CW\*(C`connect\*(C'\fR and \f(CW\*(C`disconnect\*(C'\fR have to be specified, or \f(CW\*(C`reconnect\*(C'\fR 
295 has to be specified. If a single command can reconnect, then a value for 
296 \&\f(CW\*(C`reconnect\*(C'\fR will be apt, else \f(CW\*(C`connect\*(C'\fR and \f(CW\*(C`disconnect\*(C'\fR should be assigned 
297 the respective commands to connect and disconnect. The commands should be your 
298 operating system's commands to connect/disconnect/reconnect the internet 
299 connection.
301 Windows users can use the rasdial utility to connect/disconnect: 
302 <http://technet.microsoft.com/en\-us/library/bb490979.aspx>.
304 Check \f(CW\*(C`download.pl\*(C'\fR file inside \f(CW\*(C`example\*(C'\fR directory for usage example of the 
305 module.
306 .SH "AUTHOR"
307 .IX Header "AUTHOR"
308 Alan Haggai Alavi, \f(CW\*(C`<alanhaggai at alanhaggai.org>\*(C'\fR
309 .SH "BUGS"
310 .IX Header "BUGS"
311 Please report any bugs or feature requests to 
312 \&\f(CW\*(C`bug\-www\-rapidshare\-free at rt.cpan.org\*(C'\fR, or through the web interface at 
313 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW\-Rapidshare\-Free>. I will 
314 be notified, and then you will automatically be notified of progress on your 
315 bug as I make changes.
316 .SH "SUPPORT"
317 .IX Header "SUPPORT"
318 You can find documentation for this module with the perldoc command.
320 .Vb 1
321 \&    perldoc WWW::Rapidshare::Free
324 You can also look for information at:
325 .IP "\(bu" 4
326 \&\s-1RT:\s0 \s-1CPAN\s0's request tracker
328 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW\-Rapidshare\-Free>
329 .IP "\(bu" 4
330 AnnoCPAN: Annotated \s-1CPAN\s0 documentation
332 <http://annocpan.org/dist/WWW\-Rapidshare\-Free>
333 .IP "\(bu" 4
334 \&\s-1CPAN\s0 Ratings
336 <http://cpanratings.perl.org/d/WWW\-Rapidshare\-Free>
337 .IP "\(bu" 4
338 Search \s-1CPAN\s0
340 <http://search.cpan.org/dist/WWW\-Rapidshare\-Free/>
341 .SH "COPYRIGHT & LICENSE"
342 .IX Header "COPYRIGHT & LICENSE"
343 Copyright 2008 Alan Haggai Alavi, all rights reserved.
345 This program is free software; you can redistribute it and/or modify it
346 under the same terms as Perl itself.