[6414] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 39 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 3 05:07:47 1997

Date: Mon, 3 Mar 97 02:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 3 Mar 1997     Volume: 8 Number: 39

Today's topics:
     Autostart perl program rlgolden@ngeorgia.com
     Re: Autostart perl program (Tad McClellan)
     Beginner Perl/CGI <fortune@in.net>
     Calling PGP from a Perl CGI script "Martin_Khoo/SIN/Lotus"@crd.lotus.com
     Re: Can you create file on the fly with perl? <wkuhn@uconect.net>
     Re: How to spam - legitimately (Terry Carroll)
     Re: Inline subroutines? (Markus Laker)
     Re: Interview With The Internet's Wise Guys Of Perl - W (Mike Heins)
     Is it possible to alias a builtin function??? <pascal@pascal.org>
     Re: Looking for a script (Tad McClellan)
     Poor man's look-behind <ajohnson@gpu.srv.ualberta.ca>
     Q: perl -P under Win32 <mouse@reksoft.ru>
     Re: redirecting STDERR (Tad McClellan)
     Re: redirecting STDERR <sadd@msc.cornell.edu>
     system( 'dialog', ...) and redirection <fickensc@it.erlm.siemens.de>
     URL - How can I tell from within PERL if a URL is Up <thorsoft@cdsnet.net>
     Re: URL - How can I tell from within PERL if a URL is U (Tad McClellan)
     Re: URL - How can I tell from within PERL if a URL is U (Honza Pazdziora)
     Re: Web download script..???? (Tad McClellan)
     Re: Web download script..???? (Len Wilson)
     Re: What's wrong with this Perl? <tchrist@mox.perl.com>
     Re: Where is FAQ? <stesch@parsec.inka.de>
     Re: Where is FAQ? (Nathan V. Patwardhan)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 02 Mar 1997 21:21:14 -0600
From: rlgolden@ngeorgia.com
Subject: Autostart perl program
Message-Id: <857351423.16174@dejanews.com>

How do I tell a perl program to run at a certain time, even if I am not
online?  Please email an answer.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Sun, 2 Mar 1997 21:54:47 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Autostart perl program
Message-Id: <72idf5.cm2.ln@localhost>

rlgolden@ngeorgia.com wrote:
: How do I tell a perl program to run at a certain time, even if I am not
: online?  

We would need to know what Operating System is installed on
your computer in order to answer this.


: Please email an answer.

Please read the newsgroup.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Sun, 02 Mar 1997 22:53:52 -0500
From: Mark Schwartz <fortune@in.net>
Subject: Beginner Perl/CGI
Message-Id: <331A4B50.37201683@in.net>

This is a multi-part message in MIME format.

--------------43811EA83925D13D354E0392
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

See attachment.

--------------43811EA83925D13D354E0392
Content-Type: text/plain; charset=us-ascii; name="Sent"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Sent"


I am teaching myself CGI and Perl.  My question is based upon Teach
Yourself CGI Programming
With Perl in a Week. [No, I have no delusions that I will learn all of
this in a week.  Yes, I have several other books on Perl :-)]

I have typed in two simple HTML docs and one CGI script from chapters 4
& 5.  The lessons simply show you how to send data to a CGI script and
then have the script (listing 5.6, page 138) create an HTML page on the
fly based upon what choices you chose from the calling HTML doc.

When I submit my data - nothing happens. (?)

I think I have covered most ridiculous beginner mistakes:

The first three lines of the Perl CGI script are as follows:

#!/usr/local/perl -w
push(@INC, "/home/httpd/cgi-bin");
require("cgi-lib.pl");

I obtained cgi-lib.pl off of the CDROM that came with the book.  I made
it executable:
   chmod 777 cgi-lib.pl

and I changed line one in that script to:
   #!/usr/bin/perl

which is where the Perl interpreter is located on my system (Red Hat
Linux 4.0; Perl 5.003).

If I shell out to a BASH prompt and run the script from the command
line, I get:
   Can't find string terminator "END_OF_TEXT" anywhere before EOF at
   /home/httpd/cgi-bin/cgi-lib.pl line 96.

I suspect that running it from the command prompt is useless, as the
script is expecting data to passed to it from my HTML doc, but since
absolutely nothing happens, I was simply looking for some way to find
something to help me pinpoint what I am missing.

The HTML doc in question:

 /root/HTML/hardware.html

