Hello world! I've found myself troubled with a very simple problem. Or.. at least what should be a simple problem.
If anyone can help me out, i'd greatly appreciate it. I've included my code, in full; though it's not very long. ################## START OF CODE ##################### # Coding with Active State Perl, win32. #! perl use strict; use warnings; use HTTP::Lite; ####### # Prototype declaration sub GetTodaysCast(); # Get today's webcast url from jimhightower.com's index page sub PlayWebCast($$); # Launch the webcast url (via RealPlayer) # End Proto's ####### ###### # Main my $realPlayerApp = 'C:\Progra~1\Real\RealPlayer\realplay.exe'; my $castToPlay = ''; # Traverse jimhightower.com and find/store the url for the latest web cast # For testing purposes though, we'll skip this; read on.. ** #$castToPlay = GetTodaysCast(); # ** Instead of that, we'll just manually enter the URL; $castToPlay = 'http://stream.realimpact.net/rihurl.ram?file=webactive/hightower/ht20020926.ra'; # Launch the specified application (Real Player) PlayWebCast($realPlayerApp, $castToPlay); # End Main ###### ###### # Sub-Routine Declarations sub PlayWebCast($$) # Play the given web url, which should be a link to a web cast { my $playerApp = shift; # Get the location of the file to play my $webCast = shift; # Get the audio Application's # Location and Executable name # Launch Realplayer with the given url # THE FOLLING DOESN'T WORK! AND IT IS THE PROBLEM I'M NEEDING HELP WITH. # I put $webCast in the LIST operators because perldoc says system looks for a list... # Even when i set it up with error an error catcher like system(..) == 0 .... print $!... # I can't figure out what the hell's going on. # It just doesn't do anything. # Though it works just fine for running (for testing) calc.exe (windows # calculator application) Even when i put it in the RealPlayer directory it works... # I also successfully implemented the system call with args calling notepade.exe. # ** ** # print "Trying to Run -- system $playerApp ($webCast):\n"; # system $playerApp, ($webCast); # ** ** # The following works. But because of exec's nature, it automatically kills the script after # the exec finish's... I don't want it to do that. I'd like to be able to continue # on executing this script to do other things, like get a listing of other web casts, etc.. # So i'd like to get the system command working (or something better if there is...) # ** ** print "Trying to Run -- exec $playerApp $webCast:\n"; exec $playerApp, ($webCast); # ** ** # What would be the best way to catch error's for either of these? Especially # the system call? } # *************** FOR TESTING PURPOSES THE FOLLOWING IS NOT BEING USED! ******************* sub GetTodaysCast() # Traverse www.jimhightower.com's index page until the URL for his latest web cast is found # and return that url, otherwise, DIE! { # Page with the latest Cast, usually "today" my $todaysCast = 'http://www.jimhightower.com/'; my $http = new HTTP::Lite; my $req = $http->request($todaysCast) or die "Unable to get requested Document\n\t[" . "$todaysCast" . "]\n"; # Get the html code for the http page requested my $body = $http->body(); # For storing the URL of Hightowers' latest (today's) web cast my $latestCast = undef; # Split the whole body into seperate lines my @body = split('\n', $body); foreach my $line (@body) # Traverse through the body and look for the latest web cast { if ($line =~ /<a\shref="(.*)\">Hear/) # Store the full URL only if it can be found { $latestCast = $1; } } if ($latestCast) # If the var is not undef, then it found a URL, So return it { return $latestCast; } else # If the Var is undef, then it didn't find a URL, so DIE! { die "Unable to find Hightowers' lastest web cast (Hear It)\n"; } } # End Functions ###### ####################### END CODE ###################### Call me on any bad practices i'm making use of too if you'd like. I'd appreciate that too. Or just any "better" practices i could be using. You know? Thanks again, everyone. This list RULES! You guy's that do all the helping RULE even MORE! One day... Oh yes, One day, I shall be as fluent in Perl as you all are, and i will contribute my little heart out just as you all do. Laters, - Dr. Poo ( - Chris - ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]