[6881] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 506 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 21 05:05:54 1997

Date: Wed, 21 May 97 02: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           Wed, 21 May 1997     Volume: 8 Number: 506

Today's topics:
     Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "u (peter hakanson)
     Anyone using perl5.004 ? <tschardt@mfg.sgi.com>
     Re: Anyone using perl5.004 ? <rra@stanford.edu>
     Re: CGI.pm (Alan Stewart)
     Error handling in Sybperl <eusrocky@exu.ericsson.se>
     File Exsists & get all files <lauri@nettipaja.clinet.fi>
     Re: Help in Removing lines with duplicate Field Ones <simonk@telebusiness.co.nz>
     Re: Help in Removing lines with duplicate Field Ones (Tad McClellan)
     Re: Help in Removing lines with duplicate Field Ones (Mark Mills)
     Re: How would you optimize this ugly script? (Bek Oberin)
     Re: Ingres data on the Intranet <j.l.bateson@dl.ac.uk>
     Install module in local directory -- HOW? (Brian Lavender)
     New Perl User Question <troy@pop.uni.edu>
     New warnings in perl 5.004. (Abigail)
     NT Perl limitations... permanent? (Bob Shair)
     NTPerl - sendmail.pl <wkyetman@ingr.com>
     Re: Patch to Perl 5.004 for case-insensitive patterns ( (Mike Stok)
     Re: piping and user input (Mike MacKenzie)
     Re: Regular expression problem (Bek Oberin)
     saving to a file from perl (Killer2345)
     script optimization of grep -c (Eric Finley)
     Re: script optimization of grep -c (Nathan V. Patwardhan)
     SEGV from hash declaration (Felix Morley Finch)
     Split function (Greg)
     Re: System Administration <flg@vhojd.skovde.se>
     Re: Time stamping with perl (Clay Irving)
     Too many instances of perl.exe at once! <customdesign@nstate.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 21 May 1997 07:53:22 GMT
From: peter@cyklop.volvo.se (peter hakanson)
Subject: Re: > 2GB "file too large", AIX 4.2, perl 5.001, not "ulimit"
Message-Id: <5lu9li$3tj@nike.volvo.se>

Sorry to disappoint anyone who thinks 32 bits are enough to
lseek() big files :-)

As perl tries to move around it keeps track of currect
position. Whan current position can no longer be expressed
in an "int" strange things happens.
Redefining offset & value of lseek() to quad (as done in
bsd4.4) does not help unless the application knows how
to manipulate both intergers as a unit. 

These kind of problems is simular to what happend when machines
grew from 16 bits to 32. 

In this case perl seems to use a signed int, so it starts
getting trouble a little early.

But if this application is run on a big machine (wordsize 64bits)
then perl would happily access larger files.

So as summary, anything running on 32bits hw has limitations.
Whats so strange about that ???

peter h


Thomas Parker (thpr@vnet.ibm.com) wrote:
: Sorry to disappoint anyone out there who dislikes AIX, 
: but AIX 4.2 handles up to 64G files.  I agree with Kent's suggestion
: (since edited out...) of trying to compile PERL on a 4.2 machine.

: TP.

: peter hakanson wrote:
: > 
: > Kent,
: > if You have read the original post then you understand
: > WHY aix4.2 (or any 32 bit machine has this limitation)
: > 
: > peter h
: > --
: > <peter.devnull@cyklop.volvo.se> (remove ".devnull" before use!)
: > Peter Hakanson  VolvoData Dep 2580 phone +46 31 66 74 27

: -- 
: Thomas Parker
: thpr@vnet.ibm.com  x6-4673 (TIE 446)

--
Unsolicited commercial/propaganda email subject to legal action.  Under US
Code Title 47, Sec.227(a)(2)(B), Sec.227(b)(1)(C), and Sec.227(b)(3)(C), a
State may impose a fine of not less than $500 per message.  Read the full
text of Title 47 Sec 227 at http://www.law.cornell.edu/uscode/47/227.html

<peter.devnull@cyklop.volvo.se> (remove ".devnull" before use!)
Peter Hakanson  VolvoData Dep 2580 phone +46 31 66 74 27


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

