Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Opening URL in instrumented browser

by Arunbear (Parson)
on Sep 17, 2013 at 16:20 UTC ( #1054485=note: print w/replies, xml ) Need Help??

in reply to Opening URL in instrumented browser

system perhaps? e.g.
perl -e 'system(q[opera --remote "openURL("] +)'

Replies are listed 'Best First'.
Re^2: Opening URL in instrumented browser
by chris92 (Initiate) on Sep 17, 2013 at 16:51 UTC
    I need to get the control back to my perl program. I guess the above call is a blocking call??

      From the documentation on system:

      Does exactly the same thing as exec LIST , except that a fork is done first and the parent process waits for the child process to exit.

      Another alternative would be to use backticks instead of system. I personally consider this as a "quick" and "dirty" method even though I do use it a lot. There are some potential problems with using this method. Off hand I don't remember what all of the issues are, but I believe that there are better ways to launch another program and return control back to the Perl script without waiting for the launched program to return control.

      Yes, it is a blocking call:
      % perl -E 'system(q[opera]); say "hello!" ' + hello!
      That only prints "hello!" once Opera exists. Non-blocking alternatives are:
      % perl -E 'system(q[opera &]); say "hello!" +' hello!
      i.e. launching in the background, or
      % perl -E '$r = fork; if($r == 0) { exec(q[opera http://www.perlmonks. +org/]) } elsif(defined $r) { say "hello!" }' hello!
      which forks off a child process, and uses exec (so the child process doesn't hang around waiting for the browser process to end).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054485]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2016-10-20 22:40 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (283 votes). Check out past polls.