is pointing at the CGI script:

 /root/CGI/hard_1.cgi.

Yes, this script is also executable.

Any assisstance would be greatly appreciated.

Thanks.

Mark Schwartz
fortune@in.net

--------------43811EA83925D13D354E0392--



------------------------------

Date: Mon, 03 Mar 1997 08:35:25 GMT
From: "Martin_Khoo/SIN/Lotus"@crd.lotus.com
Subject: Calling PGP from a Perl CGI script
Message-Id: <331a8d12.28431244@door.lotus.com>

Hi,

I am trying to write a web frontend for PGP.

There will be web form for user to select what file is to be encrypted
and which public key to use. The problem i am facing now is that when
pgp is called I get the following error :

Preparing random session key...
We need to generate 192 random bits.  This is done by measuring the
time intervals between your keystrokes.  Please enter some random text
on your keyboard until you hear the beep:
cannot open tty, using stdin

Unable to get terminal characteristics: ioctl: Inappropriate ioctl for
device

PGP is running of a SUN Solaris box.
I called PGP using the following Perl command :

system("/export/home/kbh/pgp263i/pgp -feat $key_val < $concat >
/tmp/exttxt 2>/tmp/blaa");

$key_val is the public key of the recipient
$concat is the filename to be encrypted
/tmp/exttxt is supposed to contain the encrypted text
/tmp/blaa is the redirected STD ERROR so I can see what is wrong

Thanks in advance for any help

Cheers!
Martin Khoo
martin_khoo@lotus.com


------------------------------

Date: Sun, 02 Mar 1997 21:47:36 -0500
From: Bill Kuhn <wkuhn@uconect.net>
Subject: Re: Can you create file on the fly with perl?
Message-Id: <331A3BC8.FB37ADB@uconect.net>

Christopher Masto wrote:
> 
> In article <33135689.FFC67E3@uconect.net>,
> Bill Kuhn  <wkuhn@uconect.net> wrote:
> >You can open it for writing and close it using
> >open(FILE,">$filename") ;
> >close(FILE) ;
> >of use the unix touch command (if you are on unix) using
> >system("touch $filename")
> 
> $filename = "harmless; rm -rf /";
> --
> Christopher Masto  .   .   .   .   NetMonger Communications
> chris@masto.com  .   .   .   .   . Masto Consulting:           info@masto.com

Are you telling me that whatever I pass to system() will be executed, so
I shouldn't pass it anything that I don't want executed?  It will do
exactly what I ask it to?

I've been elightened. :-)

-Bill
-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


------------------------------

Date: Mon, 03 Mar 1997 08:53:35 GMT
From: carroll@tjc.com (Terry Carroll)
Subject: Re: How to spam - legitimately
Message-Id: <331d8d7e.12682069@news2.aimnet.com>

On 24 Feb 1997 20:21:02 GMT, on comp.mail.misc, Tom Christiansen
<tchrist@mox.perl.com> wrote:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, carroll@tjc.com (Terry Carroll) writes:
>:>Why does this sound wrong to my ear?
>:
>:Because you haven't noticed the adaption of the English language?
>
>People are always trying to learn me to talk good.  They claim 
>it's adaption of the English language.  I call it corruption.

The example you're trying to give here is not of the same type.  "An
email" fills a gap in the English language.  It provides a noun for a
concept that otherwise wouldn't have one.

I agree that "People are always trying to learn me to talk good" is mere
corruption -- use of "learn" instead of "teach" and "good" instead of
"well" don't provide any new tools to the language.  That's not the case
with "an email."

BTW, and I've seen this come up a number of times: I'm always amused to
see someone drop the line, as others have in this thread, to the effect
"I've never heard a native speaker of English use 'email' this way."
First, I can only conclude that the person saying that line has a pretty
limited circle of acquaintances.  I've heard and read a number of very
well educated people refer to an electronic message as "an email."  It's
very obvious to most people that well-educated native speakers of English
use the word "email" as a singular noun.  Second, it strikes me as little
more than an attempt to slide in a subtle ad hominem: "you must not be
well-educated -- you sound like a foreigner."  Finally, it strike me as
subtly racist.

The fact is, words frequently expand from their original meanings to take
on wider or even very different meanings.  Witness "decimate" or
"impertinent," for example.

>:"eletter" would be an
>:abomination.
>
>Hmm.. why is that?  

It's just a personal thing, but to me, it strikes me as too "cute".  It
seems forced and a conscious attempt to needlessly parallel another part
of the language.  It also invents a word whose meaning is not necessarily
immediately clear when another word -- "email" -- already exists and can
(and does, as I've pointed out above) carry that meaning well already.

I can see why "eletter" would appear to be "logical" given the same
approach that would object to "an email" -- that presupposed that the
words that will be used to describe electronic communication should be in
lock step with the existing words to describe paper communication.  But
that's not necessarily how language evolves, and we have lots of example
of that.

--
Terry Carroll       | "Al Gore is doing for the federal government what
Santa Clara, CA     | he did for the Macarena.  He's removing all the
carroll@tjc.com     | unnecessary steps."
Modell delenda est  |                - Bill Clinton, September 20, 1996


------------------------------

Date: Mon, 03 Mar 1997 08:50:50 GMT
From: mlaker@contax.co.uk (Markus Laker)
Subject: Re: Inline subroutines?
Message-Id: <5fe3fk$b9v$1@newsserver.dircon.co.uk>

Debbie Whitten <deb@marinbridge.com> wrote:

> On page 539 of the 2nd edition Camel book it talks about inlining
> subroutines for time efficiency. I can't find any information on how to
> do this in the rest of the book. Does anyone have any ideas?

Are you thinking of C++'s ability to inline functions for you?  That
isn't quite what the writers of the Camel had in mind.  In Perl you
have to do the job yourself.

Suppose you have code like this:

  sub double_it
  {	2 * $_[0]	}

  for (1..5)
  {	print double_it($_), "\n"	}

then you would inline the code by removing the function call and
writing out the equivalent code inside the loop, like this:

  for (1..5)
  {	print 2 * $_, "\n"	}

[Mailed and posted.]


Markus Laker



------------------------------

Date: 3 Mar 1997 06:07:30 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Interview With The Internet's Wise Guys Of Perl - Web Week
Message-Id: <5fdpr2$psr@vixen.cso.uiuc.edu>

Dave Thomas (dave@fast.thomases.com) wrote:
: On Sun, 02 Mar 1997 14:09:49 -0800, Devin Ben-Hur <dbenhur@egames.com> wrote:
: 
: > Well, this was the third time I got sucked into trying their
: > web-page in responce to a "spam" posting here and it was the
: > third time I couldn't find any reference to the interesting
: > article title they advertised.
: 
: To be fair, it was there, and when you followed the link there was the
: interview, both in text and RealAudio. 
: 

And to be fair, of the the three posts I have seen from this outfit
all of the articles referenced in the post have been on target. I 
don't mind well-targeted things, even if I have to navigate a bit
to find them.

If I had been seeing pointers to Bill Gates latest introview, I
would perhaps have a problem with this.  But well-targeted
stuff like this is nice to have.  Please keep posting for my
benefit -- I would have never seen this nice interview otherwise.

Direct link, by the way, is:

	http://webreview.com/97/02/28/feature/index.html

-- 
Regards,                                                      ___       ___
Mike Heins                          http://www.iac.net/~mikeh|_ _|____ |_ _|
                                    Internet Robotics         | ||  _ \ | |
This post reflects the              Oxford, OH  45056         | || |_) || | 
opinion of my employer.             <mikeh@iac.net>          |___|  _ <|___|
                                    513.523.7621 FAX 7501        |_| \_\   


------------------------------

Date: Mon, 03 Mar 1997 00:52:01 -0800
From: "Freeman P. Pascal IV" <pascal@pascal.org>
Subject: Is it possible to alias a builtin function???
Message-Id: <331A9131.41C67EA6@pascal.org>

I thought it was legal to alias a builtin function using

  *func = \&builtin;

I'm trying to do something simular to following:

  *panic = \&die;

 ...

  *panic = \&warn
     if ($opt_warn);
 ...

  $fh = new IO::File $file;

  panic ("Failed to open \"$file\"!")
    unless (defined $fh);

But when panic() gets called I get

  Undefined subroutine &main::die called at {file} line {xxx}, <blah>
chunk 1.

The output from 'perl -V' is below.

I found several references to overriding a builtin in the book and in
the online docs, but nothing about calling a builtin from an alias.  I
get the same behavior when I try it from the debugger.

>From the error message above I gather that builtins are not part of
any explict package, this makes sense.  If this is true why does
generating a reference to a builting (using "\*die") return main::die?

How should I do this?

-Freeman


Summary of my perl5 (5.0 patchlevel 3 subversion 91) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos tsunami 5.5.1 generic_103640-03 sun4m sparc
sunw,sparcstation-1
0 '
    hint=previous, useposix=true, d_sigaction=define
    bincompat3=y useperlio= d_sfio=
  Compiler:
    cc='gcc -B/usr/ccs/bin/', optimize='-O', gccversion=2.6.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'

Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Mar  2 1997 09:56:37
  @INC:
    /home/pascal/lib/perl5
    /usr/local/lib/perl5/sun4-solaris/5.00391
    /usr/local/lib/perl5
    /usr/local/lib/perl5/sun4-solaris/5.00391
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/sun4-solaris
    /usr/local/lib/perl5/site_perl
    .

-- 
---------------------------------------------------------------------------
		C O M P U T E   I N T E N S I V E ,   I N C .
---------------------------------------------------------------------------
     Freeman P. Pascal IV	  Phone Work:  (800) 273-5600
     Compute Intensive, Inc.		Home:  (510) 215-5742
     8001 Irvine Center Drive	  Email Work:  pascal@compute.com
     Suite 1130				Home:  pascal@pascal.org
     Irvine, CA 92718		  URL:  Work:  http://www.compute.com
					Home:  http://www.pascal.org
---------------------------------------------------------------------------
   For God so loved the world, that he gave his only begotten Son, that
   whosoever believeth in him should not perish, but have everlasting
   life.		 	- John 3:16 (KJV)


------------------------------

Date: Sun, 2 Mar 1997 21:48:10 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Looking for a script
Message-Id: <qlhdf5.lk2.ln@localhost>

Robert W Hull (rhull@ozbuild.com.au) wrote:
: I am at my wits end....
: I need a script which will log a clickthru to a link and will return a log
                                   ^^^^^^^^^

There is no 'clickthru' construct in the Perl language.


: file
: which can tell me 
: 1.how many clicks 
: 2. to what link
: etc..

: I run a large directory and need to know statistics on clickthru's

: Help!!


It appears you have strayed into the perl newsgroup when you
were looking for some sort of WWW newsgroup or something...


comp.infosystems.www.advocacy
comp.infosystems.www.announce
comp.infosystems.www.authoring.cgi
comp.infosystems.www.authoring.html
comp.infosystems.www.authoring.images
comp.infosystems.www.authoring.misc
comp.infosystems.www.browsers.mac
comp.infosystems.www.browsers.misc
comp.infosystems.www.browsers.ms-windows
comp.infosystems.www.browsers.x
comp.infosystems.www.misc
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
comp.infosystems.www.providers
comp.infosystems.www
comp.infosystems.www.users


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Mon, 03 Mar 1997 02:24:47 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Poor man's look-behind
Message-Id: <331A8ACF.5AEB382D@gpu.srv.ualberta.ca>

Perl's poor-man's look-behind?

While reading Jeffrey Friedl's excellent book on regular
expressions, I encountered the 'commafying' problem on pages
291-292. He presents the FAQ solution, and his own regex
solution, but no simple solution for multiple numbers in a
string which may have decimal values and be preceeded by $
signs or negatives. Look-behind would be helpful, but in
this case a full reversal does nicely as well.

$_=reverse $_;
s<(\d\d\d)(?=\d)(?!\d*\.)><$1,>g;
$_=reverse $_;

Shamefully, in my first version I had a useless use of split 
($_=reverse split //;  don't ask, 'cause I don't know why)
which Jeffrey kindly admitted to being 'stumped' by while
suggesting its removal---it is much more efficient now :)

Having found this reversal technique actually useful on two
more occassions, and not having seen its mention elsewhere,
I thought I'd pass it along.

regards,
andrew


------------------------------

Date: 3 Mar 1997 06:55:38 GMT
From: "Dmitry Shtilerman" <mouse@reksoft.ru>
Subject: Q: perl -P under Win32
Message-Id: <01bc279f$d62714a0$80ac08c2@mouse_pc.reksoft.ru>

Hi!

Can someone explain me what exactly I should do? 

I'm sitting under WIn95 trying to run a perl script with -P option. I use
Perl 5 for Windows NT.

I was managed to figure out that perl tries to run teh C preprocessor with a
command-line like "cpp -C -I..." and put the script text on the stdin of the
preprocessor. Because I'm using Borland C++, the CPP.EXE found in my PATH is
not what is really needed. 

The questions are - what the hell does perl want and how can I overcome this
situation? Should I rebuild PERL.EXE myself after some fixes in its source
code? Should I obtain another perl Win32 port? Should I install something
GNUsy?

Thanks in advance!

-- 
---
Dmitry Shtilerman, REKSoft Ltd.
E-Mail: mouse@reksoft.ru
WWW:    http://www.reksoft.ru/~mouse/
Phone:  +7-(812)-325-2100






------------------------------

Date: Sun, 2 Mar 1997 21:53:35 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: redirecting STDERR
Message-Id: <vvhdf5.cm2.ln@localhost>

Daniel Fox (dfox@pobox.com) wrote:
: Is there a way to do something like


Yes there is a way.


: $var = `/usr/bin/program`;
: but have STDERR and STDOUT put into $var?
           ^^^^^^


The way is you read the perl FAQ (or search for STDERR):

5.15) How can I capture STDERR from an external command?