Date: Tue, 20 May 1997 19:09:05 -0700
From: Timothy Schardt <tschardt@mfg.sgi.com>
Subject: Anyone using perl5.004 ?
Message-Id: <33825941.41C6@mfg.sgi.com>

Hello all,


  Anyone using the latest perl 5.004 ?

  If so, is there any problems with previous versions of
  perl.

  Made perl 5.004 running on IRIX 6.2.

 ... Tim

-- 

 Another small fluke in life that I get.
 Give it to Tim, he likes it ;-)


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

Date: 20 May 1997 19:23:23 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Anyone using perl5.004 ?
Message-Id: <m3yb99zhpg.fsf@windlord.Stanford.EDU>

Timothy Schardt <tschardt@mfg.sgi.com> writes:

>   Anyone using the latest perl 5.004 ?

Yes, I've been using it since a few hours after it was released, and we
have it installed site-wide at Stanford.

>   If so, is there any problems with previous versions of perl.

Read man perldelta for the list of incompatibilities, bug fixes, and other
changes.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Tue, 20 May 97 23:41:58 GMT
From: astewart@nosc.mil (Alan Stewart)
Subject: Re: CGI.pm
Message-Id: <5ltct4$qqc@poisson.nosc.mil>

Wrap the logic in an eval and drop the print...don't need it inside another 
print...the eval returns another list item to table().  If your conditions are 
more complex, you might have to use different quoting of the eval. See edit 
below.

In article <MPG.dea79b42e57df0f989681@hermes.is.co.za>,
   drheeder@bcs.co.za (Dirk Rheeder) wrote:
>How do I insert logic in the middle of a table when using CGI.pm.
>
 ..

print $cgi->table({-width=>'500',
	      	     -border=>'3',
		     -cellspacing=>'0',
		     -cellpadding=>'5',
		     -bgcolor=>'#C0C0C0'},
						 
		     $cgi->Tr(
                   $cgi->td({-colspan=>'4' -align=>'center'},"data")),
	
		     $cgi->Tr(
		     $cgi->td('Course No.'),
		     $cgi->td('Course'),
		     $cgi->td({-align=>'center'},'Symbol'),
		     $cgi->td({-align=>'center'},'Mark')),

------------>eval q(
                   if ($test = test)                 #This won't work.
		     {                                 #If I take the if 
----------->                   $cgi->Tr(               # out then works 
			        $cgi->td('Dirk'));      # fine.
		     )
------------>     )
	);									

----------------------------------------------------------
 Alan Stewart          )-[]-(           Electronics Engr
 Code D621           ~        ~         Network Support
 NCCOSC RDTE Div    ~          ~  \     U.S. Navy SATCOM
 53560 Hull St   ( ~            ~  )    tel (619)524-3625
 San Diego,CA  __|___             /|    fax (619)524-2607
 92152-5001   ^\____/^^^^^^\    __| |_  astewart@nosc.mil
-------------^^^^^^^^^^^^^^^\__|______|_------------------


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

Date: Tue, 20 May 1997 09:32:09 -0500
From: Rocky Johnson <eusrocky@exu.ericsson.se>
Subject: Error handling in Sybperl
Message-Id: <3381B5E9.FF6D5DF@exu.ericsson.se>

I have been working with Sybperl for ~4 months now and I have what I
thought to be a simple problem.  

If the database I am connecting to is not available, I want to catch the
error and try agian later.  The datbases are in Sweden and Australia,
and they have been know to 'disappear' from time to time for various
reasons.  As it stands, when you can't connect, the application exits,
period.  I have tried eval blocks, callback routines, message handlers,
and forked processes.  

The only sucess I've had is with the forked process, with that I can
catch the invalid password error, but that is relativly meaningless, I
know my password, and that error is not an issue.

If anybody has any thoughs on how to catch these errors elegantly or
not, I don't care.  Thanks in advance.

-- 
Rocky Johnson
rocky@ericsson.com


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

Date: Tue, 20 May 1997 14:58:12 +0300
From: Lauri Laakso <lauri@nettipaja.clinet.fi>
Subject: File Exsists & get all files
Message-Id: <338191D4.6D73@nettipaja.clinet.fi>

1) How I can check if file Exsists ?

