[6875] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 500 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 23:17:40 1997

Date: Mon, 19 May 97 20:00:28 -0700
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, 19 May 1997     Volume: 8 Number: 500

Today's topics:
     Re: $% argument prototype. <jstern@world.northgrum.com>
     Re: array of arrays (Bill)
     Breaking on single line conditional blocks in the debug (Jot Powers)
     Re: Breaking on single line conditional blocks in the d (Ilya Zakharevich)
     Building WWW Databases using perl/CGI <echiu@netscape.com>
     Re: Clearing a Form when using the Back Button <106076.446@compuserve.com>
     Re: Clearing a Form when using the Back Button (Jeff Stampes)
     Del/Sort Flat Text File - Advice Requested (Tony K. Olsen)
     Re: Del/Sort Flat Text File - Advice Requested (Nathan V. Patwardhan)
     Form Submitions to a database <flash@integration.adnc.com>
     Getting File Size cwyatt@cris.com
     Re: Getting File Size (Mike Stok)
     Re: Help: How to Split a file at a Null Line??? (Tung-chiang Yang)
     Re: How I change the Perl version of Novell Intranetwar <106076.446@compuserve.com>
     Re: if string in list ?? <rootbeer@teleport.com>
     Re: inclu-OR in regex (Ilya Zakharevich)
     Re: local in list contex? <simonk@telebusiness.co.nz>
     Need Help with Perl Script Implementation for e-Mail .H (SB)
     Re: Perl (filter newlines & replace with space) (Rodney Mach)
     perl -e 'getpwuid 555;' ---> syntax error ? <buck@genetics.uiowa.edu>
     Re: Seraching Large Files (Jahwan Kim)
     Re: Site Management Tool With File Locking? (Tim  Smith)
     Re: Spawning asynchronously on NT 4.0: Win32::Spawn()? (Reinoud van Leeuwen)
     Syslog.pm problems in Linux <cwg-spambegone@pobox.com>
     Re: Syslog.pm problems in Linux (Mike Stok)
     Re: Telnet perl script for Netware Web Server <106076.446@compuserve.com>
     Updating dates of recurring events <allenjs@nic.techops.lmco.com>
     Re: URL verification (Abigail)
     Re: Year 2000 compliance <upsetter@zip1.ziplink.net>
     Re: Year 2000 compliance (Mike Stok)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 19 May 1997 17:24:20 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: $% argument prototype.
Message-Id: <33808CC4.2D09@world.northgrum.com>

Abigail wrote:

> [...]
> sub fetch_table ($%) {
>     my $dbh  = shift or confess "No database handle";
>     my %args = @_;
>     ... Lots of stuff ...
>     wantarray ? @rows : [@rows];
> }
> 