: Thanks..
  ^^^^^^

No thanks for Asking a Frequent Question.



Remember that autoFAQ thing you got when you first posted here?

Did you read that thing?

In particular, did you read this part:

5. Have you read the Perl FAQ?  Many questions on sockets programming,
   ^^^^^^^^^^^^^^^^^^^^^^^^^^
an important and common problem with Solaris, text manipulation and
the jargon of perl are answered in the FAQ.  As well as being posted
regularly to comp.lang.perl.misc, the FAQ is on the web at:
        http://www.perl.com/CPAN/doc/FAQs/FAQ/html/index.html


We are not here to read the documentation for you...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Sun, 02 Mar 1997 23:39:47 -0500
From: Michael Sadd <sadd@msc.cornell.edu>
To: Daniel Fox <dfox@pobox.com>
Subject: Re: redirecting STDERR
Message-Id: <331A5613.65CB3CA9@msc.cornell.edu>

My understanding is that the command in backticks is always
executed with /bin/sh, so you should be able to do:

$var = `/usr/bin/program 2>&1`
	
	Mike

Daniel Fox wrote:
> 
> Is there a way to do something like
> 
> $var = `/usr/bin/program`;
> 
> but have STDERR and STDOUT put into $var?
> 
> Thanks..
> 
> --
> Daniel Fox
> dfox@pobox.com

