[13465] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 875 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 22 12:07:23 1999

Date: Wed, 22 Sep 1999 09:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938016316-v9-i875@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 22 Sep 1999     Volume: 9 Number: 875

Today's topics:
    Re: #exec cgi (Dan Wilga)
        ActivePerl on Windows95 HELP (Daniel)
    Re: ActivePerl on Windows95 HELP <gellyfish@gellyfish.com>
    Re: ActivePerl on Windows95 HELP (Kragen Sitaker)
    Re: Ad hominem (was Re: perl related question now!) (Kragen Sitaker)
    Re: Ad hominem (was Re: perl related question now!) <elaine@chaos.wustl.edu>
    Re: Array length <picaza@chsi.com>
    Re: bad bug in your cal(ender) script on perl ppt - 200 <mark@artdigital.co.uk>
    Re: batch (Kragen Sitaker)
    Re: batch <neil@pacifier.com>
        cc: bad bug in your cal(ender) script on perl ppt - 200 <mark@artdigital.co.uk>
        Checking for space <delete.the.nospam.kayec@gov.ns.ca>
    Re: Checking for space <gellyfish@gellyfish.com>
    Re: Checking for space <elaine@chaos.wustl.edu>
    Re: File Upload <@mdo.net>
        GD and ttf-fonts ? <lars.quiring@virtuelles-kaufhaus.de>
    Re: image upload using form (me)
    Re: image upload using form (Kragen Sitaker)
        memory use of children (Bill Moseley)
    Re: memory use of children (Kragen Sitaker)
    Re: mkdir(). What am I doing wrong? <jester@aha.is.dead.com.aka.top.gun>
    Re: mkdir(). What am I doing wrong? <elaine@chaos.wustl.edu>
        Need a simple script blancasd@earthlink.net
    Re: need help for Perl/CGI application <AgitatorsBand@yahoo.com>
        Need help writing non-blocking socket client in PERL on <lbass@dallas.net>
    Re: Need help writing non-blocking socket client in PER (Kragen Sitaker)
        Newbie question <pking@mailpost.k-link.com>
        perl Ad <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
        Perl/CGI and counter questions <this@newsgroup.com>
    Re: Perl/CGI and counter questions (Kragen Sitaker)
    Re: Perl/CGI and counter questions (Bill Moseley)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 22 Sep 1999 10:47:12 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: #exec cgi
Message-Id: <dwilgaREMOVE-2209991047130001@wilga.mtholyoke.edu>

In article <rC2F3.4067$yU2.8061@nntpserver.swip.net>, "Magnus Hult"
<hult.holmstrom@swipnet.se> wrote:

> Hello,
> 
> First of all, I know this is way off-topic, but I really need to get this to
> work (and quite soon too).
> 
> I'm trying to include a cgi program from an shtml page. My problem is, I
> need to send a query string too. But

Do your scripts work without the "?query" data?

If not, then it's likely that your server isn't configured to allow you to
execute CGI scripts, either in that particular directory, in any
directory, or using SSI specifically. This is not a Perl question and
really doesn't belong here.

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: 22 Sep 1999 16:11:08 +0100
From: Daniel@geneva (Daniel)
Subject: ActivePerl on Windows95 HELP
Message-Id: <37e8e37c@news.unige.ch>

Hello,

I just now installed ActivePerl build 519 on my Windows95 Computer. I 
wrote this file "readarticlecgi.pl":

*************************************************

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML>\n<BODY BGCOLOR=\"#FFFFFF\">\n\n";

open(ARTICLE1,"article1.txt");
while (<ARTICLE1>)
{
   print;
}
close (ARTICLE1);
print "</BODY>\n";
print "</HTML>";

*************************************************

With my Netscape Browser I loaded it with File/Open Page (Ctrl+O) and I 
just see an MS-DOS window, which shows quickly my "article1.txt" !

What is wrong ? I thought see my file (article1.txt) in my Netscape 
Browser.

Thank you for any help

My e-mail is Daniel.LaMarra.at.unige.ch
(replace .at. by @, this is to avoid spam)

Regards Daniel.



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

Date: 22 Sep 1999 16:19:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ActivePerl on Windows95 HELP
Message-Id: <37e8f387_1@newsread3.dircon.co.uk>