2) How I can get all files in directory to @files() for reading them.

(Prefer email, in other case I may miss it)

 ....................................................................
   Lauri Laakso - Nettipaja - GSM: 358+40-588 8889 [EMAIL2GSM]
 http://www.nettipaja.clinet.fi/ - mailto:lauri@nettipaja.clinet.fi


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

Date: 21 May 1997 04:11:04 GMT
From: "Simon Kitching" <simonk@telebusiness.co.nz>
Subject: Re: Help in Removing lines with duplicate Field Ones
Message-Id: <01bc659d$a0a61100$cbe824ca@simonk>

> 
> Purpose:   Keep only those records in the file which have a UNIQUE
> 	   field #1.

Try this:

%KeysFound = (); # initialise an associative array
for each line in file:
{
  $key = field 1 of line
  if (not exists(%KeysFound{$key})) # has key been seen before?
  {
     # first occurrence of key, so remember it
    %KeysFound{$key} = undef; # RHS of assignment can be any dummy value
(including undef)
    output line
  }
}
 


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

Date: Tue, 20 May 1997 22:47:27 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help in Removing lines with duplicate Field Ones
Message-Id: <f8rtl5.ub4.ln@localhost>

Guest Account (guest@blueline.east.sun.com) wrote:
: Input file has fixed length, 132 byte records, each with 8 fields.

: Purpose:   Keep only those records in the file which have a UNIQUE
: 	   field #1.

