[8546] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2163 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 23 13:12:06 1998

Date: Mon, 23 Mar 98 10:00:30 -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, 23 Mar 1998     Volume: 8 Number: 2163

Today's topics:
    Re: "Getting data from another machine" <barnett@houston.Geco-Prakla.slb.com>
    Re: "Getting data from another machine" <davidr@home.com>
        /dev/fb error eugene@vertical.net
    Re: Can this be done with Perl5 and NT4 <jdf@pobox.com>
        checking for undefined elements in an array (Kevin B Cohen)
    Re: Help with registry.pm <taautry@ti.com>
    Re: how to know the version of the perl <jefpin@bergen.org>
    Re: Is there a "Newsgroup" for Newbies to Perl? (Craig Berry)
        PERL and CGI Francois-Xavier.bor@bde.espci.fr
    Re: perl databases ?? <dean@tbone.biol.sc.edu>
    Re: So what's the *right* way to pass function names an <friedman@uci.edu>
    Re: So what's the *right* way to pass function names an <tchrist@mox.perl.com>
    Re: splicing element of a LoL <roland@consol.de>
        Submitting to another CGI-Script <wv@earthling.net>
    Re: Submitting to another CGI-Script <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Time::HiRes Problems Installing it <road@apdo.com>
    Re: Trouble with alarm when waiting on <INPUT> <langford@uiuc.edu>
        ts: unexpected behavior of "last" with "print" tsatan@hotmail.com
    Re: Variable question <jimbo@soundimages.co.uk>
    Re: Wanted: email address gleaner sloop@mailcity.com
    Re: Wanted: email address gleaner joneil@cks.ssd.k12.wa.us
    Re: what is wrong with being a novice ?? <pdcawley@bofh.org.uk>
    Re: what is wrong with being a novice ?? (Craig Berry)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 23 Mar 1998 09:47:10 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: "Getting data from another machine"
Message-Id: <351683FE.83C23FD5@houston.Geco-Prakla.slb.com>

Terry Michaels wrote:
> 
> How can I get system information from another machine
> through my script.  I want to launch a script from "predator"
> which can look at other machines and read the results from
> "df -a" or "df -k" into an array for reporting.
> 
> Thanks in advance,
> 
> Terry Michaels
> Apache Corporation
> Houston, Texas
> terrence.michaels@apachecorp.com
You mean something like this?


#!/usr/local/bin/perl -w
# 
open(STUFF,"rsh dapdserv df -a |") or die "Cannot open: $!\n";
@array = <STUFF>;
foreach (@array) {
    print $_;
}
__END__

HTH.

Dave

--
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Sun, 22 Mar 1998 11:31:55 -0800
From: David Richardson <davidr@home.com>
Subject: Re: "Getting data from another machine"
Message-Id: <3515672B.22EC43F5@home.com>

Terry Michaels wrote:

> How can I get system information from another machine
> through my script.  I want to launch a script from "predator"
> which can look at other machines and read the results from
> "df -a" or "df -k" into an array for reporting.
> 
> Thanks in advance,
> 
> Terry Michaels
> Apache Corporation
> Houston, Texas
> terrence.michaels@apachecorp.com

  You could have a dedicated server running on the systems you want to
get the information from. Then have a client that runs out of cron or
something that contacts the dedicated server on the machines.

David R.



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

Date: Mon, 23 Mar 1998 11:32:45 -0600
From: eugene@vertical.net
Subject: /dev/fb error
Message-Id: <6f667c$clm$1@nnrp1.dejanews.com>

I'm running a CGI script with suid on Solaris.
The script works, but also sends the following message to the browser:


Use of uninitialized value at /dev/fd/31 line 59 (#1) (W) An undefined value
was used as if it were already defined. It
   was interpreted as a "" or a 0, but maybe it was a mistake. To suppress
this warning assign an initial value to your
           variables.

I understand the warning and what in my code generates it. But can someone
explain  the obscure reference to /dev/fd/31?

Thanks.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 23 Mar 1998 11:17:25 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: webmaster@jersey.net
Subject: Re: Can this be done with Perl5 and NT4
Message-Id: <wwdljsa2.fsf@news.concentric.net>

                      [author cc'd by mail]

Josh Cook <webmaster@jersey.net> writes:

> My application that I need to create involves a perl script, running as
> a cgi program, to request a webpage from another site and then take the
> contents from that page and re-format them into a new page for my site. 
> The webpage that I would be 'borrowing' this information has the page
> setup so that all of the information that I need is between <pre> tags. 
> Can anyone help me in getting started with this???

This is an easy task for a moderately experienced Perl programmer,
who would know to use the LWP modules and a regex or two.  You'll
have to learn Perl, though.  I suggest you start with the excellent
book _Learning Perl_.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 23 Mar 1998 12:43:00 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: checking for undefined elements in an array
Message-Id: <6f66v4$h93@julius.ling.ohio-state.edu>

greetings,

i'm looking for an elegant way to see if there are any undefined
elements in an array.  the best thing i can thiink of to do is to
write a subroutine, something like 

sub IsFullyDefined {
	my (@array) = @_;
	my $stop = $#array; # index of last element
	my $i; # counter
	for ($i = 0; $i <= $stop; $i++) {
		($array[$i] == undef) && return;
	}
	return 1;
}

this would evaluate to false if there's an undefined element, and true
if there are no undefined elements.

is there a better way??? us being perl, i'm sure there's More Than
One....

kevin

If we suppose for the moment that a pizza is a syntactical
structure....
Nigel Chapman, Perl: The Programmer's Companion



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

Date: Mon, 23 Mar 1998 10:20:02 -0600
From: Thomas Autry <taautry@ti.com>
To: Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com>
Subject: Re: Help with registry.pm
Message-Id: <35168BB2.EEA6C6E@ti.com>

Dennis,

If you are working on NT then you need to use

SetValueEx   instead of SetValue

I had the same problem but SetValueEx works fine
for me.

Re,

Thomas Autry

Dennis Kowalski wrote:
> 
> I have been able to create an environmental variable in the registry
> with the registry.pm module.
> 
> Now I am trying to change the value of it but it won't do it
> 
> Can anyone see what I am doing wrong OR just give me another way to
> change the value of an existing value ??
> 
> Here is my code
> The variable name I am trying to change is DMKVAR
> 
> use Win32::Registry;
> $p =
>  "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
> 
> $main::HKEY_LOCAL_MACHINE->Open($p, $Vars) ||
>   die "Open: $!";
> 
> $Vars->GetValues(\%vals);
> 
> $subkey = 'DMKVAR';
> 
> foreach $k (keys %vals)
> {
>  $key = $vals{$k};
>  if (uc $$key[0] eq $subkey)
>  {
>   $oldval = $$key[2];      # save current value of DMKVAR
>   last;
>  }
> }
> 
> 0;
> 
> $newvalue = $oldval . ';D:\DIRA;D:\DIRB';
> 
> $Vars->Open($subkey, $skey) ||
>   die "Open: $!";
> 
> $Vars->SetValue($subkey,REG_SZ,$newvalue) ||
>   die "Set: $!";
> 
> $main::HKEY_LOCAL_MACHINE->Close() ||
>   die "Close: $!";
> 
> Thanks


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

Date: Mon, 23 Mar 1998 11:05:28 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
Subject: Re: how to know the version of the perl
Message-Id: <Pine.SGI.3.95.980323110459.4399A-100000@vangogh.bergen.org>

>> % /usr/local/bin/perl -V

>   Unrecognized switch: -V.

perl -v just tells you version number (and a little other info)

--
| Experience is that marvelous thing that enables you recognize a
| mistake when you make it again.
|                                                   - F. P. Jones

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
                qw[jeff] on #perl,#javascript,#cgi on IRC

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: 23 Mar 1998 03:24:37 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6f4kll$l43$1@marina.cinenet.net>

Kai Henningsen (kaih=6qLXH67mw-B@khms.westfalen.de) wrote:
: cberry@cinenet.net (Craig Berry)  wrote on 13.03.98 in <6ec98q$q4e$1@marina.cinenet.net>:
: >   No, programming is not an easy thing;
: > I think part of the problem is that people *expect* it to be easy, expect
: > to be able to approach it as one would a (say) Windows word processor --
: > playing with it to learn, rather than reading a single word of the doc
: > (on- or offline).  This simply will not work, and those who expect it to
: > need an awakening, rude or otherwise.
: 
: I can't resist pointing out that actually, this works pretty well for me  
: as long as I do it with programming languages, and not with Windows word  
: processors, whose finer points I certainly don't grok :-)

The point is that a modern word processor has all the available commands
out where you can find them just by wandering through menus and submenus
and dialog boxes.  In contrast, there is no practical way to even know of
the existence of (say) the split function without reading doc (in one form
or another), or working code, or perhaps the Perl source itself.  You
can't (in practical terms) stumble across split serendipitously. 
Similarly, the special way a ' ' pattern arg is handled would be
excruciatingly hard to discover and understand using nothing but playing
with test code, but is trivial to understand from the doc. 

: Seriously, playing with a programming language to learn strikes me as one  
: of the best possible ways to learn it. Of course, depending on what you  
: already know, this *takes time*. But nothing ever beats hands-on  
: experience.

Absolutely true.  But before you can play with the language productively, 
you need to know at least a minimal subset of its syntax, its basic 
control structures, and a few of its built-in functions.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 24 Mar 1998 02:35:50 GMT
From: Francois-Xavier.bor@bde.espci.fr
Subject: PERL and CGI
Message-Id: <6f66gq$huo$1@pinot.ext.jussieu.fr>

hello,

i would be grateful to you if you could help me with one of my Perl
script.The aim of this very short script is to make an Email
directory with the students of my school (you know, you give the neme
or the firstname and it gives you back the entire name or/and the
Email.I know I may find the script on the web, but I want to do it
myself. I wrote the script in perl.

The perl program had runned very well on linux when i had put a
<STDIN> to get the firstname or the name for the request, and when i
had written the result of the request with the <STDOUT>. So that I
have wanted to put it on a Webpage. Here have begun my difficulties.
'cause nothing happen when i click to the "send " button. Then I am
sure the problem is in the way i get the answer of the CGI, or in the
way i send back a new webpage for the answer of the request..
 .
Here is the Pageweb for the directory, I'm quite sure there is no
problem with it.  
<HTML><HEAD><TITLE>"DIRECTORY"</TITLE></HEAD>
<BODY><FORM METHOD ="POST" ACTION ="tot">
<P ALIGN =CENTER><FONT SIZE=+3> " welcom on the directory for the
student of **** "</FONT></P>
<P ALIGN =LEFT> here give the name or the firstname (plz not in
capital letters , thanks): 
<BR><INPUT NAME="askedname"> 
<INPUT TYPE = "SUBMIT" VALUE = "send"><BR>
<INPUT TYPE = "RESET" VALUE = "errase"></P></FORM></BODY></HTML>>

Here is my perl program, put in my own directory besides the webpage
and called 'tot' as long as i do my tests on it. i'm quite sure there
is no problem from line 5 to line 13 (cause I tried it with <STDIN>
and <STDOUT>. So the problem is either at the very first lines ,
either at the end, (or both.  :-)

#!usr/bin/perl
use CGI; 
$html = new CGI;
 .
$i = 0; 
$aske = $html->param('askedname');
$file = '/etc/passwd';
$tentative = 'tentative';
open (tent, ">$tentative"),print tent "";close (tent);open
(meee,">>$tentative"); open ("INFO", $file);@lines = <INFO>;close
(INFO);
foreach $ligne (@lines)
{$a = $ligne; $ligne =~ y/[A-Z]/[a-z]/;if ($ligne =~ /$aske/) 
{$i++; @student = split(/:/,$a);@namee = split (/ /, $student[4]);
print  meee "$namee[0].$nam[ee1]\@somewhere.com\n";}};close
(meee);open (tenta, $tentative);@liste = <tenta>;close (tenta);

 
print $html->header;
print $start_html;
print "<HTML><HEAD><TITLE>DIRECTORY</TITLE></HEAD>\n";
print "<BODY><P ALIGN =CENTER><FONT SIZE=+3>RESULT of your SEARCH :
</FONT></P>\n";
print "<P ALIGN =LEFT> Number of right answer:", $i,"<BR>\n"; 
print @liste;}
print "</BODY></HTML>";
print $html->end_html;


I would be really grateful to you if you could help me.
thanks for having reading this message, and thanks even more if you
can help me.

Francois 




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

Date: 23 Mar 1998 12:17:24 -0500
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: perl databases ??
Message-Id: <87pvjd8gyj.fsf@tbone.biol.sc.edu>

ryan@remove-this-mmainteractive.com (Ryan) writes:
> Hello. I have an account at a hosting provider, and I'd like to set up
> a perl database there. I know perl pretty well, and I've done some
> ...
> start? I plan to have a few hundred records, with less than 10 fields
> in each record. One field will be user updateable through the web
> page. Thanks a lot for any help.

You'll want to look at the Perl manual regarding tied hashes.  This is
a mechanism whereby you can have your program use a hash data
structure for the database, but it gets automagically stored to disk
rather than just existing in memory.  

The tricky bit (in theory) is that the data elements in tied hashes
must be scalars: they can't contain neat things like other hashes or
arrays or all the things you'd like to use to create a multi-field
record.  Howver, there exist several ways of dealing with this.  One
very transparent one that works well is the MLDBM module.  This module
translates your complex data structure into a storable scalar, and
regenerates it upon recall (all this happens behind the scenes).  

You'll want to use something like the following lines at the beginning
of your program:

use DB_File;             # Specify use of the Berkeley dbm package
use MLDBM qw(DB_File);   # persistent complex hash storage using DB_File

(Note that you don't have to use DB_File, you could use one of the
other dbm packages instead - just match up the one you use with the
argument to the MLDMB "use" statement.)

Check the MLDBM module manual page and the Perl documentation on tie
for details.

On the other hand... your database is small enough, you might just
consider slurping in the whole thing and rewriting it each time.  

One thing about which you'll need to be careful is file locking: more
than one process might try to access the database at once.  Check the
Perl FAQ at http://www.perl.com/ for some info on locking.  

Hope that's helpful.


> reply to   ryan at mmainteractive dot com

No.  If you want a reply, follow standard addressing protocol and put
your address into a form my programs can read.  Spam blocking is your
responsibility.  It is not my responsibility to flail around to give
you uncompensated help.

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: 23 Mar 1998 15:51:41 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: So what's the *right* way to pass function names and call them?
Message-Id: <6f60ed$8o0@news.service.uci.edu>

In article <6f5tna$e0p$1@cascade.cs.utexas.edu>,
David R. Throop <throop@cs.utexas.edu> wrote:

<Ok. I have this complicated graph structure that I must traverse
<repeatedly, in the same order.  On the first pass I call one function
<on each of the nodes, on subsequent passes I call other functions.  I
<have a single routine to do the traversal.  I call it repeatedly,
<passing the name of this traversal's function as an argument.  When
<the traversal routine gets to a node, it calls 'do' to apply the
<function to the node.

I would build a hash of subroutine references and pass in keys
to indicate which of those subs should be called.

my %functions = (
                  'func1' => sub { print "hi"; print join ' ', @_ },
                  'func2' => sub { print "bye"; print join ' ', @_ }
                );


sub doit 
{
  my $cmd = shift;
  my @args = @_;
  # preprocess the arguments in some special way
  push @args, "Thanks for dropping in!" if $cmd eq 'func2';
  &$functions{$cmd}(@args);  # call one of the functions.
}

-- 
Eric D. Friedman
friedman@uci.edu


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

Date: 23 Mar 1998 15:28:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: So what's the *right* way to pass function names and call them?
Message-Id: <6f5v21$7j9$1@csnews.cs.colorado.edu>

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

Pass a function by reference:  whatnot( \&fncname )
Call it indirectly: my $fp = $_[0]; &$fp(args here)
				or $fp->(args here) in 5.004


Learn about this in perlref mostly.

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


There is a need to keep from being locked into Open Systems. --IBM sales rep


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

Date: 23 Mar 1998 18:04:31 +0100
From: Roland Huss <roland@consol.de>
Subject: Re: splicing element of a LoL
Message-Id: <55g1k92va8.fsf@rom.supportpartner.munich.sgi.com>

nick@contract.kent.edu writes:

> I'm trying to remove from the list of lists @data records 0, 2 and 3 (1,a,A),
> (3,c,C) and (4,d,D)...
> 
> @data = ([1,2,3,4],[a,b,c,d],[A,B,C,D]);
> @items = (0,2,3);
> 
> foreach $item (@items){
> 	splice @{$data[0]},$item,1;
> 	splice @{$data[1]},$item,1;
> 	splice @{$data[2]},$item,1;
> 	}

The problem  here is, that you should  shift your indeces in @items as
well in each loop. Note that for example in the second run of the loop
the deleted item with  index 2  in  @{$data[0]} isn't '3' anymore  but
'4'.  Probably a  better solution (at  least  one, which  should work)
could be:

 foreach $item (@items) {
    foreach (@data) {
      @{$_}[$item] = '';
    }
 }

 foreach (@data) {
    @{$_} = grep(!/^$/,@{$_});
 }


bye...
-- 
							...roland huss
						             consol.de


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

Date: Mon, 23 Mar 1998 16:58:42 +0100
From: Webmaster <wv@earthling.net>
Subject: Submitting to another CGI-Script
Message-Id: <351686B2.FBF90BC9@earthling.net>

Hi,

how can one Perl-Script submit FORM-Data to another
CGI-Script (on another server)? 
E.g.: Submit Website-Data to multiple Searchengines.


Thanks in advance

Walter Voell


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

Date: 23 Mar 1998 17:51:41 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
To: wv@earthling.net
Subject: Re: Submitting to another CGI-Script
Message-Id: <7xyay1xsde.fsf@beavis.vcpc.univie.ac.at>

Re: Submitting to another CGI-Script, Webmaster
<wv@earthling.net> said:

Webmaster> Hi, how can one Perl-Script submit FORM-Data to
Webmaster> another CGI-Script (on another server)?  E.g.:
Webmaster> Submit Website-Data to multiple Searchengines.

Use the LWP module family.  Use CPAN from
http://www.perl.com/ if you don't already have this.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"


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

Date: Mon, 23 Mar 1998 17:20:44 +0100
From: "A.P." <road@apdo.com>
Subject: Time::HiRes Problems Installing it
Message-Id: <35168BDB.B7D22FC8@apdo.com>

Hi,
I've trying to install the Time::HiRes module to no avail. I think that
I shouldn't mess with the Makefile.PL code, so I kindly ask for help of
anybody more clever than me. I enclose information about my system
below, after the install output.
Thank you very much in advance for your help.

----
server: # perl Makefile.PL

Configuring...

Undefined                       first referenced
 symbol                             in file
main
/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2. 7.2/crt1.o ld: fatal:
Symbol referencing errors. No output written to /var/tmp/tmp3569 Your
operating system does not seem to have the gettimeofday() function.
(or, at least, I cannot find it)

There is no way Time::HiRes is going to work.

I am awfully sorry but I cannot go further.

Aborting configuration
----

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=solaris, osver=2.5, archname=sun4-solaris
    uname='sunos smc.vnet.net 5.5 beta sun4m sparc sunw,sparcstation-10
'
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2.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', 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
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'

@INC: /opt/LWperl/lib/sun4-solaris/5.003 /opt/LWperl/lib
/opt/LWperl/lib/site_pe
rl/sun4-solaris /opt/LWperl/lib/site_perl .



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

Date: Mon, 23 Mar 1998 10:05:00 -0600
From: Jacob Langford <langford@uiuc.edu>
Subject: Re: Trouble with alarm when waiting on <INPUT>
Message-Id: <3516882B.4EBBBC4A@uiuc.edu>

Calle Dybedahl wrote:

> Jacob Langford <langford@uiuc.edu> writes:
>
> > I use the system command "ping" and always use the
> > function "alarm" to terminate the ping session.  The program
> > hangs up on machines that don't respond, I presume because
> > alarm doesn't work when I'm waiting on <INPUT>.
>
> This sounds quite OS-dependent, but my guess is that your signal isn't
> being delivered while the child ping is waiting for a timeout.

I assumed that the problem wasn't ping-dependent, i.e. that it was
related to waiting on <INPUT>.  Also, this happens on all UN*X
systems I have tried.  But I just wrote a small script and convinced
myself alarm works on <STDIN>:
#!/usr/local/bin/perl -w

local $SIG{ALRM} =
   sub {
      print "\n\n\a*** Hey dummy, wake up! ***\n\n";
      die "Stopping input.";
   };

while (1) {

   eval {
      print "Do you want to quit? ";
      alarm 5;
      $resp = <STDIN>;
      alarm 0;
   };
   die "Goodbye\n" if ($resp =~ /[yY]/);

}



> > Any ideas?
>
> Net::Ping saves you a child process and lets you set the timeout value.

Yes.  Good suggestion.  I have written the script I wanted usingNet::Ping,
but I would still like to know why the alarm didn't
work while waiting on </bin/ping |> input.

Jacob (langford@uiuc.edu)



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

Date: 23 Mar 1998 17:55:27 GMT
From: tsatan@hotmail.com
Subject: ts: unexpected behavior of "last" with "print"
Message-Id: <6f67mf$tb5$1@orthanc.reference.com>

How come this works:
   open PW, "/etc/passwd" or die "cannot open pw: $!";
   while (<PW>) {
      print "root's pw is $1\n" if /^root:([^:]*)/;
   }
but using "next" or "last" doesn't - ?
   open PW, "/etc/passwd" or die "cannot open pw: $!";
   while (<PW>) {
      print "root's pw is $1\n", last if /^root:([^:]*)/;
   }
How cum nothing's printed here? What's the dilly-o?

thanks
--tsatan
--


  -------------------------------------------------------------------- 
  Posted using Reference.COM                  http://WWW.Reference.COM 
  FREE Usenet and Mailing list archive, directory and clipping service 
  -------------------------------------------------------------------- 


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

Date: 23 Mar 1998 17:16:50 +0000
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Variable question
Message-Id: <uyay1iayl.fsf@soundimages.co.uk>

Tom Christiansen <tchrist@mox.perl.com> writes:

> In comp.lang.perl.misc, "Shawn M. Kelly" <kellysm@ix.netcom.com> writes:
> :I have a data file that looks like this:
> :door1    5.0
> :door2    2.0
> :door3    7.0
> 
> You're thinking about this all wrong -- you *do not* want three separate
> variables.  You want a data structure here whose contents are those
> door names.  Perhaps you are more used to using some icky thing like
> Fortran, Cobol, or BASIC.  Until you start thinking in terms of hashes
> and in terms of regular expressions, you aren't thinking in Perl.
> 
>     while (<>) {
> 	($door, $number)   = split;
> 	$valuables{$door}  = $number;
>     } 
> 
>     foreach $door (sort keys %valuables) {
> 	$contents = $valuables{$door};
> 	print "$door equals $contents\n";
>     } 
Dear Tom,

wouldn't you want to use chomp($number) to remove the newline hanging on the end of the 'number'?
But most of all, the 'Until you start thinking...' part has been a real shift of perception treat. Thanks.
Jim Brewer


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

Date: Mon, 23 Mar 1998 17:27:20 GMT
From: sloop@mailcity.com
Subject: Re: Wanted: email address gleaner
Message-Id: <35169a4d.32683682@news.xmission.com>

On Mon, 23 Mar 1998 09:55:24 +0000, Jeff Potter
<jp@glpbooks.BADMAIL.com> wrote:

>Ian Boys wrote:
>> 
>> Jeff,
>> 
>> I think, through no fault of your own, you have chosen the wrong
>> newsgroup to post your question in.  You have probably come from a
>> background of friendly groups, populated by people who share a common
>> interest, with a sense of community spirit and a desire to help each
>> other.
>
>Actually, I don't mind the tone. I'm just looking for the facts.
>So far Stanley has seemed to be wrong, has omitted pertinent
>facts. See my last post above if it ain't all too boring for you yet.
>I'm willing to be convinced that my project is spammish, but they
>haven't done it yet. 

It's rapidly becoming irrelevant though.  In the amount of time you're
waisted by replying to people's comments on this thread you could
easily have read the RFC on email, written your own address gleaner,
and found a half dozen of them online via the web.  Now the fight
exists only for the love of fight.  Perhaps we could let it die now.
Really, if you spend fourty minutes a day for two weeks reading and
replying to comments in this thread you've spent over nine hours.  A
lot can be accomplished in that amount of time if it's applied to the
aquisition of knowledge rather than the advancement of the battle.

 ...and you STILL haven't stopped garbling your email address... 




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

Date: Mon, 23 Mar 1998 11:22:10 -0600
From: joneil@cks.ssd.k12.wa.us
Subject: Re: Wanted: email address gleaner
Message-Id: <6f65n9$c4t$1@nnrp1.dejanews.com>

In article <35158be3.2323602@news.tornado.be>,
  bart.mediamind@tornado.be (Bart Lateur) wrote:
>
> joneil@cks.ssd.k12.wa.us wrote:
>
> >Please give a reason why sending the same unsolicited message to thousands
of
> >people *isn't* spam.
>
> So the Perl MiniFAQ that everybody that posts in this newsgroup for the
> first time, gets, is spam? It must be.

If I post to a newsgroup about perl, I should reasonably expect a response
about perl.  The auto-FAQ is sent to one person as a response to one message.
 It isn't even close to SPAM.

Jerome

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 23 Mar 1998 17:02:52 +0100
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: what is wrong with being a novice ??
Message-Id: <s7pemztfl8z.fsf@legolas.elsevier.nl>

"Tony Kenny" <tony@cyberscape.net> writes:

> As another 'inexperienced' perl programmer I agree entirely with
> your posting. I sometime get flamed on the IRC for asking questions
> that are really in the FAQ and quite rightly because I should really
> spend more time reading (if I had the luxury of time).
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^

You don't have the luxury of time? What about the people whose time
you waste by asking an FAQ? Spending time reading the documentation
shouldn't be something you do in your spare time, it should be done
as an investment during your work time.

-- 
Piers Cawley
<This space to let>


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

Date: 23 Mar 1998 03:31:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: what is wrong with being a novice ??
Message-Id: <6f4l1t$l43$2@marina.cinenet.net>

Kai Henningsen (kaih=6qLXGh-Hw-B@khms.westfalen.de) wrote:
: tim@maroney.org  wrote on 21.03.98 in <6f0vp4$e6j$1@nnrp1.dejanews.com>:
: > Uh, hello, time is bandwidth. When people refer to their news or mail
: > reading bandwidth they are referring to how much information they personally
: > have to sort through. This has been a standard idiom on USENET from the
: > beginning, or at least since I joined in 1982.
: 
: I've never seen bandwidth used that way. All uses of "bandwidth" I've ever  
: seen were about the wire's data capacity, never about people's reading  
: habits. That's the standard way it's used on Usenet, AFAICT.

Must be a subcultural thing...I and my friends use 'bandwidth' in the
'human information-processing capacity' sense all the time when discussing
Net social issues.  I find the analogy rather compelling. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

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

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed 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 2163
**************************************

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