Daniel <Daniel@geneva> wrote:
> Hello,
> 
> I just now installed ActivePerl build 519 on my Windows95 Computer. I 
> wrote this file "readarticlecgi.pl":
> 
> *************************************************
> 
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> print "<HTML>\n<BODY BGCOLOR=\"#FFFFFF\">\n\n";
> 
> open(ARTICLE1,"article1.txt");

Always, check whether or not the open has succeeded before using the
filehandle ...

> while (<ARTICLE1>)
> {
>    print;
> }
> close (ARTICLE1);
> print "</BODY>\n";
> print "</HTML>";
> 
> *************************************************
> 
> With my Netscape Browser I loaded it with File/Open Page (Ctrl+O) and I 
> just see an MS-DOS window, which shows quickly my "article1.txt" !
> 
> What is wrong ? I thought see my file (article1.txt) in my Netscape 
> Browser.
> 

CGI needs a server.  You will need to ask in the appropriate group.

[Followups set]

/J\
-- 
"It's easier for a man to enter a camel is he stands on a box" -
Jonathan Creek


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

Date: Wed, 22 Sep 1999 15:22:18 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: ActivePerl on Windows95 HELP
Message-Id: <Ku6G3.3267$QJ.188402@typ11.nn.bcandid.com>

In article <37e8e37c@news.unige.ch>, Daniel <Daniel@geneva> wrote:
>With my Netscape Browser I loaded it with File/Open Page (Ctrl+O) and I 
>just see an MS-DOS window, which shows quickly my "article1.txt" !
>
>What is wrong ?

Dunno.  Why don't you try -w and use strict?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 22 Sep 1999 13:15:07 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Ad hominem (was Re: perl related question now!)
Message-Id: <vD4G3.3162$QJ.175148@typ11.nn.bcandid.com>

In article <7sa7gg$tqa$1@lublin.zrz.tu-berlin.de>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>Elaine -HFB- Ashton  <elaine@chaos.wustl.edu> wrote in comp.lang.perl.misc:
>>Kragen Sitaker wrote:
>
>>	FE
>>    /   \

No I didn't.  HappyFunBall did.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 22 Sep 1999 10:41:18 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Ad hominem (was Re: perl related question now!)
Message-Id: <37E8EA06.AA9C387@chaos.wustl.edu>

Anno Siegel wrote:
> 
> Hemogoblin?

:) COfFEe Ring. Hemoglobin, while it does have Fe, is far more complex
than my poor ASCII art skill would allow.

e.


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

Date: Wed, 22 Sep 1999 09:24:06 -0400
From: "Peter Icaza" <picaza@chsi.com>
Subject: Re: Array length
Message-Id: <7sal8n$3eu0$1@pike.uhc.com>


another useful one is
$#array
its the index number of the last element in the array, it may save you some
math.  see chapter 3 llama.
peter




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

Date: Wed, 22 Sep 1999 16:44:41 +0100
From: "Mark Hamlin" <mark@artdigital.co.uk>
Subject: Re: bad bug in your cal(ender) script on perl ppt - 2004
Message-Id: <7satht$mqg$1@pheidippides.axion.bt.co.uk>

I've got some sort of environment problem but what.  Solaris system based in
UK could be using BST rather than GMT.  Linux server is big 'change root
virtual server system' based in America - AIT.

Its not a show stopper for me now, just a worry for the future.

Mark

Mark Hamlin <mark@artdigital.co.uk> wrote in message
news:7saqa9$lhi$1@pheidippides.axion.bt.co.uk...
> http://language.perl.com/ppt/src/cal/cal.hudson.html
>
> I'm pretty sure of this, I can't see how I could be mistaken - but thats
> usually the case.  Being a tester by profession, and because I was about
to
> spend several days developing an app using your script as the basis, I
> thought I'd run a few simple tests.  Turned out to be a good move, didn't
> take long to find a problem - '2004'.   Running on a Sun Solaris server
your
> 1st October 2004 is a Thursday where according to Cal running on the same
> system and others it should be a Friday.
>
> Oh dear.. I hope you decide to fix it, have fun if you do.  Your script
was
> the 'cutest' of the four alternatives available by some margin, but then I
> guess the above could be the result.  If you fix it in the next few hours
> let me know - I'll have started on one of the others by then.
>
> Cheers,
> Mark
>
>




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