: 	   Duplicates may occur on more than two lines (i.e., field
: 	   one of record 6 may match field one of record 21, 98, 2110,
: 	   and 65535.  Regardless of the number of duplications, ALL
: 	   duplicate lines must be cleaned from the file. 

: Field 1:   Alternates between numeric only, alpha only, or alpha-numeric
: 	   values.  

: I have ended up doing this in C because I couldn't figure out if perl could
: handle it.  Can someone tell me a Perl solution?  I sincerly appreciate it.


You don't say how to break out field #1. I'll assume it is the first
ten characters.


while (<>) {
   $key = substr($_, 0, 10);
   $uniq{$key} = $_;
}

foreach (keys %uniq) {
   print $uniq{$_};
}


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


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

Date: Wed, 21 May 1997 07:05:48 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: Help in Removing lines with duplicate Field Ones
Message-Id: <33829cd5.15229492@news.ntr.net>

On Tue, 20 May 1997 22:47:27 -0500, tadmc@flash.net (Tad McClellan)
wrote:

>Guest Account (guest@blueline.east.sun.com) wrote:
>: Input file has fixed length, 132 byte records, each with 8 fields.
>
>: Purpose:   Keep only those records in the file which have a UNIQUE
>: 	   field #1.
>
>: 	   Duplicates may occur on more than two lines (i.e., field
>: 	   one of record 6 may match field one of record 21, 98, 2110,
>: 	   and 65535.  Regardless of the number of duplications, ALL
>: 	   duplicate lines must be cleaned from the file. 
>
>: Field 1:   Alternates between numeric only, alpha only, or alpha-numeric
>: 	   values.  
>: I have ended up doing this in C because I couldn't figure out if perl could
>: handle it.  Can someone tell me a Perl solution?  I sincerly appreciate it.
>
>You don't say how to break out field #1. I'll assume it is the first
>ten characters.
>
>while (<>) {
>   $key = substr($_, 0, 10);
>   $uniq{$key} = $_;
>}
>foreach (keys %uniq) {
>   print $uniq{$_};
>}
>    Tad McClellan                          SGML Consulting

Nope, that won't do it.  He said keep ONLY UNIQUE lines...

while (<>) {
   $key = substr($_, 0, 10);
   $uniq{$key}[0]++;
   $uniq{$key}[1]=$_;
}
foreach (keys %uniq) {
   print $uniq{$_}[1] if ($uniq{$_}[0] ==1);
}

Should do the trick.  Unless of course he wanted those lines in the
SAME order that he put them in, minus duplicates of course.  That'd
take a few more lines. :>

--
Mark <mark@ntr.net>
Zaphod Beeblebrox: Hey, Ford! How many escape capsules are there?
Ford Prefect: None.
Zaphod Beeblebrox: You counted them?
Ford Prefect: Twice.


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

Date: 21 May 1997 06:36:43 GMT
From: gossamer@glasswings.com.au (Bek Oberin)
Subject: Re: How would you optimize this ugly script?
Message-Id: <slrn5o55tm.57f.gossamer@amarok.glasswings.com.au>

In article <5lt44g$lpi@winter.erols.com>, Craig Schenk wrote:
>I have been tasked with working on an internal system at the ISP where I work.
>This system is a suite of perl scripts (with a CGI front end) that is supposed
>to automate domain name registration and setup of the domains on our web
>servers and other places. The problem is that the back-end script which
>pulls new sales into the system doesnt always work.

Oh look.  I refused to do his work for him on #perl last week,
so he's gonna ask the newsgroup to do it for him instead.

How about you ask a specific question if you're stuck with 
something - does it work?  What's wrong with it?  What does
'doesn't work' mean?  What errors does it generate?  Where'd 
you put printfs?  What happens if you 'use strict' or use 
'perl -w'?  


cordially,
gossamer




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

Date: 21 May 1997 06:56:30 GMT
From: "John Bateson" <j.l.bateson@dl.ac.uk>
Subject: Re: Ingres data on the Intranet
Message-Id: <01bc65b4$2b99ce30$62504f94@rdvig>

What about the CA product attached to Ingres ICE and Spyglass?

John Bateson

Bruce Irvin <rbirvin@usgs.gov> wrote in article
<EA9x20.LIw@igsrsparc2.er.usgs.gov>...
> In article <5lcbkg$6l0$1@bilbo.reference.com>,  <deepa@ril.com> wrote:
> >
> >We have huge databases on Ingres. We wish to put some
> >web applications which will be able to query the Ingres
> >database.
> >
> >Can anyone make any suggestions.
> >We are using the Apache Web Server. Using perl extensively
> >for CGI development.
> 
> 
> DBI and DBD-Ingres can also be used for accessing an Ingres database.  
> Both are available from the CPAN sites.  I've been using that for the 
> past two months, and Ingperl for the past two years to access our 
> project's database and make data available for intranet use.
> 
> 
> 
> Bruce Irvin
> 
> 
> Disclaimer: This is not an official endorsement of a product, nor is it 
> the USGS's position on database access or anything else.  It's just what 
> has worked for this database admin at this site.
> 
> 
> 
> 


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

Date: Wed, 21 May 1997 08:27:03 GMT
From: brian@brie.com (Brian Lavender)
Subject: Install module in local directory -- HOW?
Message-Id: <3382a6a8.6611735@nntp.netcruiser>

I would like to install a module to a local directory, namely msqlperl
1.11. In addition I would like to install a few others the same way .
I have often seen the default installation instructions for installing
a module.

perl Makefile.PL
make
make test
make install

This of course installs the module to the perl library directory. I
don't have access there. I would like to install the module in another
directory. Say,

/usr/dom/xbrie/brian/perl/lib/perl5

I looked at the msqlperl version 1.17 of msqlperl and it has the
following instructions for installing the module in a local directory.
Actually it is a shell script. 

#!/bin/sh

for L in /usr/dom/xbrie/brian/Minerva /usr/dom/xbrie/brian/Hughes ; do
echo ------------------------------------
echo Configuring for $L
echo ------------------------------------
perl Makefile.PL INSTALLSITELIB=$L/perl INSTALLSITEARCH=$L/perl \
INSTALLSCRIPT=$L/bin
make
done

Of course I don't have perl 5.003 to make version 1.17 happen, so I
have to make version 1.11 happen as I would like to make other modules
happen in a local directory. I modified the above shell script as
below and tried to adopt it for version 1.11 of msqlperl.

#!/bin/sh

for L in /usr/dom/xbrie/brian ; do
echo ------------------------------------
echo Configuring for $L
echo ------------------------------------
perl Makefile.PL INSTALLSITELIB=$L/perl INSTALLSITEARCH=$L/perl \
INSTALLSCRIPT=$L/bin
make
done

At the end of this post is the output when I tried to run the script.
I don't understand the output too well so I inspected to verify the
module had been installed. It had not. Should this same script be
applicable to version 1.11? Now I also looked at libwww-perl version
5.008 and it gives the following instruction for installing in a local
directory.

perl Makefile.PL PREFIX=~/perl
make
make test
make install

Should this be universally applicable or is this specific to the
makefile.PL?  Is there a simple fix for installing a module in a local
directory? 

Thanks

Brian
----------------
Brian Lavender
Brie Web Publishing
Owner
Napa, CA
(707) 226-8891

Brie Business Directory - Napa Valley      http://www.brie.com/bbd 


Referece output follows

brie.com$ ./script
------------------------------------
Configuring for /usr/dom/xbrie/brian
------------------------------------
Checking if your kit is complete...
Looks good
 
Where is your msql installed? Please name the directory that contains
the subdirs lib/ and include/. [/usr/local/Hughes]
/usr/dom/xbrie/brian/Minerva
'INSTALLSCRIPT' is not a known MakeMaker parameter name.
Writing Makefile for Msql
        umask 0 && cp lib/Msql.pm ./blib/lib/Msql.pm
AutoSplitting Msql (./blib/lib/auto/Msql)
        umask 0 && cp lib/Msql/Statement.pm
/blib/lib/Msql/Statement.pm
        /usr/local/bin/perl -I/usr/local/lib/perl5/IP22-irix/5.002
-I/usr/local/li
b/perl5 /usr/local/lib/perl5/ExtUtils/xsubpp  -typemap
/usr/local/lib/perl5/ExtUti
ls/typemap -typemap typemap Msql.xs >Msql.tc && mv Msql.tc Msql.c
        cc -c -I/usr/dom/xbrie/brian/Minerva/include -D_POSIX_SOURCE
-ansiposix -D
_BSD_TYPES -Olimit 3000 -DLANGUAGE_C -O -DVERSION=\"1.11\"
-DXS_VERSION=\"1.11\"
-I/usr/local/lib/perl5/IP22-irix/5.002/CORE  Msql.c
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.002/CORE/perl.h, line
1342: Syntax Er
ror
 extern   sigjmp_buf    top_env ;
 --------------------   ^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.002/CORE/perl.h, line
1342: Empty dec
laration specifiers (3.5)
 extern   sigjmp_buf    top_env ;
 --------------------   ^
*** Error code 1 (bu21)


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

Date: Tue, 20 May 1997 14:56:57 -0500
From: "Troy Bull" <troy@pop.uni.edu>
Subject: New Perl User Question
Message-Id: <5lsvm0$pbr@news.uni.edu>

I am new to perl and I have a question.
I am trying to write a perl program that will open a file, search for a
word, then return the next word in the file and write the output to yet
another file.

input:
the quick brown fox jumped over the brown
box quickly

if the "word" were brown the output would be
inputfilename : fox
inputfilename : box

Please help
thanks
Troy
--
----------------------------------------------------------------------
Troy Bull | University of Northern Iowa | troy.bull@uni.edu

The 2 most common elements in the universe are hydrogen and stupidity.
---------------------------------------------------------------------- 




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

Date: Wed, 21 May 1997 03:53:22 GMT
From: abigail@fnx.com (Abigail)
Subject: New warnings in perl 5.004.
Message-Id: <EAIIsz.MFJ@nonexistent.com>


I've noticed that perl 5.004 is a lot pickier than perl 5.003.

In general, I don't have much problem with that, but:

   - It complains if you my a variable which is already defined
     in the same scope. I'm not really sure if that should issue
     a warning, but it ought to be quiet if you don't use -w.
     (Yes, I know you should, but my predecessor wasn't capable
      of producing code that didn't generate pages of warnings).

     Now I have a bunch of scripts that'll scare the hell out of
     people tomorrow morning (and I don't even know where all those
     scripts are...).

   - If you do perl -c on a file that starts with
     '#!/usr/local/bin/perl -wT' it'll whine "Too late for -T now"
     and stop. Urgh. How I am supposed to do a syntax check
     now other than actually executing the file or removing the
     -T switch (with the danger to forget it to put back in when
     moving it to common area)?



Abigail


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

Date: 21 May 1997 02:25:20 GMT
From: rmshair@uiuc.edu (Bob Shair)
Subject: NT Perl limitations... permanent?
Message-Id: <5ltmeg$ipd@vixen.cso.uiuc.edu>

I've a client trying to move some applications written
in Perl to NT.  The NT Perl interpreter we've found,
Perl-Win32 at activeware.com, seems to be missing a 
number of features we've been using in OS/2, of which
the most important is fork(!).  

Is this a temporary restriction?  This could be a 
show-stopper! (yeah, break my heart, it would, NOT) 
-- 
Bob Shair                          Open Systems Consultant
1018 W. Springfield Avenue         rmshair@uiuc.edu
Champaign, IL 61821		   217/356-2684
< Not employed by or representing the University of Illinois >


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

Date: Tue, 20 May 1997 18:44:21 -0700
From: "Warren Yetman" <wkyetman@ingr.com>
Subject: NTPerl - sendmail.pl
Message-Id: <01bc6578$442e57e0$a4578781@n12827>

Hi ,

  Can you tell me where I can get the sendmail.pl and any associated files;
 my Web search is uneventfull.  Thank you.

- Warren
email: wkyetman@ingr.com


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

Date: 21 May 1997 01:28:20 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Patch to Perl 5.004 for case-insensitive patterns (REFCASE1)
Message-Id: <5ltj3k$738@news-central.tiac.net>

In article <slrn5o4e25.ldh.ljz@ljz.asfast.net>,
Lloyd Zusman <ljz@asfast.com> wrote:
>Could anyone recommend a version of the 'patch' program which will
>properly apply this patch?  The linux (Gnu) and the Solaris versions
>of 'patch' that I have both choke on this.

[mike@localhost perl5.004]$ uname -a
Linux localhost.localdomain 2.0.27 #8 Wed May 7 16:49:22 EDT 1997 i586
[mike@localhost perl5.004]$ ls -l
total 2418
-rw-r--r--   1 mike     mike      2456796 May 16 01:54 perl5.004.tar.gz
-rw-rw-r--   1 mike     mike         6978 May 20 21:26 refcsae.patch
[mike@localhost perl5.004]$ gunzip -c perl5.004.tar.gz | tar xf -
Broken pipe
[mike@localhost perl5.004]$ cd perl5.004
[mike@localhost perl5.004]$ patch -p1 -N < ../refcsae.patch
[...]
Patching file regexec.c using Plan A...
Hunk #1 succeeded at 826.
Hunk #2 succeeded at 840.
Hmm...  Ignoring the trailing garbage.
done
[mike@localhost perl5.004]$ find . -name '*.rej' -print
[mike@localhost perl5.004]$ patch -v
Patch version 2.1

This is a redhat 4.1 system.

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: Tue, 20 May 1997 17:30:40 -0500
From: mmackenz@indiana.edu (Mike MacKenzie)
Subject: Re: piping and user input
Message-Id: <mmackenz-ya02408000R2005971730400001@news.indiana.edu>


This worked fine.

Thanks,
Mike
In article <pzn2pu9j13.fsf@eeyore.ibcinc.com>, Roderick Schertler
<roderick@argon.org> wrote:

> On Fri, 16 May 1997 12:48:49 -0500, mmackenz@indiana.edu (Mike MacKenzie)
said:
> > 
> > The problem I'm having is that once standard input is redirected to
> > receive the mail message piped to it from elm, I can't get the script
> > to switch back to accept input from the keyboard.
> 
> Read from /dev/tty directly.
> 
>     @message = <STDIN>;
>     open STDIN, '/dev/tty' or die "Can't read /dev/tty: $!";
> 
> -- 
> Roderick Schertler
> roderick@argon.org


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

Date: 21 May 1997 06:27:48 GMT
From: gossamer@glasswings.com.au (Bek Oberin)
Subject: Re: Regular expression problem
Message-Id: <slrn5o55d0.57f.gossamer@amarok.glasswings.com.au>

(alt.fan.e-t-b?  i'll assume that's just for you to find followups
and leave it there :))

Eli the Bearded wrote:
>Pascal Houde  <houde@fox.cisti.nrc.ca> wrote:
>>$input =~ s/(A\sHREF|\sSRC\sACTION)="\/*([^"]+)"/$1="myPgm?$2"/gis;
>>Basically I want to take whatever inside the quotes and precede a
>>program name to it.
>>EXCEPTED that I don't want to do the search & replace if there's a
>>"mailto:" or a "http:..." inside the HREF (or ACTION).
>>So <A HREF="relative_link"> will become <A HREF="myPgm?relative_link">
>>but <A HREF="mailto:josblo"> will stay the same.

