Archive of UserLand's first discussion group, started October 5, 1998.
Re: Scripting on Linux (And general Unix)
Author: Geoff Allen Posted: 5/18/1999; 8:06:31 AM Topic: Scripting on Linux Msg #: 6408 (In response to 6385) Prev/Next: 6407 / 6409
There is something funny that I noted. Some of the answers are saying that there is a bazillion ways to do what I was asking. But nobody posted sample code.Ok, here goes. This is for the second question (get a URL, copy its contents, and open the HTML in Netscape). Like others, unfortunately, I'm not sure how to "get the front window URL" from Netscape.
This code correctly handles the situation whether netscape is currently running or not, but other than that, there aren't any bells or whisltes.
#!/usr/local/bin/perl -wuse strict; use LWP::UserAgent; use HTTP::Request;
my $agent = new LWP::UserAgent; $agent->env_proxy;
my $request = new HTTP::Request('GET', "http://www.scripting.com/"); my $response = $agent->request($request, "/tmp/scriptnews.html");
if ($response->is_error()) { print STDERR "Error getting Scripting News!\n\t" . $response->code . " " . $response->message . "\n"; } else { if (system("netscape -remote 'openURL(file:/tmp/scriptnews.html, new-window)'") != 0){ system("netscape file:/tmp/scriptnews.html &"); } }
There are responses to this message:
- Scripting Unix at the CLI with XML-RPC, Ken MacLeod, 5/18/1999; 10:34:07 AM
This page was archived on 6/13/2001; 4:50:16 PM.
© Copyright 1998-2001 UserLand Software, Inc.