-- 
| Michael Sadd                          | Cornell Univerisity        |
| Department of Physics and             | Ithaca, NY 14850           |
| Lab of Atomic and Solid State Physics | www.msc.cornell.edu/~sadd/ |


------------------------------

Date: Mon, 03 Mar 1997 09:41:55 -0800
From: Horst Fickenscher <fickensc@it.erlm.siemens.de>
Subject: system( 'dialog', ...) and redirection
Message-Id: <331B0D63.1712@it.erlm.siemens.de>

exec (and system) can have an array as parameters, and will then not
use a shell (more efficient).

But how can I do redirection of stdout and stderr then?

I have read Perl FAQ 5.15 !

We use Savio Lam's dialog program in many shell scripts. It would
be nice to have perl scripts instead of shell scripts. As a fast
approach I decided to write an interface to dialog which uses
"system", and that's the reason for my question. Note that dialog
uses a lot of parameters and it would be easier and faster not to
pass them as one big string. dialog returns its values on stderr.

By the way, is anybody else interested in using dialog from perl?
I think about rewriting dialog as real perl code using William
Setzer's Curses.

Please mail, I'll summarize if appropriate.
-- 
--Horst--1---------2----no---3---line--4--should-5----be---6--longer-7


------------------------------

Date: Sun, 02 Mar 1997 19:31:12 -0800
From: Rick Thornley <thorsoft@cdsnet.net>
Subject: URL - How can I tell from within PERL if a URL is Up
Message-Id: <331A4600.B14@cdsnet.net>