> [... This fails -- fetch_table's %args is empty:]
> 
> sub fetch_cell (@) {
>     (fetch_table @_) [0] -> [0];
> }

> [... This works:]
> 
> sub fetch_cell (@) {
>     (fetch_table shift, @_) [0] -> [0];
> }

> [...] Why is this? Does the $% as parameter list of fetch_table force
> @_ to be evaluated in a scalar context?
> [perl5.003, etc.]

Yes.  From the perlsub man pages:

	An argument represented by $ forces scalar context.
-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: 19 May 1997 19:17:36 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: array of arrays
Message-Id: <slrn5o19qg.nk0.bill@granite.sover.net>

In article <33797A7A.371F@iil.intel.com>, Allon Henig wrote:
>Hi ,
>	is it possible to build an array of arrays like:
>
>	@Array1= ('a','b','c');
>	@Array1= ('x','y','z');
>	push (@BIGARRAY,@Array1);
>	push (@BIGARRAY,@Array2);	
>
>	now, how do I print $BIGARRAY[0] data (which ofcourse must be:
>		'x' 'y' and 'z') ???
>
>			Thanks, 	Allon

   Your code won't work, as you probably already know, but what you are 
trying to do is possible with Perl 5.  Read up on references, and if you 
have access to the man pages, check out perlref and perllol.

						Bill
-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.


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

Date: 19 May 1997 19:49:40 GMT
From: jot.mar97@tmp.medtronic.com (Jot Powers)
Subject: Breaking on single line conditional blocks in the debugger
Message-Id: <5lqask$isf$1@gazette.corp.medtronic.com>

Perhaps this is a feature.  If I have a block that is a conditional that
fails I can't break on the line.  However, if I move the contents of the
block (and, please excuse me if I'm munging the nomenclature) to a
separate line, I can break on the conditional.  Here is my code:

$bob = 1;
if ( $bob == 0) {print "Bob: $bob\n";}
if ($bob == 0) {
        print "Bob: $bob\n";
}
if ($bob == 1) { print "Bob: $bob\n";}

And here is me in the debugger:

node127% perl -wd bug.pl
main::(bug.pl:3):       $bob = 1;
  DB<1> l
3==>    $bob = 1;
4:
5:      if ( $bob == 0) {print "Bob: $bob\n";}
6:
7:      if ($bob == 0) {
8:              print "Bob: $bob\n";
9:      }
10:
11:     if ($bob == 1) { print "Bob: $bob\n";}
12:
  DB<1> c 5
Bob: 1
node127% perl -wd bug.pl
main::(bug.pl:3):       $bob = 1;
  DB<1> c 7
main::(bug.pl:7):       if ($bob == 0) {
  DB<2> c 11
main::(bug.pl:11):      if ($bob == 1) { print "Bob: $bob\n";}
  DB<3> c
Bob: 1

So, if I try to do a continue to line 5, it never bothers stopping.  However,
if I continue to line 7 (which has the same conditional) it does stop.   
Additionally, continuing to line 11 (a single line conditional/block that is
true) will also stop.

I've looked in perldebug, dejanews and the fAQ
Oh, here are the details:
node127% perl -v
 
This is perl, version 5.003 with EMBED
        built under solaris at Oct 16 1996 14:39:16
        + suidperl security patch

node127% uname -a
SunOS node127 5.5.1 Generic sun4u sparc SUNW,Ultra-1

Answers to either the newsgroup or email will both be read.  (I'll even, *gasp*
summarize to the group, if there is enough demand)

-Jot
-- 
Jot Powers  jot.mar97@tmp.medtronic.com
Unix System Administrator, Medtronic Micro-Rel
"Subtlety is the art of saying what you think and getting out of the way
before it is understood."




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

Date: 19 May 1997 21:05:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Breaking on single line conditional blocks in the debugger
Message-Id: <5lqfak$598$2@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jot Powers
<jot.mar97@tmp.medtronic.com>],
who wrote in article <5lqask$isf$1@gazette.corp.medtronic.com>:
> Perhaps this is a feature.  If I have a block that is a conditional that
> fails I can't break on the line.  However, if I move the contents of the
> block (and, please excuse me if I'm munging the nomenclature) to a
> separate line, I can break on the conditional.  Here is my code:
> 
> $bob = 1;
> if ( $bob == 0) {print "Bob: $bob\n";}
> if ($bob == 0) {
>         print "Bob: $bob\n";
> }
> if ($bob == 1) { print "Bob: $bob\n";}
> 
> And here is me in the debugger:
> 
> node127% perl -wd bug.pl
> main::(bug.pl:3):       $bob = 1;
>   DB<1> l
> 3==>    $bob = 1;
> 4:
> 5:      if ( $bob == 0) {print "Bob: $bob\n";}
> 6:
> 7:      if ($bob == 0) {
> 8:              print "Bob: $bob\n";
> 9:      }
> 10:
> 11:     if ($bob == 1) { print "Bob: $bob\n";}
> 12:

As you see, this is not what you printed above.  I copy this to the
current debugger, and it lists:

1==>    $bob = 1;
2 
3:      if ( $bob == 0) {print "Bob: $bob\n";}
4 
5:      if ($bob == 0) {
6:              print "Bob: $bob\n";
7       }
8 
9:      if ($bob == 1) { print "Bob: $bob\n";}

Note that the breakable lines are marked by ':'. Line 5 is breakable,
and line 6 is breakable.  From this one can easily see that the line 3
should have TWO breakable points.  When you print

>   DB<1> c 3

the debugger will pick up one of them.  As you can guess now, it picks
the later one, thus one inside the (false) conditional.

Ilya


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

Date: Mon, 19 May 1997 13:28:31 -0700
From: Eric Chiu <echiu@netscape.com>
Subject: Building WWW Databases using perl/CGI
Message-Id: <3380B7EF.80C9364A@netscape.com>


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

I'm looking for suggestions on building
web database applications using perl/CGI.

Does anyone have experience with DBI:DBD,
oraperl, or similar tools that they can share?

Thanks!

Eric Chiu

--------------3F396036F2CEAB38BB03FE78
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML><BODY>

<PRE>I'm looking for suggestions on building&nbsp;
web database applications using perl/CGI.</PRE>

<PRE>Does anyone have experience with DBI:DBD,&nbsp;
oraperl, or similar tools that they can share?</PRE>

<PRE>Thanks!</PRE>

<PRE>Eric Chiu
</PRE>


</BODY>
</HTML>

--------------3F396036F2CEAB38BB03FE78--



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

Date: Mon, 19 May 1997 21:22:27 -0700
From: Tim Coates <106076.446@compuserve.com>
Subject: Re: Clearing a Form when using the Back Button
Message-Id: <33812703.55A7@compuserve.com>

Timothy Lux wrote:
> 
> Hi:
> 
> I noticed when visiting Webcrawler's add a site option that after the
> submission was processed, I (like many) click the back button rather than
> following any links. When I did, the form I used to submit the information was
> cleared.
> 
> I have been trying to do this on our forms for quite a while--especially to
> prevent getting duplicate submissions by users going back and forth. Can
> anyone help point me in the direction of where to find how to do this?
> 
> Help much appreciated--
> 
> Thanks,
> Timothy Lux
> luxt@gvsu.eduI would imagine you could do something in the HTML of the form to set the 
INPUT TEXT boxes to '' when the document is loaded?

	Tim


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

Date: 19 May 1997 20:55:45 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Clearing a Form when using the Back Button
Message-Id: <5lqeoh$h2m$1@neocad.com>

Timothy Lux (luxt@gvsu.edu) wrote:
: I have been trying to do this on our forms for quite a while--especially to 
: prevent getting duplicate submissions by users going back and forth. Can 
: anyone help point me in the direction of where to find how to do this?

Sure...I'll point you towards the comp.infosystems.www hierarchy
of newsgroups.  I suspect you'll find an answer from
c.i.w.authoring.cgi
c.i.w.authoring.html

or something...

Jeff

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Mon, 19 May 97 19:37:14 GMT
From: tkolsen@bosox.demon.co.uk (Tony K. Olsen)
Subject: Del/Sort Flat Text File - Advice Requested
Message-Id: <864070702.4666.0.nnrp-4.c2de345e@news.demon.co.uk>

Hi Everyone,

     I am working with a semi-colon delimited text file that 
exists as a flat file database.  It contains 7 fields with the
first field being a part number id.  I manipulate the data via 
HTML forms etc. to update the data and then to create a HTML
formatted webpage consisting of tables organized by groups of
part numbers.  This all works fine but I need a little advice
on a couple of things I would like to do with this.

     I have created an HTML form that I use to delete a part
number from the flat file but I was wondering is there a simple
method of deleting a 'record' other than:


$form_part_id = $FORM{part_id}; # etc.

# open files etc.

while (<IN>) {
  chop;
  ($field1,$field2,$field3,$field4,$field5,$field6,$field7) = split(/;/);
  if ($field1 ne $form_part_id) {
    print OP "$field1,$field2..$field7"; # etc.
  }
}

# close files etc.
# rename IN to IN.bak
# rename OP to IN

     Any advice greatly appreciated.  Also is there a way in perl
to sort this file on the first field without relying on the unix
system sort?

     TIA.  Please cc to my email address as well if you could please
due to server News busy problems.  Cheers.


       ___
      (_B_)__
     ~(@ @)~
+-oOOo-(_)-oOOo-------------------------------------------------+
| "I played before the greatest fans in baseball, the Boston    |
| fans, and I know what you're going to say about that: Old     |
| Teddy Ballgame loved those fans, all right." --- Ted Williams |
+----------------+----------------------------------------------+
| Tony K. Olsen  | URL:   http://www.bosox.demon.co.uk          |
| Cheltenham, UK | Email: mailto:tkolsen@bosox.demon.co.uk      |
+----------------+----------------------------------------------+


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

Date: 19 May 1997 19:44:19 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Del/Sort Flat Text File - Advice Requested
Message-Id: <5lqaij$o2e@fridge-nf0.shore.net>

Tony K. Olsen (tkolsen@bosox.demon.co.uk) wrote:

:      I am working with a semi-colon delimited text file that 
: exists as a flat file database.  It contains 7 fields with the
: first field being a part number id.  I manipulate the data via 

Why do all this when there's the nice, Sprite.pm module laying
around?

Hope this helps!

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 19 May 1997 14:04:23 -0700
From: Eric Tashchian <flash@integration.adnc.com>
Subject: Form Submitions to a database
Message-Id: <3380C057.529D0CF7@integration.adnc.com>

    I am buliding a web front to a database for a friend using SQL on an
NT machine.  One of the pages will have aform submission that is for
parts and its infomation. It is a table with rows and collums, each row
a different part and discription. The trouble is that I can't get the
HTML to see each row in the form as a different submission with out
putting a submit button after each entry.  Dose anyone know of a perl
program/script that can take all the form info and then split it so it
will submit the one row to the SQL database  at a time? Any help or
suggestion of where to look or some sample code would greatly help. I
just started using perl and I am still new to it.    Thanx in advance.



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

Date: Mon, 19 May 1997 15:21:39 -0600
From: cwyatt@cris.com
Subject: Getting File Size
Message-Id: <864072575.454@dejanews.com>

The UNIX command is 'du + filename'.  However, I'm not one to want to make
a lot of system specific calls.  Is there a manner in Perl to echo back a
given file's size?

Thanks!

Chuck Wyatt

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


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

Date: 19 May 1997 21:26:41 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Getting File Size
Message-Id: <5lqgih$q4r@news-central.tiac.net>

In article <864072575.454@dejanews.com>,  <cwyatt@cris.com> wrote:
>The UNIX command is 'du + filename'.  However, I'm not one to want to make
>a lot of system specific calls.  Is there a manner in Perl to echo back a
>given file's size?

Check out the file test operators in the documentation (perlfunc)

  $file = '/boot/vmlinuz';
  if (-f $file) {
    $size = -s _;
    print "$file is $size bytes\n";
  }

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 19 May 1997 20:24:06 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Help: How to Split a file at a Null Line???
Message-Id: <tcyangEAG3C7.4Jy@netcom.com>

This seems to be a better idea.  However, if there are more than
one empty line in the input file, say

---
lines 1-13

lines 14-35

lines 36-87

lines 88-90
---

Will your program leave lines 1-13 in 'file1' and lines 88-90 in
'file2' and skip over lines 14-35 and 36-87?

(Of course for the original question, it is O.K. if we know for sure
there is only one empty line in the file)

===================================================
Tad McClellan (tadmc@flash.net) wrote:

: #! /usr/bin/perl -w

: open(OUT, ">file1") || die "could not open file1  $!";

: while (<>) {
:    if (/^$/) {  # found an empty line
:       # open() below does an implicit close(OUT) first
:       open(OUT, ">file2") || die "could not open file2  $!";
:       next;
:    }
:    print OUT;
: }

: close(OUT);

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.clever.net/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Mon, 19 May 1997 21:03:11 -0700
From: Tim Coates <106076.446@compuserve.com>
Subject: Re: How I change the Perl version of Novell Intranetware 4.11 ?
Message-Id: <3381227F.6DB9@compuserve.com>

Sergio Stateri Jr wrote:
> 
> Hi! The company where I work buy the Novell 4.11 (Intranetware). I'd like
> to know if it's possible to change the version of Perl language (that run
> in the Web server of Novell Intranetware). I'd like to do this because I
> know the Perl language of Unix/Windows NT, and the Novell's Perl has too
> many "unsupported functions" that I'd like to use... Thanks!!
> 
> --
> -------------------------------------------------
>    Sergio Stateri Jr
>    e-mail: serginho@usa.net
> -------------------------------------------------If the version you want is perl V5 then the new Novell Web server V3 now 
out (in Beta?) has this, otherwise I think you're out of luck


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

Date: Mon, 19 May 1997 19:07:55 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Mellinger <melling@panix2.panix.com>
Subject: Re: if string in list ??
Message-Id: <Pine.GSO.3.96.970519190659.12414L-100000@kelly.teleport.com>

On 19 May 1997, Michael Mellinger wrote:

> Is there a simple way to determine if a value is in a list?  I figure
> that this should be a one liner.

Yes, and the line is in the FAQ. :-)  You can also get it in this group by
looking back a little ways, since we just went through this about five
days ago. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 19 May 1997 20:50:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: inclu-OR in regex
Message-Id: <5lqeeb$598$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Randal Schwartz 
<merlyn@stonehenge.com>],
who wrote in article <8caflreh0s.fsf@gadget.cscaper.com>:
> >>>>> "Ilya" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
> >> : /a/ && /b/ && /c/;
> >> 
> >> <pedantic>That's not a regex.</pedantic>
> 
> Ilya> But this is:
> 
> Ilya> 	/^(?=.*a)(?=.*b)(?=.*c)/s;
> 
> And this one would be faster:
> 
> 	/^(?=.*?a)(?=.*?b)(?=.*?c)/s;

