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. :)


In reply to Re: Real Synthetic Audio downloader by Mr. Muskrat
in thread Real Synthetic Audio downloader by diotalevi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.