Date: Wed, 22 Sep 1999 13:09:04 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: batch
Message-Id: <Qx4G3.3156$QJ.174008@typ11.nn.bcandid.com>

In article <EO3G3.42$OH6.607@news1.online.no>,
Rasmus Rimestad <rasmusr@online.no> wrote:
>Hi. I've written a perl-script that needs to be executed the first day of
>each month. I've made a function that loops and finds out which date it is,
>but I can't figure out how to start the script.

You could run it in the background all the time, perhaps starting it at
boot time.  How you do this is system-dependent.

Or you could run it from cron or some equivalent.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 22 Sep 1999 07:01:39 PST
From: Neil <neil@pacifier.com>
Subject: Re: batch
Message-Id: <37e8e143.0@news.pacifier.com>

Rasmus Rimestad <rasmusr@online.no> wrote:
> Hi. I've written a perl-script that needs to be executed the first day of
> each month. I've made a function that loops and finds out which date it is,
> but I can't figure out how to start the script.

This sounds like a Catch22: the function that finds out what day it is so the
program to run can't run until the program runs but the program can't run until
the function in it finds out what day it is.

This sounds like a job for the Cron daemon (in UNIX) -- or an equivalent 
scheduling program for the OS you are using.

Neil


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

Date: Wed, 22 Sep 1999 15:49:27 +0100
From: "Mark Hamlin" <mark@artdigital.co.uk>
Subject: cc: bad bug in your cal(ender) script on perl ppt - 2004
Message-Id: <7saqa9$lhi$1@pheidippides.axion.bt.co.uk>

http://language.perl.com/ppt/src/cal/cal.hudson.html

I'm pretty sure of this, I can't see how I could be mistaken - but thats
usually the case.  Being a tester by profession, and because I was about to
spend several days developing an app using your script as the basis, I
thought I'd run a few simple tests.  Turned out to be a good move, didn't
take long to find a problem - '2004'.   Running on a Sun Solaris server your
1st October 2004 is a Thursday where according to Cal running on the same
system and others it should be a Friday.

Oh dear.. I hope you decide to fix it, have fun if you do.  Your script was
the 'cutest' of the four alternatives available by some margin, but then I
guess the above could be the result.  If you fix it in the next few hours
let me know - I'll have started on one of the others by then.

Cheers,
Mark




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

Date: Wed, 22 Sep 1999 14:30:27 GMT
From: "kayec" <delete.the.nospam.kayec@gov.ns.ca>
Subject: Checking for space
Message-Id: <7K5G3.64$Oa2.2038@sapphire.mtt.net>

I know there are functions for reading directories, coping files... and
other o/s type functions but what would be the best way to check the
available drive space??

Thanks.......




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

Date: 22 Sep 1999 16:15:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Checking for space
Message-Id: <37e8f286_1@newsread3.dircon.co.uk>

kayec <delete.the.nospam.kayec@gov.ns.ca> wrote:
> I know there are functions for reading directories, coping files... and
> other o/s type functions but what would be the best way to check the
> available drive space??
> 

man df

/J\
-- 
"He is marvelous at beating men and achieving real penetration" -
Alex Ferguson


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

Date: Wed, 22 Sep 1999 11:21:28 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Checking for space
Message-Id: <37E8F36E.3D6A6B4C@chaos.wustl.edu>

kayec wrote:
> I know there are functions for reading directories, coping files... and
> other o/s type functions but what would be the best way to check the
> available drive space??

http://search.cpan.org/search?dist=Filesys-DiskSpace  is a module for
doing just that. Also, you might have a look at mon
http://www.kernel.org/software/mon/ which is a really cool system
monitoring tool which you can customise with Perl. :)

e.


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

Date: Wed, 22 Sep 1999 09:56:38 -0400
From: "CS" <@mdo.net>
Subject: Re: File Upload
Message-Id: <%b5G3.3200$QJ.178843@typ11.nn.bcandid.com>

If you are still having problems, it might be in your permissions.

If you are using Linux/Unix, make sure your directory permissions are set to
777

        chmod 777 .

