[19733] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1928 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 14 18:05:38 2001

Date: Sun, 14 Oct 2001 15:05:08 -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: <1003097108-v10-i1928@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 14 Oct 2001     Volume: 10 Number: 1928

Today's topics:
    Re: Access a hash key by hash value ? <bootsy52@gmx.net>
        Bidirectional Client can't get Serverconnection under W (Michael Herzog)
    Re: Bidirectional Client can't get Serverconnection und (Garry Williams)
    Re: Code protection (Miko O'Sullivan)
    Re: Creating a cgi generated form <bart.lateur@skynet.be>
    Re: Difference between .pl, .cgi, and .pm File Extensio (Damian James)
        filehandle : localized typeglob - local $_ <pilsl_@goldfisch.at>
    Re: filehandle : localized typeglob - local $_ (Garry Williams)
    Re: HTML output using perl... (remove the obvious)
    Re: newbie question - how to rename files with Perl? <pne-news-20011014@newton.digitalspace.net>
    Re: newbie question - how to rename files with Perl? <pne-news-20011014@newton.digitalspace.net>
        Newbie Question on Writing\Printing to a File <gclark@wavetel.com>
    Re: Setting cookies <greyangel@lanset.com>
    Re: Setting cookies <matthew.garrish@sympatico.ca>
    Re: Setting cookies (Randal L. Schwartz)
    Re: Setting cookies <jeff@vpservices.com>
    Re: Setting cookies <jimbo@soundimages.co.uk>
    Re: Setting cookies <dha@panix.com>
    Re: Specifying a range of values <pne-news-20011014@newton.digitalspace.net>
    Re: Specifying a range of values <junk@mytechsolutions.com>
        startform(get,"www..../file.pl"); how can I use startfo <mario.lat@libero.it>
    Re: startform(get,"www..../file.pl"); how can I use sta <jimbo@soundimages.co.uk>
    Re: Stop Transversal of a Directory with Tar and Unzip <whataman@home.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 14 Oct 2001 20:33:11 +0200
From: "Carsten Menke" <bootsy52@gmx.net>
Subject: Re: Access a hash key by hash value ?
Message-Id: <pan.2001.10.14.20.33.08.535.2432@gmx.net>

On Sun, 14 Oct 2001 18:55:40 +0200, Garry Williams wrote:

> On Sun, 14 Oct 2001 17:46:24 +0200, Carsten Menke <bootsy52@gmx.net>
> wrote: 
> No, it's not.  That print statement printed a list including $result{$_}
> *and* $_.  The output seems to be only one value -- the IP addresses.
> 
Yes it was, because I cutted the output, so that it will not mess up the
whole posting. The original output is this:

192.168.200.1 2001-08-23 16:46:58 http://www.t-d1.de/td1/img/m2/frau2_sms_2.jpg 1.0 image/jpeg
192.168.100.10 2001-08-23 16:46:52 http://www.t-d1.de/td1/gfx/td1_logo.swf 1.0 application/x-shockwave-flash
192.168.0.52 2001-08-23 16:47:08 http://www.t-d1.de/td1/styles/styles.css (4710 bytes)
192.168.0.52 2001-08-23 16:47:46 http://www.t-d1.de/td1/styles/styles.css 1.0 text/css
192.168.0.52 2001-08-23 16:47:47 http://www.t-d1.de/td1/gfx/blank.gif 1.0 image/gif
192.168.0.52 2001-08-23 16:46:54 http://www.t-d1.de/td1/gfx/quad_mag.gif (55 bytes)
192.168.0.52 2001-08-23 16:47:09 http://www.t-d1.de/td1/styles/styles.css 1.0 text/css
192.168.0.52 2001-08-23 16:47:44 http://www.t-d1.de/index/1,2003,26-_,00.html
192.168.0.52 2001-08-23 16:47:11 http://www.t-d1.de/td1/img/bildleiste/zierleiste%5Funten%5Fprivatkunden%2Egif 1.0 image/gif
192.168.0.52 2001-08-23 16:47:05 http://www.t-d1.de/sms/1,2003,1147-_,00.html
192.168.0.52 2001-08-23 16:47:10 http://www.t-d1.de/td1/gfx/td1_logo.swf 1.0 application/x-shockwave-flash
192.168.0.52 2001-08-23 16:47:45 http://www.t-d1.de/td1/styles/styles.css (4710 bytes)
192.168.0.52 2001-08-23 16:46:55 http://www.t-d1.de/td1/img/bildleiste/zierleiste%5Funten%5Fprivatkunden%2Egif 1.0 image/gif
192.168.100.2 2001-08-23 16:46:54 http://www.t-d1.de/td1/img/m2/mann3_headset_3.jpg 1.0 image/jpeg
192.168.1.52 2001-08-23 16:46:52 http://www.t-d1.de/cgi-bin/ivw/CP/sms/1,2003,1132-_,00.html 1.0 image/gif
192.168.1.100 2001-08-23 16:46:55 http://www.t-d1.de/td1/gfx/quad_mag.gif 1.0 image/gif
192.168.100.1 2001-08-23 16:46:52 http://www.t-d1.de/td1/gfx/quad_grau_shop.gif 1.0 image/gif

So cutted the right part of it ($_) which is 2001-08-23....image/gif
until the end of the line. $result{$_} represents 192.168.0.52 for
example. So I wanted not to confuse by sending the whole bunch.

Sorry for that, I'll behave better the next time :-)
> 
> Okay, in the interest of saving an innocent passerby from serious
> injury, you should look at what your comparison code does when comparing
> 192.168.0.52 and 192.168.100.2 .  Your code calls the former greater
> than the latter because 52 is greater than 2.
> 
> If you insist on comparing the four parts of an IP address one part at a
> time, you must check each part *completely* before going on to check the
> next part.  0 isn't greater than 100, but it *is* less than 100.
> 

Ahhh, yes I see my error, I see I see. Everytime when this happens I
swear myself not to program at night. Really annoying such errors but
they occur everytime, hence everytime less, but they occur and you sit
there scratching your head not seeing what's wrong.

Thanx Gary

The Script is working great now, really great.


Regards

Carsten


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

Date: 14 Oct 2001 13:25:34 -0700
From: m.herzog@hrsoftware.de (Michael Herzog)
Subject: Bidirectional Client can't get Serverconnection under Win32
Message-Id: <b87fff5c.0110141225.4381a980@posting.google.com>

Hi there,
I have a Clientscript and Serverscript. I have seen it in an Artical
at this Newsgroup. I have tried this at home on a Win32 mashine, but
it seems it doesn't work on Win32. Does anybody know, how this script
works on Win32?
================Client Script===============
#!/usr/bin/perl -w
# biclient - bidirectional forking client from perl Cookbook
use strict;
use IO::Socket;
my($port, $host, $handle, $line, $kidpid);

$port = "1999";
$host = "localhost";

# create a tcp connection to the specified host and port
$handle = IO::Socket::INET->new(Proto     => "tcp",
                                PeerAddr  => $host,
                                PeerPort  => $port)
       or die "can't connect to port $port on $host: $!";

$handle->autoflush(1);              # so output gets there right away
print STDERR "[Connected to $host:$port]\n";

# split the program into two processes, identical twins
die "can't fork: $!" unless defined($kidpid = fork());

if ($kidpid) {
# parent copies the socket to standard output
  while (defined ($line = <$handle>)) {
        print STDOUT $line;
  } # kill("TERM" => $kidpid);        # send SIGTERM to child
}
else {

  # child copies standard input to the socket
    while (defined ($line = <STDIN>)) {
        print $handle $line;
 }
}

exit;
=============Client END=========
and
=============Serverscript=======
#!/usr/bin/perl

use IO::Socket;

$local = IO::Socket::INET->new(Proto=>"tcp", LocalPort=>"1999",
Listen=>1)
or die "Cannot create server socket: $!\n";

$remote = $local->accept;
$remote->autoflush(1);

while (<$remote>) {
$incoming = $_;
#send acknowledgement to client
print $remote "received by server:$incoming";
}

close $local, $remote;
=========Server END=======

I started the Scripts from the Commandline with no arguments!

THNX
Michael Herzog


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

Date: Sun, 14 Oct 2001 21:52:39 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Bidirectional Client can't get Serverconnection under Win32
Message-Id: <slrn9sk297.ine.garry@zfw.zvolve.net>

On 14 Oct 2001 13:25:34 -0700, Michael Herzog <m.herzog@hrsoftware.de> wrote:
> Hi there,
> I have a Clientscript and Serverscript. I have seen it in an Artical
> at this Newsgroup. I have tried this at home on a Win32 mashine, but
> it seems it doesn't work on Win32. 
           ^^^^^^^^^^^^^^^

That's kind of silly, don't you think?  

What kind of help or advice do you expect from that problem
description.  

I found no obvious problem with the code you posted.  

-- 
Garry Williams


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

Date: 14 Oct 2001 12:54:51 -0700
From: miko@idocs.com (Miko O'Sullivan)
Subject: Re: Code protection
Message-Id: <db27ea77.0110141154.1a5749b@posting.google.com>

Ilya Martynov <ilya@martynov.org> wrote in message news:<87g08ojx9u.fsf@abra.ru>...
>
> Referer can be spoofed. Easily, very easily, very very easily. Such
> "protection" doesn't protect you at all.

To say that referer checking "doesn't protect you at all" is a bit of
an exaggaration.  If the purpose of the referer check is to keep
unauthorized web sites from directing public forms to a service on
your system then referer checking is quite effective.  The public in
general has no desire to spoof the referer just to use some form on a
web site.  OTOH if you try to use referer checking as some kind of
password-like authorization system you're going to be sadly
disappointed.

-Miko


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

Date: Sun, 14 Oct 2001 20:44:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Creating a cgi generated form
Message-Id: <n4ujsto55l8j3bjmabtesd9nl0p4vd7pc7@4ax.com>

Garry Williams wrote:

>> 	print <<'-END-OF-HTML-';
>> 	...
>> 	-END-OF-HTML-
>> 
>> By
>> embedding $var variables into your  text, you can produce slightly
>> different texts every time.
>
>Not if you use single quotes around '-END-OF-HTML-'.  

Yeah, I noticed that too when I saw my post appear. I *always* use
double quotes for here docs, even if, for the moment, they don't contain
any variables. A simple perl script can read any text (or html) file,
and produce a script with embedded here doc, and do all escaping for me.
Very handy.

-- 
	Bart.


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

Date: 14 Oct 2001 20:20:04 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <slrn9sjslm.cm5.damian@puma.qimr.edu.au>

On 13 Oct 2001 06:25:24 -0700, Trewth Seeker said:
>damian@qimr.edu.au (Damian James) wrote in message news:<slrn9qabkt.i3r.damian@puma.qimr.edu.au>...
>> Trewth Seeker chose 14 Sep 2001 17:29:47 -0700 to say this:
>
>> >I'd point you to the
>> >philosophical literature of ontology to help clarify your thinking
>> >about what "is", if I thought it would do any good -- "dude".
>> 
>> BTDTGTTS. Ontology is seldom any good at making things clearer.
>
>As I suggested, it won't do *you* any good.

Are you still here? 

*plonk*

HAND, etc


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

Date: Sun, 14 Oct 2001 22:56:53 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: filehandle : localized typeglob - local $_
Message-Id: <3bc9fc17@e-post.inode.at>


a recursive subroutine needs to open a file and keep it opened while it 
calls itself again and opens the next file ...

So I use something like this:

sub rec
{
  my $name=shift;
  local *FH;
  open(FH,'< $name) or die 'shit';
  while (<FH>)
  {
     ...
     rec($1) if $line=~/^INSERT\((.*)\)$/;
     ...
   } 
   close FH;
}


you got the idea ..

now I've a questions: 

perldoc -q filehandle  reveals the faq 'How can I make filehandles local to 
a subroutine' and states an example with a line 'local $_' and the comment 
that this is a very important line. Unfortunately there is no further 
explanation why this line is important and in the following examples there 
is no such line ...

Do I need the line and if - why ?

thnx,
peter

-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: Sun, 14 Oct 2001 21:42:04 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: filehandle : localized typeglob - local $_
Message-Id: <slrn9sk1lc.ine.garry@zfw.zvolve.net>

On Sun, 14 Oct 2001 22:56:53 +0200, peter pilsl <pilsl_@goldfisch.at>
wrote:

> perldoc -q filehandle  reveals the faq 'How can I make filehandles local to 
> a subroutine' and states an example with a line 'local $_' and the comment 
> that this is a very important line. Unfortunately there is no further 
> explanation why this line is important 

Because the idiom `while (<FH>) { ... }' uses $_.  

> and in the following examples there 
> is no such line ...

Because those examples are not using that idiom.  

-- 
Garry Williams


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

Date: Sun, 14 Oct 2001 19:08:41 GMT
From: "--Rick" <no_trick@my-de(remove the obvious)ja.com>
Subject: Re: HTML output using perl...
Message-Id: <Zoly7.123210$W8.3083039@bgtnsc04-news.ops.worldnet.att.net>


"Rob - Rock13.com" <rob_13@excite.com> wrote in message
news:Xns9139F002D7555rock13com@64.8.1.226...
| fail006 <news:9qatj1$be6$1@lust.ihug.co.nz>:
|
| > I have recently started using perl. I would like to know how
| > can i make perl output in to html format. When i run the
| > example code, it just outputs everything to MS DOS command
| > window...
|
| That is HTML. You need to use some program to view it as HTML if
| you want.
|
| > What do i require to setup so that i can perl to output as
| > html...
|

Try redirecting the output of your script to a file.

C:\windows\my documents\> perl index.cgi > index.html

Then try clicking on index.html in the GUI.

--

Rick




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

Date: Sun, 14 Oct 2001 20:16:41 +0200
From: Philip Newton <pne-news-20011014@newton.digitalspace.net>
Subject: Re: newbie question - how to rename files with Perl?
Message-Id: <filjstodo6j5jpvav40ekrbq2tretcou3j@4ax.com>

On Sun, 14 Oct 2001 12:59:42 +0200, peter pilsl <pilsl_@goldfisch.at>
wrote:

> cpan-module File::Find

Part of the standard Perl distribution.

(If you try to install it with CPAN.pm, you might end up with
perl-5.6.1.tar.gz.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 14 Oct 2001 20:16:59 +0200
From: Philip Newton <pne-news-20011014@newton.digitalspace.net>
Subject: Re: newbie question - how to rename files with Perl?
Message-Id: <9kljst0lrftbiqvab6v3snlkpslr604hnr@4ax.com>

On Sun, 14 Oct 2001 07:16:30 -0700, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:

>     perldoc -f ls

Actually, perldoc -f lc .

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 14 Oct 2001 20:01:34 GMT
From: "Geoff Clark" <gclark@wavetel.com>
Subject: Newbie Question on Writing\Printing to a File
Message-Id: <yamy7.500000$Lw3.30402546@news2.aus1.giganews.com>

I am using the Net::SNMP module to get certain data from our devices.  I
have the script written where it pulls the data fine and outputs it to the
screen, but I am trying to find out how to output this info to a file.  I
have a few books on Perl (Lama).  But all I am seeing is how to print data
from a text to a form.  I want to print this info to a form but from the
results.  I'm not sure where to start, if anyone could help it would be
greatly appreciated.  The following is the script as sits now.

#!'C:\Perl\bin\Perl.exe'

use strict;
   use vars qw($session $error $response $host $addr);


   use Net::SNMP;


   foreach $host (1 .. 10) {
   my $addr = "10.1.66.$host";

   ($session, $error) = Net::SNMP->session(
      -hostname  => $addr,
      -community => 'public',
      -timeout   => '5',
      -retries   => '1'
   );


   if (!defined($session)) {
      printf("ERROR: %s.\n", $error);
      next;
   }

   my $ip = '1.3.6.1.4.1.710.3.3.11.5.0';
   my $UnitName = '1.3.6.1.4.1.710.3.3.10.3.0';
   my $bestau = '1.3.6.1.4.1.710.3.3.6.23.1.0';

   $response = $session->get_request($ip, $UnitName , $bestau);


   if (!defined($response)) {
      printf("ERROR: %s.\n", $session->error());
      $session->close();
      next;
   }

   printf("IP Address = %s, Unit Name = %s, Best AU Support = %s\n",
      $response->{$ip},
      $response->{$UnitName},
      $response->{$bestau}
   );

   $session->close();
}
###################################################################
#                      Results to come
#
###################################################################
# #
#
 # #   format STDOUT =
#
##   @<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<       #
##   $ip, $UnitName, $bestau
#
##   .
#
##
#
##   format STDOUT_TOP =
#
##   Page @<<
#
##   $%
#
##
#
##          WaveTel Network Operations - Best AU Support
#
##                  0 = Disabled 1 = Enabled
#
##
#
##   IP Address                Unit Name
Best Au Support         #
##   ==============  ========================  ===============  #
##   .
#
##################################################################

   exit 0;


Thank you,

Geoff Clark






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

Date: Sat, 13 Oct 2001 11:30:13 -0700
From: "Greyangel" <greyangel@lanset.com>
Subject: Re: Setting cookies
Message-Id: <3bc9dde5@monitor.lanset.com>

Angel Station
greyangel@lanset.com
www.lanset.com/greyangel
______________________________________
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1d74gttt8.fsf@halfdome.holdit.com...
> >>>>> "Marshall" == Marshall Dudley <mdudley@execonn.com> writes:
>
>     Get real!  This is a discussion group, not a helpdesk.  You post
>     something -- we discuss its implications.  If the discussion happens
>     to answer a question you've asked, that's incidental.  If you post a
>     question that implies that you've got a problem finding answers to
>     trivial questions in the manual, then it is perfectly reasonable for
>     us to discuss how to do that.

Hmm. Seems to me that a discussion group  is a place for people to present
problems and ideas.   Nobody here is required to respond to an issue that
does not interest them, nor is it the responsibility of anybody here to
limit their questions to those that you are comfortable with...  The fact
is,  Newsgroups ARE the best kind of helpdesk.  It is an opportunity to
reach out to people who may be doing or have done similar things that don't
fall into the rut of a specific application/usage.   Don't dog sombody for
asking a question.  Don't answer it if you don't want to.

Greyangel




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

Date: Sun, 14 Oct 2001 15:19:54 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Setting cookies
Message-Id: <puly7.635$Cw4.247813@news20.bellglobal.com>


"Greyangel" <greyangel@lanset.com> wrote in message
news:3bc9dde5@monitor.lanset.com...

<snip shameless self-promotion>

> Hmm. Seems to me that a discussion group  is a place for people to present
> problems and ideas.   Nobody here is required to respond to an issue that
> does not interest them, nor is it the responsibility of anybody here to
> limit their questions to those that you are comfortable with...  The fact
> is,  Newsgroups ARE the best kind of helpdesk.  It is an opportunity to
> reach out to people who may be doing or have done similar things that
don't
> fall into the rut of a specific application/usage.   Don't dog sombody for
> asking a question.  Don't answer it if you don't want to.
>

Why is it that the only people who post these types of responses are the
ones who never post help of any sort?

You should probably take the time to reread Randal's post. He *does* provide
the OP with quite a bit of advice: take the problem to the author if he
doesn't understand Perl and more importantly use LWP::UserAgent if he does.

Should you take the time in the future to follow this newsgroup and offer up
advice of your own, you will quickly learn why people grow tired of these
types of questions. Until then, please spare the rest of us the
self-righteous BS.

Matt




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

Date: 14 Oct 2001 12:23:26 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Setting cookies
Message-Id: <m1y9mekoup.fsf@halfdome.holdit.com>

>>>>> "Greyangel" == Greyangel  <greyangel@lanset.com> writes:

Greyangel> Don't dog sombody for asking
Greyangel> a question.  Don't answer it if you don't want to.

Don't dog somebody for trying to keep this a potluck, where people
give and take, instead of a food line, where people come and take and
*expect* polite prompt answers to each question like it was a help
desk.  That's disrepectful of the community, especially the experts
who provide the answers.

That's my job.  Keeping this a potluck, by repeatedly requesting that
we notice that.  If you don't like that, feel free to form a
closed-subscription mailing list where all *you* do is answer
questions like a help desk.  You'll tire quickly.  And so do the
experts that want to hang out here.

If you want experts to hang around, allow me to say (repeatedly if
necessary) "this isn't a help desk".  And please respect that, and
support me in the potluck paradigm.  The helpdesk paradigm doesn't
work on a longterm volunteer basis.  And I've been around Usenet for
20 years, so I have a bit of historical experience to back me up on
this.

-- 
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: Sun, 14 Oct 2001 13:35:24 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Setting cookies
Message-Id: <3BC9F70C.14BBBCBF@vpservices.com>

"Randal L. Schwartz" wrote:
> 
> ... trying to keep this a potluck, where people
> give and take, instead of a food line, where people come and take and
> *expect* polite prompt answers to each question like it was a help
> desk.  That's disrepectful of the community, especially the experts
> who provide the answers.

Some ramblings on potlucks:

At our potluck there are 1) people like Randal who always bring
elaborate triple layer cakes with yummy frosty; 2) people like myself
who bring simple chocolate chip cookies and who sometimes put in salt
where the recipe called for sugar; 3) people who bring steaming heaps of
mule-manure pie that always seem to be left over when the feast is done
and 4) people who don't know how to cook at all but come wanting some
food.

And you know what, our potluck welcomes people in group number 4, but
with some reservations.  If those people walk right past the free
drinking fountain outside the room where we hold the potluck and loudly
demand to be given water, we're likely to point out the existence of the
fountain.  If they bring a recipe and demand that we provide the
ingredients and cook it for them, we're likely to ignore them or tell
them to take a flying leap.  If they bring store-bought food that tastes
bad we suggest they complain to the store where they bought it.  If they
bring rocks and want to discuss geology, we tell them there's a
rock-hounds meeting next door, we're more interested in stuff we can
sink our teeth into and we don't pay much attention when they protest
"but I wanted to cook *food* in a stone fireplace so this *is* the right
meeting to discuss minerals".

I think I can no longer stomach this metaphor, in fact I'm a bit fed up
with it and if I go on any further, we'll all become quesy.  Time to put
the list back into digest mode.

Hmm, the original topic was "setting cookies" -- more than coincidence?

-- 
Jeff



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

Date: Sun, 14 Oct 2001 21:51:46 +0100
From: "jimbo" <jimbo@soundimages.co.uk>
Subject: Re: Setting cookies
Message-Id: <CVmy7.12726$yL4.77590@NewsReader>

"Jeff Zucker" <jeff@vpservices.com> wrote
> "Randal L. Schwartz" wrote:
> >
> > ... trying to keep this a potluck, where people
> > give and take, instead of a food line, where people come and take
and
> > *expect* polite prompt answers to each question like it was a help

> Some ramblings on potlucks:

So, when you and your mates get together, you walk on the food on the
table rather than sit down and eat it?

> elaborate triple layer cakes with yummy frosty; 2) people like myself
> who bring simple chocolate chip cookies and who sometimes put in salt
> where the recipe called for sugar;

Salt and sugar aren't interchangeable?

> mule-manure pie that always seem to be left over when the feast is
done

Well, I suppose you need something to put in the bin.  I would be rather
depressed if all that remained at the end of the evening was to discard
the paper plates and put the crockery in the dishwasher.  Think of all
those unused plastic bin liners.

> and 4) people who don't know how to cook at all but come wanting some
> food.
>
> And you know what, our potluck welcomes people in group number 4, but
> with some reservations.

So, you limit the number of free-loaders you let through the door.

<snip>

> with it and if I go on any further, we'll all become quesy.  Time to
put
> the list back into digest mode.

Are you trying to be funny or is it just a quirk of fate?

jimbo
;-)




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

Date: 14 Oct 2001 21:56:13 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: Setting cookies
Message-Id: <slrn9sk2ft.5mm.dha@panix2.panix.com>

In article <CVmy7.12726$yL4.77590@NewsReader>, jimbo wrote:
> "Jeff Zucker" <jeff@vpservices.com> wrote
>> "Randal L. Schwartz" wrote:
>> >
> 
>> and 4) people who don't know how to cook at all but come wanting some
>> food.
>>
>> And you know what, our potluck welcomes people in group number 4, but
>> with some reservations.
> 
> So, you limit the number of free-loaders you let through the door.

Sadly, that's one of the places where the metaphor falls apart, as the
door to usenet seems to have lost its bar...

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
 ... nononono. And to use nonononono just to negate that is, uhm,
confusing. Someone might think I'm stuttering.
        - Abigail, p5p


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

Date: Sun, 14 Oct 2001 20:14:40 +0200
From: Philip Newton <pne-news-20011014@newton.digitalspace.net>
Subject: Re: Specifying a range of values
Message-Id: <keljstsr87pp64tgm19hom210hi41rv6gj@4ax.com>

On Sun, 14 Oct 2001 18:01:51 GMT, garry@ifr.zvolve.net (Garry Williams)
wrote:

> On 14 Oct 2001 10:45:33 -0700, Gary <gary@academe-solutions.com> wrote:
> > Probably a simple question, but I was wondering how I can specify a
> > range of vaules to use in an if statement.
> > 
> > For example, I want to specify for an action to be taken if a user
> > scores between X and Y.   How do I code that?  Thanks.
> 
>   if ( $score > $X && $score < $Y ) { ... }

Or, equivalently,

    if( $X < $score && $score < $Y ) { ... }

which I prefer personally. (Perl6 will let you do the 'maths' thing and
go straight for

    if( $X < $score < $Y) { ... }

 .)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 14 Oct 2001 12:51:49 +0000
From: Jopa <junk@mytechsolutions.com>
Subject: Re: Specifying a range of values
Message-Id: <l4ly7.1184$AU.322060@news.uswest.net>

Jopa wrote:

> Gary wrote:
> 
>> Probably a simple question, but I was wondering how I can specify a
>> range of vaules to use in an if statement.
>> 
>> For example, I want to specify for an action to be taken if a user
>> scores between X and Y.   How do I code that?  Thanks.
> 
> 
> if (($X >= 20) && ($Y <= 30)) {
>         do somthing....
> }
> 
> 
> this is one way, or you could use.
> 
> 
> 
> some stuff if (($X >= 20) && ($Y <= 30));
> 
> 
> 
> There may be an easier way but this is the way I know of and use.
> 
> Jopa
> ~~~~~`


sorry, too early, try this.

$X = 20;
$Y = 30;

if (($score >= $X) && ($score <= $Y)) {
         do somthing....
}




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

Date: Sun, 14 Oct 2001 20:31:52 GMT
From: "_Mario Latens" <mario.lat@libero.it>
Subject: startform(get,"www..../file.pl"); how can I use startform?
Message-Id: <20011014.222808.841148365.1440@localhost.localdomain>

I'd like to send data from a web page written in perl to a web page
written in perl.
For doing that I need to create a form whit:
 startform, but I have not found an example where the page to send data is not the
same!!
How can I use startform to send data to a .pl file?

Thankyou in advance, Mario.


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

Date: Sun, 14 Oct 2001 21:41:52 +0100
From: "jimbo" <jimbo@soundimages.co.uk>
Subject: Re: startform(get,"www..../file.pl"); how can I use startform?
Message-Id: <kMmy7.22601$U97.114592@NewsReader>

"_Mario Latens" <mario.lat@libero.it> wrote in message

Mario, Mario, Mario.  When will you learn?

>  startform, but I have not found an example where the page to send
data is not the
> same!!

STARTING AND ENDING A FORM

print $query->start_form(-method=>$method,
                         -action=>$action,
                         -enctype=>$encoding);
<snip>

start_form() will return a <FORM> tag with the optional method, action
and form encoding that you specify. The defaults are:

method: POST
action: this script
enctype: application/x-www-form-urlencoded

<snip>

Start_form()'s enctype argument tells the browser how to package the
various fields of the form before sending the form to the server. Two
values are possible:

Note: This method was previously named startform(), and startform() is
still recognized as an alias.

> How can I use startform to send data to a .pl file?

Well, you might try the bit where you set the action of the form you are
creating to something useful. Say, the name of your CGI script.  On the
name of somebody's CGI script.

> Thankyou in advance, Mario.

Well, I cannot say, with honesty, you're welcome.

It's right there Mario, right there in the docs.  If you need them,
which it is clear you do, point your web browser to

  http://stein.cshl.org/WWW/CGI/

Now stop begging.  It is most unseemly.

jimbo
;-(




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

Date: Sun, 14 Oct 2001 21:56:14 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Stop Transversal of a Directory with Tar and Unzip
Message-Id: <3BCA0A13.59D406B2@home.com>

> Randal L. Schwartz wrote:
> > {ahem} "correct" being used loosely?
> >      open STDERR, ">&STDOUT" ...

Hmmm. I'm confused. According to perlsec...
  open(FOO, "< $arg");	# OK - read-only file
  open(FOO, "> $arg"); 	# Not OK - trying to write
So, which of the above are correct?

> Benjamin Goldberg wrote:

> > ### TEST the ZIP File first
> > `unzip -qt $tmpfile`;
> > if ($? == 0 ) {
> 
> Why are you using backticks instead of system()?  This should be:
> 
> system("unzip", "-qt", $tmpfile);

Ummm. Because I didn't know any better. :) 


> if( system("unzip", "-qt", $tmpfile) ) {
>    my ($sig, $ret) = ($?&255, $?>>8);
>    die "unzip -t died from signal $sig" if $sig;
>   die "unzip -t exited with code $ret" if $ret;
>    die "system failed: $!";
}

It works great up to here.


> defined( my $pid = fork ) or die "Couldn't fork: $!";
> if( $pid == 0 ) {
>    open(STDOUT, ">/dev/null") or close(STDOUT);
>    open(STDERR, ">&STDERR") or close(STDERR);
>    # for neither of the above do we really care if we could open
>    # /dev/null, since the only purpose of us doing so is to discard
>    # our output.
>    exec( "unzip", "-qqjnCL", $tmpfile,
>            "-x", "*.pl *readme* *.ht *.exe",
>            "-d", $tmpdir );
>    die "exec(unzip) failed: $!";
>    }

Why does it only die here if something is wrong with $tmpfile. Shouldn't
it also die if it can't find $tmpdir, etc? For example, I tried a
$tmpppdir that didn't exist, and it  gave no error.


> if( waitpid( $pid, 0 ) ) {
>    my ($sig, $ret) = ($?&255, $?>>8);
>    die "unzip died from signal $sig" if $sig;
>    die "unzip exited with code $ret" if $ret;
> } else {
>    due "waitpid($pid, 0) failed: $!";
}

"due"? lol... I wondered why it failed? Of course, I changed the last
line to die "waitpid($pid, 0) failed: $!";

Thanks for this script. Even though I may change to using the Perl
modules later for unzipping, your examples and corrections have served
me well in teaching me how to properly execute programs from the shell
in Perl (and another lesson in proper syntax too). I take it that I can
utilize the above unzip program example for other programs too, such as
tar, wget, etc... with a few minor changes.


> through testing?  Whatever happened to reading the manual pages?
> Even if you don't have access to them on the system you're coding for,
> you can get man pages through the web... .

I can get "man unzip" from the command line. I have also had the
unzip(1) manual on my website for months, and am constantly studying it.
Additionally, I have also been studying the perl FAQ and many of the
perldocs such as perlop and perlsec, and searching Google.

> > I needed Compress::Zlib and I can't compile on it on my present server.

> Can't you get it already compiled for that architecture?

I hadn't thought of that. Is that the same as a binary? In a Google
search of "Compress::Zlib compiled FreeBSD" I wasn't able to find one,
but maybe I don't know what I'm looking for.

Regards,
Dennis


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1928
***************************************


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