>$input =~ s,                # comma instead of / for clarity
>            (A\sHREF|\sSRC\sACTION)=" # stuff we must match
>            /*                        # zero or more slashes (why?)
>            (?!mailto:)               # lookahead for no mailto:
>            (?!http:)                 # lookahead for no http:
>            ([^"]+)                   # grab this
>            "                         # ending match text
>           ,                # begin substitution part
>            $1="myPgm?$2"             # the new text
>           ,gsix;           # Global, Single-line, Ignore case, eXtended

Excuse me for being dim (it's my best act :)  but could you explain the
lookaheads?  It's not something I've come across before and not in my
(old) Camel - another Perl5 extension?  I would have also expected the
secondlast line to end with $4 instead of $2 but I'll assume that's part
of the same explanation..


gossamer




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

Date: 20 May 1997 22:21:24 GMT
From: killer2345@aol.com (Killer2345)
Subject: saving to a file from perl
Message-Id: <19970521022100.WAA07390@ladder02.news.aol.com>

Does anyone know the syntax for writing to a file using Macperl?

Thanks!


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

Date: 20 May 1997 23:35:46 GMT
From: ez041407@chip.ucdavis.edu (Eric Finley)
Subject: script optimization of grep -c
Message-Id: <5ltcgi$l3m$1@mark.ucdavis.edu>

I frequently have to do a "grep -c <word> <file>" on very large (~100Meg)
files and wrote this script to hopefully do it faster, grep take >5 min.
Is there any way to optimize this code?
#!/usr/intel/bin/perl -w
open(FILE, $ARGV[1]) || die "Could not open $ARGV[1]\n$!\n";
$i = 0;
while(<FILE>) {
    $i++ if (/$ARGV[0]/)
}
print "$ARGV[0] found $i times in $ARGV[1]\n"

Any help would be appreciated.
Thanks,
Eric Finley



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

Date: 20 May 1997 23:47:19 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: script optimization of grep -c
Message-Id: <5ltd67$3ar@fridge-nf0.shore.net>

Eric Finley (ez041407@chip.ucdavis.edu) wrote:
: I frequently have to do a "grep -c <word> <file>" on very large (~100Meg)
: files and wrote this script to hopefully do it faster, grep take >5 min.
: Is there any way to optimize this code?

Does this help you out?

perl -e '@lines = grep(/pattern$/, <>); print $#lines+1,"\n";' filename

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 21 May 1997 05:13:33 GMT
From: felix@crowfix.com (Felix Morley Finch)
Subject: SEGV from hash declaration
Message-Id: <slrn5o519i.5jc.felix@crowfix.com>

I've got a perl program which causes a segmentation violation under
certain conditions.  I built a debug-enabled 5.003_093 (?) and tracked
it down to the following stack trace under gdb:

	*0	Perl_pp_substr () at pp:1382
	*1	0x41f78 in Perl_runops () at run.c:56
	*2	0x1e1fc in perl_run (sv_interp=0xa6008) at perl.c:566
	*3	0x1cf68 in main (argc=0, argv=0xeffffc84, env=0xeffffc90) at perlmain.c:49

The code at pp:1382 is

	tmps = SvPV(sv, curlen)

with sv = 0 and curlen = 4.  I checked a bit further and came to the
conclusion that sv is a pointer and should NOT be null.  Further
investigation might be interesting, but I just haven't got the time
right now, and will be investigating a workaround instead.  Work work
work! that's my boss's motto :-).

Now on to the program itself.  This is where I am most puzzled.  It is
a web program with 3 setup screens, among which the user wanders in no
particular order, and eventually clicks the "Go" button to get
results.  I am using the CGI.pm save feature, whereby the fatal POST
input data is saved to a file, and the particular instance of the
program I am using to track this down reads this saved state back in.
The program is 1560 lines long, and I don't quite know what I can cut
out to reduce this to a simple case.  I will certainly try off and on,
but as I said above, if I can find an easy workaround, it will be back
burner.

Here is a summary of the code:

--------------------------------------
 ....some init code...

$query = new CGI(CGISAVE);

#print undef;

%help = ('xyzzy' => "plugh",
	 'plugh' => "xyzzy",
	...
	);

#print undef;

 ....more code...
--------------------------------------

The %help hash is the killer, as far as I can tell.  It has 48 entries
in it, some of them perhaps a thousand characters or more,
concatenated with strings returned from subroutine calls, etc.  As it
is, I get the segmentation violation.  Comments out two lines (not
just one) and the program runs fine.  The keys and values make no
difference, nor does positioning.

See those two commented-out undef prints?  If the first one executes,
I get a complaint about use of an uninitialized variable.  If only the
second one is enabled, I get the segmentation violation.  It's got to
be in the hash somewhere.

It might be fun to spend several days tracing thru the interpreter to
see what's going on, but that's not likely to strike my boss's fancy.
Is there a guide to debugging Perl itself, not Perl code?  Has anyone
got some useful suggestions?  I suspect that it is not a Perl bug so
much as something bizarre I am doing, but I think I may have to find
my evil doings by tracing thru Perl.

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
      Felix Finch, scarecrow repairer, rocket surgeon / felix@crowfix.com
            PGP = 9D 93 1E 78 5B D7 42 1C   95 4E 9E DD 3F 6F 21 98
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


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

Date: 20 May 1997 17:45:09 -0700
From: galoi@sdcc13.ucsd.edu (Greg)
Subject: Split function
Message-Id: <5ltgil$4ah@sdcc13.ucsd.edu>

I am new to perl and am a little confused as to how the split
functin works.  In particular I am trying to spilt up a string by
the characters / and : and by whitespace.  I have not found a nifty
way to do this.

						-greg-
					      galoi@sdcc13.ucsd.edu


-- 

								       later
								      --greg--


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

Date: 21 May 97 06:03:36 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: System Administration
Message-Id: <01bc65ac$bd9a0820$e20f10c2@odens.di.vhojd.skovde.se>

Joco Paulo Gongalves <bfe2141@mail.telepac.pt> wrote 
> I want to know in what tasks can perl help in the system administration.

I use Perl for lots of different stuff. Here are some things i use Perl for
on
our Unix system:

* Adding chunks of new users. As the administrator in an educational
environment
   there are lots of new users to be added every semester.

* Extracting information from various logfiles, and analysing it.

* Various "watch" processes that checks the status of our various servers
   Like making sure they are up and responding.

* Managing our webserver. It involves script that checks the html sources 
   and also correcting some common errors.

I also uses Perl in DOS/Windows/Novell environment for similar tasks.

There are also numerous oneliners and onetimers constructed on the fly
on a daily basis.

Thanks to Larry and all other for making my life easier! :-)

/Fredrik


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

Date: 20 May 1997 22:53:58 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Time stamping with perl
Message-Id: <5lto46$p28@panix.com>

In <338210AD.5920@wind-river.com> Nicholas Hardgrove <nickh@wind-river.com> writes:

>Can anyone tell me how to get a time stamp from the system so that I can
>add it into database info that I am working on?

Could it be as easy as:

  $timestamp = localtime();

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Tue, 20 May 1997 23:29:16 -0700
From: TRG Custom Graphics <customdesign@nstate.net>
Subject: Too many instances of perl.exe at once!
Message-Id: <3382963C.1254@nstate.net>

I need some advice on what to do about this. I am running a multi forum
chat site, and it's calling to the perl.exe everytime!.. is there any
ISAPI type solution?. Something to where I can only run one instance and
not have it keep reloading?. This would solve about 80% of my problems
with the hundreds of thousands of hits I get daily!.. Thanks.,.
Tim..
customdesign@nstate.net


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

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

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