In my PERL program I have a list of URL's.  I would like to know if
there is a function in PERL that will check if the URL is currently
available.  I would like to put up a message to the user instead of
having the user see a 404 error.

Thanks,
Rick


------------------------------

Date: Sun, 2 Mar 1997 22:03:44 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: URL - How can I tell from within PERL if a URL is Up
Message-Id: <0jidf5.7u2.ln@localhost>

Rick Thornley (thorsoft@cdsnet.net) wrote:
: In my PERL program I have a list of URL's.  I would like to know if
: there is a function in PERL that will check if the URL is currently
: available.  I would like to put up a message to the user instead of
: having the user see a 404 error.


It's not in perl, but if I don't have too many to check, I just
use lynx:


if (system "lynx -source http://www.cdsnet.net >/dev/null") {
   print "avoid 404 now\n"
}
else {
   print "hunky dokey\n";
}


or use the HTTP perl module...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Mon, 3 Mar 1997 08:16:16 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: URL - How can I tell from within PERL if a URL is Up
Message-Id: <adelton.857376976@aisa.fi.muni.cz>

Rick Thornley <thorsoft@cdsnet.net> writes:

> In my PERL program I have a list of URL's.  I would like to know if
> there is a function in PERL that will check if the URL is currently
> available.  I would like to put up a message to the user instead of
> having the user see a 404 error.

