diotalevi++ for introducing me to some wonderful sounding music.
When you run this, it displays nothing unless you change the value of the DEBUG constant to a true value. Even after changing the DEBUG value, it looks like the program is stuck in an endless loop. In the download_files subroutine where you have the file exist check of $file, I have added an else clause to print that it's downloading like this:
if (-e $file) {
print "SKIP\n" if DEBUG;
next;
} else {
print "downloading...\n" if DEBUG;
}
Also, I found two problems with your code.
1) You define the $SaveExt variable with this code:
our $SaveExt = '.wma';
Then in the download_files subroutine, you use the value like this:
my $file = "$directory$base_file.$SaveExt";
To keep the filename from looking like 081902..wma, change this line to:
my $file = "$directory$base_file$SaveExt";
2) I looked at the javascript files that this script parses and I found a problem with your regex. You have a $ at the end that should not be there.
Change:
our $SaveType = qr/http:\/\/.+?\.asx$/;
to:
our $SaveType = qr/http:\/\/.+?\.asx/;
and it appears to work as expected.
Update: You fixed your source as I was typing this up. :)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|