Notice the dot on the end, that's for the directory you are currently in,
and want to receive the files.  Otherwise, if you want to be more secure
(and who wouldn't to be), you keep a few target files that are chmoded at
666 and have your script upload files only there.




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

Date: Wed, 22 Sep 1999 17:06:41 +0100
From: Lars Quiring <lars.quiring@virtuelles-kaufhaus.de>
Subject: GD and ttf-fonts ?
Message-Id: <37E8FE91.6E18C6A@virtuelles-kaufhaus.de>

Hallo !

I've installed the GD-module with the activestate's ppm module on a
windows-NT-machine.

Nearly everything works fine, but the reason for which I installed the
module is to be able to print text into an image.
For their limitations I can't use the preinstalled fonts but have to use
the ttf-fonts.
The problem is that using the method stringTTF has no effect.

That means perhaps that ligbd hasn't been compiled with support for
dynamic fonts.
How can I resolve this problem ?

Could anyone out there who know the solution, please kindly enlighten
me,

thank you

Lars.



--
www.virtuelles-kaufhaus.de
frank basten & lars quiring gbr
gohliser straße 19   04155 leipzig   deutschland
fon +49 341 5905509   fax +49 341 5905508
email vk@virtuelles-kaufhaus.de




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

Date: Tue, 21 Sep 1999 11:54:49 GMT
From: jmontany@clarityconnect.com (me)
Subject: Re: image upload using form
Message-Id: <37e76db8.1554408@news1.clarityconnect.com>

The program resides on an Internet Hosting company's server.
It's either Unix or Linux. I don't know much about the binmode. The
program's purpose is to let the site owner send new images to an
online catalog through an administration page. I am building a simple
interface for someone who is not computer savvy. I have the interface
and catalog working up to the point of sending the images. Right now,
the images have to be sent using an FTP program. I want to add this
send file program to my interface so the owner doesn't have to learn
how to use an FTP program. I'm trying to cut out as many steps as
possible so I don't have a lot of "how do I do it again" phone calls.

While I'm on the subject, what about a program that will send the
contents of a directory to an html page where you have the option to
delete any file. I will have to add this to the interface too, so old
images can be deleted. Most Perl books I see don't get this advanced.
Does anybody know a good title? Thanks for all the help.


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

Date: Wed, 22 Sep 1999 15:12:34 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: image upload using form
Message-Id: <Cl6G3.3261$QJ.187664@typ11.nn.bcandid.com>

In article <37e76db8.1554408@news1.clarityconnect.com>,
me <jmontany@clarityconnect.com> wrote:
>The program resides on an Internet Hosting company's server.
>It's either Unix or Linux. I don't know much about the binmode.

If it's Unix (or Linux), you don't have to worry about it.

It must be a bug in the program.

What, exactly, is wrong with the uploaded images?

>While I'm on the subject, what about a program that will send the
>contents of a directory to an html page where you have the option to
>delete any file. I will have to add this to the interface too, so old
>images can be deleted. Most Perl books I see don't get this advanced.
>Does anybody know a good title? Thanks for all the help.

It should be fairly simple to do this with unlink().  That's not
particularly advanced.

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 22 Sep 1999 08:10:55 -0700
From: moseley@best.com (Bill Moseley)
Subject: memory use of children
Message-Id: <MPG.1252915d3fb5d199989769@nntp1.ba.best.com>

This is only slightly a perl question...

I've got a 'large-ish' perl program that spawns about five child 
processes, then exits leaving the children to do their job.

Since a VAST majority of the code in the main program is not needed by 
the children, does it make a much of a difference from a system 
resources point of view to fork and exec a smaller program that spawns 
the children to do the work?  And how does one decide when it makes 
sense to do it one way or another?

Or should I let the system admin worry about such things ;)

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Wed, 22 Sep 1999 15:25:02 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: memory use of children
Message-Id: <ix6G3.3270$QJ.188728@typ11.nn.bcandid.com>

In article <MPG.1252915d3fb5d199989769@nntp1.ba.best.com>,
Bill Moseley <moseley@best.com> wrote:
>I've got a 'large-ish' perl program that spawns about five child 
>processes, then exits leaving the children to do their job.
>
>Since a VAST majority of the code in the main program is not needed by 
>the children, does it make a much of a difference from a system 
>resources point of view to fork and exec a smaller program that spawns 
>the children to do the work?