Hmm, did you _actually_ try this?  Non-greedy regexps are
_much_much_much_ slower than the greedy ones...  I would use
	/^(?=[^a]*a)(?=[^b]*b)(?=[^c]*c)/;
for speed...

Ilya


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

Date: 19 May 1997 01:51:29 GMT
From: "Simon Kitching" <simonk@telebusiness.co.nz>
Subject: Re: local in list contex?
Message-Id: <01bc63f7$c9aa1490$cbe824ca@simonk>



Jonathan C. Willeke <jwilleke@ix.netcom.com> wrote in article
<337c04bb.13809934@nntp.ix.netcom.com>...
> Consider the following Perl code fragment:
> 
>     local @list = ( 0, 1, 2, 3 );
>     local @array[@list] = ( "I'm", "just", "a", "bill" );
>     print "@array\n";

Point #1:
The index to an array is always a scalar. Therefore in "@array[@list]",
@list is evaluated in a scalar context. A list/array evaluated in a scalar
context returns the number of elements in the array.
Therefore the second line of program above is equivalent to:

local @array[4] = (....) # declare an array, and set its fourth element

Point #2:
The value of any element in an array is *always* a scalar. If you want to
store a list/array as an element in another list/array, you store a
*reference* to it. In the second line of the example program, the left side
of the assignment is a SCALAR, therefore the right-hand-side of the
assignment must evaluate to a scalar. The expression ("im", "just", "a",
"bill") is not building a list. It is four completely independent
expressions, separated by commas (see comma operator) and coincidentally
surrounded by parentheses. The comma operator always evaluates all of the
expressions, then returns the left-most one.
If the LHS of the assignment happened to be an array, then the RHS of the
assignment would be evaluated as an array, not a list of comma-separated
expressions and this would work as you expected. Perl's "principle of least
surprise" does not appear to be working well here..

