On Thu, 26 Sep 2002, Chris (?) wrote: > 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 $!...
The return value of system is the exit status of the program. For most of these applications an exit status of 0 means success. Your have an error when the exit status is not 0, change your if from system(...) == 0 to system(...) != 0. After calling the system function you can also check the $? variable for failure. Read through perldoc -f system completely > # 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); > # ** ** Note using system will not help you either, the control returns to your program only after the application invoked from system exits. What you need here is to fork a child and exec the application from there. perldoc -f fork > > # What would be the best way to catch error's for either of these? Especially > # the system call? As I have explained earlier check the $? variable, again read through perldoc -f system completely. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]