Probably depends on the situation.  Unused pages will get swapped out
on a system running out of memory if it has free swap space, and never
get swapped back in.  Copy-on-write pages will remain shared in the
fork case, but probably not in the exec case.

> And how does one decide when it makes 
>sense to do it one way or another?

Test both ways.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Thu, 23 Sep 1999 00:54:49 +0930
From: "jester" <jester@aha.is.dead.com.aka.top.gun>
Subject: Re: mkdir(). What am I doing wrong?
Message-Id: <gF5G3.23110$ei1.43054@newsfeeds.bigpond.com>

I would listen to what this guy says, he tends to know what he's talking
about when it comes to Perl. Especially since most people who have anything
to do with Perl would have read something he's written at one time or
another.

If it wasn't for Jerry Springer, I think Randal would have to be my No#1
hero, LOL :-)




Randal L. Schwartz wrote in message ...
>>>>>> "Philip" == Philip 'Yes, that's my address' Newton
<nospam.newton@gmx.net> writes:
>
>Philip> As an octal number, yes. chmod numbers are usually given in octal.
The
>Philip> chmod(1) command assumes you're supplying them in octal. Perl
assumes
>Philip> you're supplying them in decimal, so you have to convert them
yourself
>Philip> (either write it as an octal constant, or -- if you're into useless
>Philip> work -- change the permission number to base 10 and use a decimal
>Philip> constant).
>
>Uh, technically *no*.  the chmod() operator in Perl doesn't presume
>you're supplying them in "decimal".  It presumes you are supplying a
>number, in whatever number base is convenient for you, or the result
>of a calculation.
>
>It *must* do that, or else this wouldn't work:
>
> $read = 4;
> $write = 2;
> $execute = 1;
> $user = $read + $write + $execute;
> $group = $other = $read + $execute;
> $permission = ($user << 6) + ($group << 3) + $other;
> mkdir ("FOO", $permission);
>
>So, no, I wouldn't say it presumes decimal.  It presumes *number*,
>from a literal of your choice, or a calculation.
>
>print "Just another Perl hacker,"
>
>--
>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
><merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
>Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
>See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!




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

Date: Wed, 22 Sep 1999 11:33:10 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: mkdir(). What am I doing wrong?
Message-Id: <37E8F62B.59BBD176@chaos.wustl.edu>

jester wrote:
> If it wasn't for Jerry Springer, I think Randal would have to be my No#1
> hero, LOL :-)

Honey, you need to get out a little more often, TV is bad for you;)

> Randal L. Schwartz wrote in message ...
> >Uh, technically *no*.  the chmod() operator in Perl doesn't presume
> >you're supplying them in "decimal".  It presumes you are supplying a
> >number, in whatever number base is convenient for you, or the result
> >of a calculation.

True, but it probably is best to supply an octal, that looks like
waaaayyy too much work :) Also, umask is important.

The person may also wish to have a look at
http://search.cpan.org/search?dist=File-chmod which adds symbolic modes
to chmod. 

e.

 . o O ( hmmm...Randal and Jerry? Separated at birth?....:D )


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

Date: Wed, 22 Sep 1999 14:22:56 GMT
From: blancasd@earthlink.net
Subject: Need a simple script
Message-Id: <7saonh$a7e$1@nnrp1.deja.com>

Looking for some help. Want to get a a hold of a free cgi script that
will work with Front Page 98 and will send the results of
a small web form to four or five e-mail recipients "alternately".




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 22 Sep 1999 15:55:18 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: need help for Perl/CGI application
Message-Id: <GZ6G3.46$jj.7631@news.shore.net>

Federico <artax@shineline.it> wrote:
:     First of all sorry for my terrible English! ^_^ I have read the
: Herrmann's book "Teach yourself CGI PROGRAMMING with PERL 5 in a week", but

That's very unfortunate. One of the worst programming books I've ever had
the misfortune to use.

: I think I haven't found what I need to know.