Try replacing the last list of the program with this:
print join("+", @array); # prints +++I'm


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

Date: Mon, 19 May 1997 16:27:41 -0700
From: "Webmaster(SB)" <kwire@icsi.net>
Subject: Need Help with Perl Script Implementation for e-Mail .HTM Form
Message-Id: <3380E1ED.3BA@icsi.net>

I am a rookie who just created our company Web page.
In order to focus received e-mail (instead of "mailto:")
I downloaded a Perl Script "FORMMAIL.PL" from Matt's Script
 Archive at "http://www.worldwidemart.com/scripts/".
I created an .HTM file containing a FORM which POSTs 
to FORMMAIL.PL.  I followed all MSA's documentation 
instructions, then FTP'd the .HTM file and the 
Perl Script (renamed to FORMMAIL.CGI) to my ISP's server.

When I complete the form it seems to work fine.  However, 
when I click the SUBMIT button, I get a response as follows:

---------------------------------------------------------------------
  Server Error

  The server encountered an internal error or misconfiguration and 
  was unable to complete your request.

  Please contact the server administrator, webmaster@kwire.com and 
  inform them of the time the error occurred, and anything you might 
  have done that may have caused the error. 
---------------------------------------------------------------------

I'm sure there's a problem with the .CGI script, but I am not a Unix or
Perl expert and need some help.  Can somebody help?
My ISP is actually or faking ignorance of PERL.