You make an request and check the return code, using the LWP library:

use LWP::UserAgent;
# make agent
$ua = new LWP::UserAgent;
# make request
$req = new HTTP::Request 'GET', 'http://www.perl.com/perl/wwwman/libwww/lwpcook.html';
$req->header('Accept' => 'text/html');
# send request
$res = $ua->request($req);
# check the outcome
print "yes\n" if ($res->is_success);
__END__

More info man manpage for LWP.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


------------------------------

Date: Sun, 2 Mar 1997 21:45:15 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Web download script..????
Message-Id: <bghdf5.lk2.ln@localhost>

Sebastien (sebast@hrnet.fr) wrote:

: I just want to know how to make a unix script like cgi to auto download
: a given web page.


lynx -dump http://www.coolsite.com


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Mon, 3 Mar 1997 06:07:59 GMT
From: lbw@netcom.com (Len Wilson)
Subject: Re: Web download script..????
Message-Id: <lbwE6GEDB.B04@netcom.com>

Sebastien (sebast@hrnet.fr) wrote:
: hi!

: I just want to know how to make a unix script like cgi to auto download
: a given web page.

#!/usr/local/bin/perl

use LWP::Simple

$fetchfile = "http://thesite.dom/thepage.html"
$localfile = "/path/temp.html"
$bytes = 0

$bytes = getstore($fetchfile, $localfile)

die "Can't get the page. \n" unless $bytes

etc.

That's from memory but I think it's right. You can get the LWP modules 
from CPAN if you don't already have them.


Len Wilson



------------------------------

Date: 2 Mar 1997 23:35:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: What's wrong with this Perl?
Message-Id: <5fd2s3$57g$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    tim@dierks.org (Tim Dierks) writes:
:$#a = 5;
:foreach $v (@a) {
:    $v = 1;
:}
:
:Emits the error message:
:Modification of a read-only value attempted at test.pl line 3.

Fixed in the next release.  (Tested on 5.003_24, and is fine.)

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "It's okay to be wrong temporarily." --Larry Wall


------------------------------

Date: 2 Mar 1997 18:36:27 GMT
From: Stefan Scholl <stesch@parsec.inka.de>
Subject: Re: Where is FAQ?
Message-Id: <5fchbb$58g@parsec.inka.de>

Nathan V. Patwardhan <nvp@shore.net> wrote:
> Daniel Mills (dmills@riag.com) wrote:
> : I'm new to the group and would like to know how to get to the FAQ

> Try: http://www.perl.com/perl/FAQ

Usenet != Internet

Internet != WWW


------------------------------

Date: 3 Mar 1997 05:10:10 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Where is FAQ?
Message-Id: <5fdmfi$598@fridge-nf0.shore.net>

Stefan Scholl (stesch@parsec.inka.de) wrote:
: Nathan V. Patwardhan <nvp@shore.net> wrote:
: > Daniel Mills (dmills@riag.com) wrote:
: > : I'm new to the group and would like to know how to get to the FAQ

: > Try: http://www.perl.com/perl/FAQ

: Usenet != Internet

Usenet is part of the internet.  The internet preceded www.  I don't
understand your problem with giving out URLs, but thanks for your contribution
in any case!

Very well, then: ftp -> ftp.cdrom.com/pub/perl/CPAN/doc/FAQs/FAQ

--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


------------------------------

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 39
************************************

home help back first fref pref prev next nref lref last post