Not surprising. O'Reilly's CGI book might help you out with CGI in general
(although it's a little out of date in some ways), but your question is
more complicated than that anyway (see below).

: In other words, this application has to simulate, in a simpler way, what a
: broswer do when it interacts whit a host HTML server sending a form and
: receiving the answer. I don't know which Perl functions I must use and how.
: I've thought, for example for the POST method, to open a file in this way:

:     open(filename, '>>POST
: http://www.sitename.com/subdirectory/program_cgi.cgi HTTP/1.1')

This doesn't work. "open" is not designed to open files on the WWW. You
should look at the LWP set of modules, which will do what you want.

Actually, though, if you simply want to retrieve a web page and store its
content in a variable, you should look into using "lynx -dump" from the
shell. You can, of course, capture its output using backticks (``).
Depending on your needs, that may be sufficient (you could pass input to
a script via the GET method by just appending it to your URL).

Good luck!

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Wed, 22 Sep 1999 09:08:11 -0500
From: "Lloyd Bass" <lbass@dallas.net>
Subject: Need help writing non-blocking socket client in PERL on Windows
Message-Id: <ruhoodtnlg738@corp.supernews.com>

I am new to PERL and need some help with creating a non-blocking socket
client.  I am working with
the latest version of PERL for Windows from Activestate (downloaded last
Friday, 09/17/99).  I have
been trying to create a simple client that receive messages in non-blocking
mode (ie if there is no
message continue on with the next statement.)  I wrote the code below for
the client and have listed
below that the code for the socket server that I found in a book.  I can
send messages to the socket
server and receive the echoed message back just fine.  But if I look for
more messages than there
are the program halts on the call to recv() function (ie if there are 41
messages to receive, I get hung
up on the 42nd call to the recv() function).  I do not have a C, C++, nor
Unix background; and I am having
problems finding any documentation in PERL that explains how to do
non-blocking calls in Windows.  I need
to use PERL because that is the choice by my client.  Any help would be
greatly appreciated.

##  Begin Socket client Code
##
# Create a socket to listen on.
#
my $sock =
   IO::Socket::INET->new( PeerAddr => "IIS", PeerPort => 8008, Proto =>
'tcp',
           Type=> SOCK_STREAM, Timeout => 15);

die "Client failed to connect" unless $sock ;

print "Connecting to port 8008\n";

print "beginnig while loop\n";
for($num = 0; $num <35; $num++) {

    $msg = "message " . $num . "\n";
    print $msg;
    $sendmsg = send( $sock, $msg, 0);

    }


for($num = 0; $num <40; $num++) {

    $recmsg = recv($sock, $recmesg, 30, 0);

    print "$num received message was " . $recmesg;
    }

print "The Next Step happens here";

exit;

##  End Socket Server Code
##



##  Begin Socket Server Code
##

use IO::Socket;
use IO::Select;

# Create a socket to listen on.
#
my $listener =
   IO::Socket::INET->new( LocalPort => 8008, Listen => 5, Reuse => 1 );

die "Can't create socket for listening: $!" unless $listener;
print "Listening for connections on port 8008\n";

my $readable = IO::Select->new;     # Create a new IO::Select object
$readable->add($listener);          # Add the listener to it

while(1) {

    # Get a list of sockets that are ready to talk to us.
    #
    my ($ready) = IO::Select->select($readable, undef, undef, undef);
     foreach my $s (@$ready) {

     # Is it a new connection?
     #
     if($s == $listener) {
     print "If statement \n";
     # Accept the connection and add it to our readable list.
     #
     my $new_sock = $listener->accept;
     $readable->add($new_sock) if $new_sock;

    print $new_sock "Welcome!\r\n";

            } else {  # It's an established connection

                my $buf = <$s>;   # Try to read a line
      print $buf;
                # Was there anyone on the other end?
                #
                if( defined $buf ) {

                    # If they said goodbye, close the socket. If not,
                    # echo what they said to us.
                    #
                    if ($buf =~ /goodbye/i) {
                        print $s "See you later!\n";
                        $readable->remove($s);
                        $s->close;
                    } else {
                        print $s "You said: $buf\n";
                    }

                } else { # The client disconnected.

                    $readable->remove($s);
                    $s->close;
                    print STDERR "Client Connection closed\n";

                }
            }
        }
    }


##  End Socket Server Code
##

--
Lloyd Bass

lbass@dallas.net





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

Date: Wed, 22 Sep 1999 15:17:50 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Need help writing non-blocking socket client in PERL on Windows
Message-Id: <yq6G3.3265$QJ.187965@typ11.nn.bcandid.com>

In article <ruhoodtnlg738@corp.supernews.com>,
Lloyd Bass <lbass@dallas.net> wrote:
>I have
>been trying to create a simple client that receive messages in non-blocking
>mode (ie if there is no
>message continue on with the next statement.)  I wrote the code below 

The reason it's not non-blocking is that recv (and send, for that
matter) is blocking by default, and you didn't do anything to make it
nonblocking.  You can use select() as documented in perldoc perlipc,
and I believe you can also do the same thing as in C: use FIONBIO --
although I don't want to research that right now.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 22 Sep 1999 11:42:30 -0400
From: "Perry King" <pking@mailpost.k-link.com>
Subject: Newbie question
Message-Id: <37e8f76f.0@news.kivex.com>

Hi all,
I am completely new to Perl.  I am looking for an easy way to connect to a
web server using an HTTP GET or POST and capture the results coming back for
subsequent text processing.

I'm sure this must be a pretty common thing, and is somewhere on CPAN, but
I've spent a couple of hours poking around including looking at some FAQs
and nothing stands out.  Everthing I've seen seems to be directed at
writting PERL cgi scripts where as I want to basically simulate what a web
browser would do.

Can anyone point me more narrowly to the right place in the archives or
FAQs?

Thanks,

-- Perry King




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

Date: Wed, 22 Sep 1999 00:03:01
From: "One Bored Guru        " <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
Subject: perl Ad
Message-Id: <000000b5@madnet.net>

Attention Perl-5/Linux Programmers.

The Sync3 Developement Team is looking for Perl-5/Linux programmers
to help on an open source project writing a new type of bbs designed
for Linux and The Internet.  If you think you have the skill and are
interested, please send email to devteam[at]sync3.com indicating your
interest and providing us with the relevant details pertaining to
your skill level and previous experience.  Thank you for your time
and interest.

     Steve Byers,
     Project Administrator,
     The Sync3 Project.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        + The Talamasca Internet Newsgroup Gateway +
               telnet://talamasca-bbs.com


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

Date: Wed, 22 Sep 1999 09:53:28 -0400
From: Frodo <this@newsgroup.com>
Subject: Perl/CGI and counter questions
Message-Id: <w97oN6Oeb9FEDyHw61NkZAU+uyIL@4ax.com>

All I want is:

1) A graphical counter
2) That can be called from an HTML document.