Any help will be greatly appreciated.


Scott Baer    kwire@icsi.net


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

Date: 19 May 1997 19:54:47 GMT
From: rmach@botta.engin.umich.edu (Rodney Mach)
Subject: Re: Perl (filter newlines & replace with space)
Message-Id: <5lqb67$dov@srvr1.engin.umich.edu>

Jonas Thvrnvall (labah@algonet.se) wrote:
: Hello!
: I wonder if someone could tell me how to filterout newlines and replace
: with space, the message is submitted from a form comments field.
: I've tried with this code but it does'nt seeme to work.
:    $value =~ tr/\n/ /;
: Should  i replace \n with hexcode or what? 

: Jonas T

--

I had a similar problem, what I ended up doing that worked was the following:

(s/^\n$//g);

Don't ask me why you have to anchor the \n with the ^ and $ to match it,
but it worked. I just found this out just now cause I have to do something
similar.

Don't know why your example didn't work, I tried it, even setting $* to 1
and various other stuff, I could only get a match when anchoring the \n
to the beginning and end of line, course you may need a chop for you to
catch the eol \n you don't want. 
 
-rod



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

Date: 19 May 1997 21:09:58 GMT
From: Buck Huppmann <buck@genetics.uiowa.edu>
Subject: perl -e 'getpwuid 555;' ---> syntax error ?
Message-Id: <5lqfj6$jmq@flood.weeg.uiowa.edu>

I admit that I haven't read everything at www.perl.com, but I didn't really
know how to go about tracking this down.  And, admittedly, I'm not by anyone's
standards a programmer, but I'm curious nevertheless:  As a simplest case
(i.e., w/o regard for the pathological futility for the moment):

	$ perl -we 'getpwnam "foo";'

	Number found where operator expected at -e line 1, near "getpwuid 555"
		(Do you need to predeclare getpwuid?)
	syntax error at -e line 1, near "getpwuid 555"
	Execution of -e aborted due to compilation errors.

whereas--as I've seen in all the sample code--

	$ perl -we 'getpwuid ("foo");'

	Useless use of getpwuid in void context at -e line 1.

as expected.  So why isn't `getpwuid' getting parsed correctly in the first
instance and/or how does that change in the second?  I mean, I vaguely remem-
ber the declaration that, "If it looks like a function, then it is." from
the Camel book, but I have no idea why it isn't looking like a named unary
operator w/o the parens and think that I, regrettably, need a tutor.

Sorry again if this is obvious, but, as I said, I'm no programming over-
achiever, but I'll retire early and content if somebody will help me to figure
this out.  Thanks for your time

(FWIW, perl 5.002 for now)

--
Buck Huppmann


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

Date: 19 May 1997 21:14:53 GMT
From: jahwan@supernova.math.lsa.umich.edu (Jahwan Kim)
Subject: Re: Seraching Large Files
Message-Id: <slrn5o1gmd.qv4.jahwan@supernova.math.lsa.umich.edu>

On Fri, 09 May 1997 08:29:41 -0400, Tom Lynch <toml@synnet.com> wrote:
[snip]
> while (<VER>){
>     chop;
>     @y = $_;
>     @y = split;
>     while (($vkey,$vvalue) = each %signal) {
>         if (/$vkey/){
>           $vtmp = "$y[1] $vkey $vvalue";
>           push(@vline, $vtmp);
>         }
>     }
> }
> 
> 
>         This works, but it's slow. Is there a better way to
>         do this type of search? I know about $signal{$_}++
>         but only the key will be in the line and it could
>         be anywhere except the first three columns. Thanks
>         for any help in advance!
> 
>         Tom
    Wouldn't it be faster to use 'eq' comparison instead of m//, if
that's what you want? 

@all_vkeys = keys %signal;
while(<VER>) {
    @_ = split chop;
    shift; $y1 = shift; shift; 
    OUTER: foreach $vkey (@all_vkeys) {
        foreach (@_) {
	    if ( $vkey eq $_ ) {
	        $vtmp = "$y1 $vkey %signal{$vkey}";
		push(@vline, $vtmp);
                last OUTER;
	    }
	}
    }
}

Jahwan


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

Date: 19 May 1997 12:11:29 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Site Management Tool With File Locking?
Message-Id: <5lq8l1$qff@web.azstarnet.com>

In article <5lq5jt$fkk$1@news.wco.com>, Anthony Boyd  <anthony@wco.com> wrote:
>Does anyone know of an existing Perl script that will let users ask for a
>HTML file, return the file, flock it, and then unlock when it it sent
>back?  Preferably the interface would be via HTTP, but that's not
>necessary.  I could modify it.

flock() probably won't work too well - as soon as the script that
creates the lock quits the lock is lost.  Probably you'll want to use
an actual lock file of some sort, or perhaps a DB of currently locked
files:

$reg = LockRegistry::open_registry($reg_db);
if ($lockinfo = $reg->is_locked($file_name)) {
    die "File $file_name is locked by ", $lockinfo->user,
	' at ', $lockinfo->time, ' (PID ', lockinfo->pid, ")\n";
}

$reg->lock($file_name, $ENV{'HTTP_USER'}, time(), $$);
$reg->close_registry();

Just one idea of how to do it...I don't know of any LockRegistry
though.

Tim



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

Date: Mon, 19 May 1997 21:29:25 GMT
From: reinoud@xs4all.nl (Reinoud van Leeuwen)
Subject: Re: Spawning asynchronously on NT 4.0: Win32::Spawn()?
Message-Id: <3381c5f3.494250@news.xs4all.nl>

On 19 May 1997 17:07:08 GMT, tmorrow@us.oracle.com.removethis (Tom
Morrow) wrote:

>
>On Windows95 I used to use start.exe to spawn programs asynchronously
>using Win32::Spawn().  I would specify the full path to the spawn.exe
>in the call to Win32::Spawn(), so it would run start.exe as the
>executable.
>
>But this doesn't work now that I am on Windows NT 4.0; I cannot find
>start.exe anywhere on my hard disk, so I can't give its full pathname
>to Win32:Spawn().  Even though 'start' still works from the MS-DOS
>command line on NT, there is no start.exe to launch with
>Win32::Spawn().
>
>So has anyone found a way to spawn asynchronously from a perl script on
>NT 4.0?

I think the start command is a build-in command in the CMD.exe command
interpreter... Could you use a call like "cmd /c start
c:\dirname\myprogram.exe"?

__________________________________________________
Reinoud van Leeuwen       reinoud@xs4all.nl
http://www.xs4all.nl/~reinoud
I specifically DO NOT give anyone permission to use my email adress
for any commercial or non commercial mailings. I will bill everyone 
who sends me this kind of mail for wasting my time. Under Dutch law, 
people who don't let me know they disagree with such a bill are obliged 
to pay it.
Attention: remove extra anti-spam info at end of reply adress 


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

Date: Mon, 19 May 1997 16:15:59 -0400
From: chris <cwg-spambegone@pobox.com>
Subject: Syslog.pm problems in Linux
Message-Id: <3380B4FF.150E@pobox.com>

Hey.. I'm having a great deal of difficulty in getting the
Syslog.pm module to work.  No matter what I try, (and I have both
copied the sample code from the man page and the blue camel book),
Syslog.pm will not write to the system log.

Has anyone gotten Syslog.pm to work?  I'm stumped.

thanks,
chris


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

Date: 19 May 1997 21:19:24 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Syslog.pm problems in Linux
Message-Id: <5lqg4s$pcn@news-central.tiac.net>

In article <3380B4FF.150E@pobox.com>, chris  <cwg-spambegone@pobox.com> wrote:
>Hey.. I'm having a great deal of difficulty in getting the
>Syslog.pm module to work.  No matter what I try, (and I have both
>copied the sample code from the man page and the blue camel book),
>Syslog.pm will not write to the system log.
>
>Has anyone gotten Syslog.pm to work?  I'm stumped.

Someone else on this group suggested using -r recently as Syslog.pm uses
sockets (AF_INET), and this seems to be supported by my system's syslogd
man page: 

       -r     This  option  will  enable  the facility to receive
              message from the network using an  internet  domain
              socket  with  the syslog service (see services(5)).
              The default is to not receive any messages from the
              network.

              This  option  is  introduced  in version 1.3 of the
              sysklogd package.  Please  note  that  the  default
              behavior  is  the  opposite  of  how older versions
              behave, so you might have to turn this on.

I't possible to check whether this type of question has been asked before
if you have web access - try searching at http://www.dejanews.com using
some keywords like Syslog.pm linux

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Sun, 18 May 1997 18:13:40 -0700
From: Tim Coates <106076.446@compuserve.com>
Subject: Re: Telnet perl script for Netware Web Server
Message-Id: <337FA944.2628@compuserve.com>

Nathan V. Patwardhan wrote:
> 
> Tim Coates (106076.446@compuserve.com) wrote:
> 
> : In the documentation, socket is supported by this perl interpreter, any
> : suggestions?
> 
> Why not use the Net::Telnet module?  I have no idea if this works on
> NT/95, but I've had success with Linux/FreeBSD/SUNOS4/Solaris.
> 
> --
> Nathan V. Patwardhan
> nvp@shore.netDo I need perl V5 to do this, cos that's not the case. Although it is 
with the beta version of Novell's Web Server V3 I believe.

Thanks anyway

	Tim


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

Date: Mon, 19 May 1997 13:29:56 -0700
From: Jay Allen <allenjs@nic.techops.lmco.com>
Subject: Updating dates of recurring events
Message-Id: <3380B844.6E04@nic.techops.lmco.com>

Hi all,

	Need a bit of help here.  I have a list of events with initial dates
and frequencies of occurance.  I need to write a perl script to update
the next event date once the date is past.

	I've got the comparison of dates done, so that leaves my question:  Has
anyone written a script to do this?

For example,

Name		
Meeting #1	4/15/97		Monthly on 3rd Thursday of each month
Meeting #2	4/16/97		Weekly on Mondays
Meeting #3	4/18/97		Monthly on the 18th

	My script has recognized that all of these dates are old, so it needs
to generate dates for the next meeting.  How do I do such a thing
considering that months have not only a different amount of days, but
also, for instance, a different amount of Thursdays.

	I know it's possible and probably been done, so I don't want to have to
reinvent the wheel.  If anyone has any suggestions as to where to start
or look, I'd appreciate the input.  Thanks!

  -j-
---------
Jay Allen
allenjs@nic.techops.lmco.com
ICYRA-Internet Coordinator
Lockheed-Martin - Web Page Lead
The Maxim Group - Sr. Programmer/Analyst
(w) (310) 727-1086
(h) (562) 433-7727


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

Date: Mon, 19 May 1997 19:26:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: URL verification
Message-Id: <EAG0oB.H8p@nonexistent.com>

On Mon, 19 May 1997 15:58:41 GMT, Niksun wrote in comp.lang.perl.misc
URL: news:3380787f.9527234@news.inetw.net:
++ Is there a way to find out (through Perl) if a URL location is valid
++ and points to a page?  If so, what is the Perl code for this?


$ perl -wlMLWP::UserAgent -e 'request LWP::UserAgent (new HTTP::Request HEAD => shift) -> is_success and print "Valid";' URL


Works for me.


LPW is your friend. Get LWP.


Abigail


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

Date: 19 May 1997 19:11:48 GMT
From: Scratchie <upsetter@zip1.ziplink.net>
Subject: Re: Year 2000 compliance
Message-Id: <5lq8lk$roj$3@kayrad.ziplink.net>

A. Deckers <I-hate-cyber-promo@man.ac.uk> wrote:

: Not unless you use Perl to create one. The date and time functions
: supplied with perl (gmtime and localtime) supply adequate information
: to determine the year well beyond 2000 (2038 is when trouble strikes).

Forgive me for asking (since it's not in the FAQ) but how then do you deal
with the year 2038 problem? (Assuming you're not on a 64-bit machine by
then).

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

Date: 19 May 1997 21:06:51 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Year 2000 compliance
Message-Id: <5lqfdb$oh3@news-central.tiac.net>

In article <5lq8lk$roj$3@kayrad.ziplink.net>,
Scratchie  <upsetter@zip1.ziplink.net> wrote:
>A. Deckers <I-hate-cyber-promo@man.ac.uk> wrote:
>
>: Not unless you use Perl to create one. The date and time functions
>: supplied with perl (gmtime and localtime) supply adequate information
>: to determine the year well beyond 2000 (2038 is when trouble strikes).
>
>Forgive me for asking (since it's not in the FAQ) but how then do you deal
>with the year 2038 problem? (Assuming you're not on a 64-bit machine by
>then).

Maybe we'll all be using NT by then?

Mike 1/2 :-)

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

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 500
*************************************

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