I have found several examples that require the source document to have
either an ".shtm" or an ".asp" extension.

My host is 9NetAve, and they supposedly have server-side includes.  I
am hosted on an NT box.  Any help that you could provide would be
deeply appreciated.  Thank you.


---------------------------------
Please respond to this newsgroup.
Return e-mail is spam-proof.




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

Date: Wed, 22 Sep 1999 14:07:45 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl/CGI and counter questions
Message-Id: <Ro5G3.3209$QJ.180590@typ11.nn.bcandid.com>

In article <w97oN6Oeb9FEDyHw61NkZAU+uyIL@4ax.com>,
Frodo  <littledude@wizards.org> wrote:
>1) A graphical counter
>2) That can be called from an HTML document.
>
>I have found several examples that require the source document to have
>either an ".shtm" or an ".asp" extension.
>
>My host is 9NetAve, and they supposedly have server-side includes.  I
>am hosted on an NT box.  Any help that you could provide would be
>deeply appreciated.  Thank you.

This is a Perl newsgroup, not a CGI or web newsgroup.  If you have CGI
or web questions that aren't Perl questions, go ask them in a CGI or
web newsgroup.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 22 Sep 1999 07:16:05 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Perl/CGI and counter questions
Message-Id: <MPG.12528484bc7bd18c989768@nntp1.ba.best.com>

Frodo (this@newsgroup.com) seems to say...
> All I want is:
> 
> 1) A graphical counter
> 2) That can be called from an HTML document.
> Return e-mail is spam-proof.

Oh, ouch. this is going to be ugly...

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 875
*************************************


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