[10122] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3715 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 14 22:29:07 1998

Date: Mon, 14 Sep 98 19:00:22 -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, 14 Sep 1998     Volume: 8 Number: 3715

Today's topics:
    Re: Catching signals in subroutines and living... <garry@america.net>
        Copying hashes and arrays <ff@otis.arraycomm.com>
    Re: finding out yesterdays date <jeffp@crusoe.net>
        FreeBSD, Apache, mod_perl guru needed (Nick Tonkin)
        Getting NTFS Directory structure size (Victor A. Cuya)
        getting number of elements in multiple dimensions <ed@connectexpress.net>
    Re: getting number of elements in multiple dimensions (Andre L.)
    Re: getting number of elements in multiple dimensions (Larry Rosler)
    Re: Gratuitous warning: Deep Recursion <hansmu@xs4all.nl>
        help with perl reg. expr. david@ceres.ca.gov
    Re: Hidden Input Types and Quote Marks (Abigail)
    Re: Hidden Input Types and Quote Marks (Darren Hayes)
    Re: How do I use cgi locally using Netscape? (Abigail)
    Re: HTTP-Proxy written in Perl - Possible? How? (Abigail)
    Re: Net::FTP on NT4 <jdw@dev.tivoli.com>
    Re: Perl & Java - differences and uses <fsg@newsguy.com>
    Re: Perl & Java - differences and uses (Sam Holden)
    Re: Perl & Java - differences and uses <metcher@spider.herston.uq.edu.au>
    Re: PERL and Updating files mmesmer@yahoo.com
    Re: PERL and Updating files <tchrist@mox.perl.com>
    Re: PERL routine using wtmp? <sneaker@sneex.fccj.org>
    Re: PERL routine using wtmp? (Alan Barclay)
    Re: regex help (David A. Black)
    Re: Registration Script artbell9926@my-dejanews.com
    Re: selective split (Mark-Jason Dominus)
    Re: selective split <ajohnson@gpu.srv.ualberta.ca>
    Re: selective split (Brock Sides)
    Re: Sending E-mail from Prel CGI in on NT4 <chrisre@ecpi.com>
        Solaris 2.5 build error <tcraig1@umbc.edu>
    Re: SSI Problem (Sunni Leigh)
    Re: STD I/O for WIN32 Perl <murrayb@vansel.alcatel.com>
    Re: Who posts original posts on CLPM? (Asher)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 15 Sep 1998 01:05:38 GMT
From: Garry Williams <garry@america.net>
Subject: Re: Catching signals in subroutines and living...
Message-Id: <35FDBDAC.30CDDB14@america.net>

Chris, signals are delivered asynchronously and signal handler routines
are entered asynchronously.  Try just setting an indicator in the
handler and checking that it was set at particular places in your main
code.  Also, note that signal delivery in perl is "unreliable" due to
*potential* internal inconsistencies in perl's data structures due to
the asynchronous nature of the mechanism.  If you do much more than set
a switch indicating that the signal was delivered, you will invite
unpredictable (bad) behavior like segment exceptions.  

-Garry Williams 

Chris N. Hinds wrote:
> 
> I need to know how to catch a signal (in this case, SIGPIPE)
> from within a subroutine and exit this routine *and* its
> caller back to a loop construct, then exit that to another
> loop.
> 
> Here it is graphically:
> 
> A: for(...) {
>         B: while(...) {
>                 /.../ && do {&C; next B; }
>         }
> }
> 
> sub C {
>         &D ;
> }
> sub D {
>         caught the SIGPIPE
> }
> 
> In the SIGPIPE handler, I want to return from D, return from
> C, last B, and next A.
> 
> I have so far:
> 
> $SIG{PIPE} = \&Pipe_Handler ;
> 
> sub Pipe_Handler {
>         print "Caught SIGPIPE... cleaning up\n" ;
>         last B ;
> }
> 
> or, for the 'last B' try 'next A' ... but none of these labels
> are visible inside D (D is the scope of the handler, is it not?)
> I have tried moving the handler inside C, but the 'return' applies
> to the trap handler, not to C.
> 
> How does one do this?
> 
> Thanks!
> 
> chris
> 
> --
> *********************************************************
> * Chris N. Hinds     <><                  512-314-1055
> * ARM Austin Design Center           FAX  512-314-1078
> * ARM INC                          chris.hinds@arm.com
> *********************************************************


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

Date: Mon, 14 Sep 1998 21:34:32 GMT
From: Farhad Farzaneh <ff@otis.arraycomm.com>
Subject: Copying hashes and arrays
Message-Id: <vulnnmpedz.fsf@otis.arraycomm.com>


Hello,

Suppose I have a structure kept in a hash with the following format:

%a = ( "x" => [1, 2 , 3],
       "y" => [4, 5, 6] );

I would like to make a copy of a, including the data, so that changing the
elements of b will not affect a.  If I just do 

%b = %a;

$b{x}[0] = 9;

print join(',',@{$a{x}}),"\n";

gives

9,2,3

so as expected, because $a an $b have the same references as their keys
values, changing one will change the other.  I would like a copy
constructor that can make independent copies of arbitrary structures and
arrays.  

Question:
  Has anyone written a module that performs a recursive copy so that one get
  independent structures?  I looked at CPAN and did not come up with
  anything. 

--
Farhad Farzaneh


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

Date: Mon, 14 Sep 1998 20:32:08 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: finding out yesterdays date
Message-Id: <Pine.GSO.3.96.980914202556.28375A-100000@crusoe.crusoe.net>

> I have a system that outputs a comma delimited file and then is passed
> to my linux box.  The first field is the date like 09/14/98.  The date
> is actually the next days date since it passes the data at midnight.
> The program has to do this because that's how it works so I can't set
> it to send at 11:59.  I want to be able to reset the dates that are
> sent to one day less.  Is there somthing to do this?  So if the date
> is stamped 09/14/98 I want it to be 09/13/98.  Thanks.

($d,$m,$y) = (localtime(time))[3..5]; # also (localtime)[3..5];
$d = "0$d" unless length($d) == 2;
$m = '0' . ++$m unless length($m) == 2;
$date = "$d/$m/$y";

($d,$m,$y) = (localtime(time-86400))[3..5]; # 86400 = seconds in a day
$d = "0$d" unless length($d) == 2;
$m = '0' . ++$m unless length($m) == 2;
$yesterday = "$d/$m/$y";

Hope that helps.

--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Mon, 14 Sep 1998 23:13:19 GMT
From: nick@valueclick.com (Nick Tonkin)
Subject: FreeBSD, Apache, mod_perl guru needed
Message-Id: <35fda2e4.1043515906@news.sysci.org>

Hi,

We have seven FreeBSD servers running Apache and mod_perl we use as
part of a heavily trafficked (~ 5M requests a day) network. We are
looking for  a VERY expert consultant -- preferably with FreeBSD
and/or Apache core development experience -- to advise us on
optimization of our systems.

Specific concerns we have are potential bottlenecks caused by using
FreeBSD with Apache and *heavy* mod_perl CGI, such as open files
limit, ulimit, processor thread capacity, Fast/Wide SCSI not operating
correctly, etc.

We are also interested in network load balancing solutions and advice
on the overall architecture of our network (currently seven FreeBSD
boxes acting as slaves to a Sun SPARC).

Essentially we need a guru who can whip our machines into shape so
they hummm, baby.

If you have awesome FreeBSD, Apache and mod_perl skills, please let me
know ASAP if you can help or can recommend someone who can.

Thanks,

Nick Tonkin
ValueClick Corp.


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

Date: Tue, 15 Sep 1998 01:03:45 GMT
From: vcuya@mindspring.com (Victor A. Cuya)
Subject: Getting NTFS Directory structure size
Message-Id: <35febb67.2614038@news.mindspring.com>

Does anyone have any idea of how to get a directory size with total
number of files in it with Perl for Win32. I am trying to replicate
the 'Properties' function under Explorer.

I want to avoid doing a File::Find and then getting the information
for each individual file in the tree.

Any suggestions will be greatly appreciated.


Victor A. Cuya
moc.gnirpsdnim@ayucv

No span spoken here. To answer to my e-mail,
reverse the address above.


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

Date: Mon, 14 Sep 1998 15:52:59 -0700
From: ed <ed@connectexpress.net>
Subject: getting number of elements in multiple dimensions
Message-Id: <35FD9E4A.1AC4@connectexpress.net>

Does anyone know how can return the number of elements in a
multiple-element array?

For example: $stuff[4][5] = "dog";

how would you return "5" if that was the last element in the array?

Ed Kelly


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

Date: Mon, 14 Sep 1998 20:15:05 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: getting number of elements in multiple dimensions
Message-Id: <alecler-1409982015050001@dialup-518.hip.cam.org>

In article <35FD9E4A.1AC4@connectexpress.net>, ed@connectexpress.net wrote:

> Does anyone know how can return the number of elements in a
> multiple-element array?
> 
> For example: $stuff[4][5] = "dog";
> 
> how would you return "5" if that was the last element in the array?


$stuff[4] = [a,b,c,d,e];

Number of elements in $stuff[4]    :  scalar @{$stuff[4]} # 5

Index of last element in $stuff[4] :  $#{$stuff[4]}       # 4

Last element in $stuff[4]          :  $stuff[4][-1]       # 'e'

Re: perlref.


Hope this helps,
Andre


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

Date: Mon, 14 Sep 1998 17:49:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting number of elements in multiple dimensions
Message-Id: <MPG.10675974a5b77582989855@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <35FD9E4A.1AC4@connectexpress.net> on Mon, 14 Sep 1998 
15:52:59 -0700, ed <ed@connectexpress.net> says...
> Does anyone know how can return the number of elements in a
> multiple-element array?
> 
> For example: $stuff[4][5] = "dog";
> 
> how would you return "5" if that was the last element in the array?

Amazing -- identical question twice in one day.

$#{$stuff[4]}

worked for the first person who asked :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 14 Sep 1998 23:00:06 GMT
From: Hans Mulder <hansmu@xs4all.nl>
Subject: Re: Gratuitous warning: Deep Recursion
Message-Id: <6tk75m$fa1@news.euro.net>

Martin Gregory <mgregory@asc.sps.mot.com> wrote:

>I am getting this 'deep recursion' warning message, about which
>perldiag tells me:

>     Deep recursion on subroutine "%s"
>         (W) This subroutine has called itself (directly or
>         indirectly) 100 times more than it has returned.  This
          probably indicates an infinite recursion, unless you're
>         writing strange benchmark programs, in which case it
>         indicates something else.

>Isn't it my business how deeply I recurse?

Not entirely: there's a limit to how far your platform allows
you to recurse.  What happens if you reach the hard limit is
platform dependent; typically you get some obscure message,
such as "Illegal instruction -- core dumped".

On most platforms, this hard limit is rahter higher than 100.
Your shell may have a "limit" command built-in, that allows
you to raise or lower the limit to some extent.

>Does this message ever really help anyone,

It does: it helps people who did not intend to recurse.  Such
people usually recurse inifinitely deep.  If it weren't for
this warning; they'd probably never figure out what hit them.

>or does it only hinder people like me who happen
>to have a job that calls for deep recursion and now have to grapple
>with whether to take out -w or placate users about these warning
>messages?

A third option would be to set up a $SIG{__WARN__} handler
to filter out this particular warning.

It would be nice if perl provided a mechnism for selectively
turning off errors.  In fact, such a mechanism is being
considered for inclusion in perl 5.006 (whenever that may be).

Hope this helps,

-- HansM


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

Date: Tue, 15 Sep 1998 00:06:35 GMT
From: david@ceres.ca.gov
Subject: help with perl reg. expr.
Message-Id: <6tkb2b$8on$1@nnrp1.dejanews.com>

Hello
	I was hoping someone out there has a perl script which can do the
following with each entry in a flatfile database. Change each pipe
delimited entry from:

http://html-resources.com| HTML Resources |10-Sep-1998|cgi/misc|Great place
for html resources |

to:
1|HTML Resources|http://html-resources.com|10-Sep-1998|cgi/misc|Great place
for html resources |

The number at the beginning of the entry needs to increment by one for each
entry

Thanks in advance

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 14 Sep 1998 22:55:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Hidden Input Types and Quote Marks
Message-Id: <6tk6s5$kem$1@client3.news.psi.net>

Darren Hayes (darrenh@efn.org) wrote on MDCCCXL September MCMXCIII in
<URL: news:35ff784e.13447935@news.efn.org>:
++ Hello,
++ 
++ The answer for the following question is probably in a FAQ 
++ somewhere but I have yet to find it...
++ 


And what makes you think you find the answer to your non-Perl question
here? You would have more chance of finding your answer in
alt.fan.mickey_mouse.



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


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

Date: Mon, 14 Sep 1998 17:33:14 -0700
From: darrenh@efn.org (Darren Hayes)
Subject: Re: Hidden Input Types and Quote Marks
Message-Id: <3601b3ac.28648104@news.efn.org>

On 14 Sep 1998 22:55:01 GMT, abigail@fnx.com (Abigail) wrote:

>Darren Hayes (darrenh@efn.org) wrote on MDCCCXL September MCMXCIII in
><URL: news:35ff784e.13447935@news.efn.org>:
>
>And what makes you think you find the answer to your non-Perl question
>here? You would have more chance of finding your answer in
>alt.fan.mickey_mouse.

Abigail (is that real name?)-

Thanks for the very helpful response... Sounds like you are related to
a few local system administrators I know of... anyway

The CGI scripts are written in Perl. I was hoping to trap the quote
marks either in the HTML value field before submitting them or in the
Perl script right after the parse. I know I can substitute to a
bizarre character but I would like to be able to maintain the quote
marks integrated in the original text somehow.

Darren



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

Date: 14 Sep 1998 23:05:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How do I use cgi locally using Netscape?
Message-Id: <6tk7gm$kp7$1@client3.news.psi.net>

Chocolate (poohba@io.com) wrote on MDCCCXL September MCMXCIII in
<URL: news:Pine.BSF.4.02A.9809141257460.11912-100000@schultz.io.com>:
++ I am trying to run my cgi scripts locally on my computer before I put the
++ on the net.  How do i make this work.  Which program is best for this?


Why do you ask here? Your entire post is perlfree.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 15 Sep 1998 01:21:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HTTP-Proxy written in Perl - Possible? How?
Message-Id: <6tkfel$lmt$1@client3.news.psi.net>

A. Beckmann (arno@gmx.de) wrote on MDCCCXL September MCMXCIII in
<URL: news:35FD8015.FF96B459@gmx.de>:
++ I need an own HTTP Proxy in some different Unix
++ machines. Is it easily possible with Perl?

It's trivial. use HTTP::Deamon and use LWP::UserAgent.
A handful line of configuration, and a handful lines of getting the
request from one side, and handing it over the other.

50 lines of code.



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


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

Date: 14 Sep 1998 15:52:14 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Net::FTP on NT4
Message-Id: <obaf424dtt.fsf@alder.dev.tivoli.com>


martinjb@cdrompub.demon.co.uk writes:
> I have downloaded the CPAN module libnet so as to instal Net::FTP onto
> my NT4.
> 
> The instructions as to how to use the package seem pretty good for
> Unix users, but NT users are left to their own devices.
>
> I tried moving the relevant .pm files to where I assumed they should
> be, but my compiles still fall over with the message:
> 
> Can't locate Net/Config.pm in @INC 
> 
> But there was no Config.pm in the manifest.
> 
> Any ideas???

when you build/install the "normal" way the file is created
automatically.  Try running perl Makefile.PL and the same make you
used when building perl and installing that way...

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: Mon, 14 Sep 1998 16:42:32 -0700
From: "Felix S. Gallo" <fsg@newsguy.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tk9fo$hvg@enews2.newsguy.com>

The indefatigable George Reese writes:
>Freedom has no place in programming.  Period.

Here we discover the crux of the problem: George Reese
believes that hilariously nonsensical dogma, stated in an
authoritative way, is a feasible substitute for a forebrain.

Here's to the hope that George follows the path of the
truth and the light by boycotting all systems written in
'free' languages, such as Perl, C++, and C.  Of course,
he might have a difficult time surfing the Internet; or,
for that matter, logging on.  Or powering up his computer;
or indeed driving to work.  It may be complex, in fact,
for him to operate his microwave -- and in the event that
that means he's late for work because he couldn't get
his coffee, it'll be very difficult indeed for him to contact
his employer, either via e-mail, the telephone system,
a cab he flags down to the corner, a telegram, a courier
service, a police report, smoke signals (the fire
department might get involved), the postal service,
or skywriting.  So perhaps quitting his job, George will
have to subsist without power, water, temperature
control, sewage service, or mass produced candles,
matches, batteries, flashlights, glow sticks or mail-
ordered lightning bugs.  He obviously can't obtain food
from society, because of the distribution system,
factory automation, packaging, design, and of course
research, development, agriculture, preservatives,
additives, and cash registers (not to mention his own
bank account, checking system, ATM card, credit
card, and cash).  But another dilemma pops up:
all modern weapons are machined and mass-produced
by computer (and here we are again with the design,
packaging and distribution taint).

So George will be living out his programmatically
pure philosophy working out his easily maintainable
python code in dirt with a stick, in between his
desperate attempts to collect enough rainwater to
nourish his stunted seedlings.  When winter comes,
one hopes George has been able to run enough
python in his head to design a sturdy hole in the
ground to huddle in next to his hoard of dessicated
elk meat.  If he is able to survive the winter by
killing enough ground squirrels to fashion a coat
strung together with a sharpened rat's tooth and
wound-up squirrel tendon, he will be able to emerge
stumbling from his hovel, squinting at the glare of
the spring sun, ragged and disheveled, and raise
a bandy fist to shake at the Boeing 757 making a
distant line against the cloudless morning, and
through rotted teeth, curse the horrifically poor
technology that will surely one day fall to the majestic
brilliance of pure languages like python.

Until such a day comes, I hope that George will forgive
those of us who make a living writing code in finite
time with finite resources.  Yes, George, one day the
academics will rise up and overthrow the rancid disease
that is capitalism and the shoddy, dangerous mendacity
that is Perl.  I'm sure it will happen any day now; the
signs are all there, you bet.  But for now, forebearance,
brother!

Felix Gallo
hey, maybe you can get the cabin next to Kaczinski!




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

Date: 15 Sep 1998 01:26:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl & Java - differences and uses
Message-Id: <slrn6vrghd.ko8.sholden@pgrad.cs.usyd.edu.au>

On Mon, 14 Sep 1998 21:43:33 GMT, George Reese <borg@imaginary.com> wrote:
>In comp.lang.java.programmer Zenin <zenin@bawdycaste.org> wrote:
>: George Reese <borg@imaginary.com> wrote:

<snip>

>: : If you are comparing python's use of whitespace with that of a
>: : Makefile, it is you who are evil.  They are nothing alike.
>
>:         They are magic whitespace.  Magic whitespace is evil, in
>:         all forms.
>
>It is evil in Makefiles because Makefile distinguish between
>whitespace and tabs.  Please explain what the issue is with python?

Snippet from a python session :
; python
Python 1.5.1 (#11, Jul  7 1998, 16:34:26)  [GCC 2.7.2.2] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> if 1==1 :
 ...	print "fred"
 ...     print "bill"
inconsistent dedent
  File "<stdin>", line 3
    print "bill"
               ^
SyntaxError: invalid token
>>> if 1==1 :
 ...     print "fred"
 ...     print "bill"
 ... 
fred
bill
>>> if 1==1:
 ...     print "bill"
 ...         print "fred"
 ... 
bill
fred
>>> 

Oh dear, I typed that into my 9term window... 

Silly me! In my non-proportional font I lined things up by tabstop position...
So the first and second examples where lined up but not the last.
(I'm sure it's different for the reader (will depend on tabstop settings)).
So Python just assumed 1 tab == 8 spaces, well sorry it didn't in my
terminal and thus Python didn't work. Cutting and pasting from an 9term seems
to convert tabs to the number of spaces that were used to represent them...
so no copying and pasting sample code from text files, or man pages.

Setting the block structure with invisible characters seems a little hard to
maintain to me. 

The arguments on tabs versus spaces amongst Pythion folks are evidence for that.

Sam

-- 
Sam

Basically, avoid comments. If your code needs a comment to be
understood, it would be better to rewrite it so it's easier to
understand.	--Rob Pike


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

Date: Tue, 15 Sep 1998 11:29:19 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Perl & Java - differences and uses
Message-Id: <35FDC2EF.4D433264@spider.herston.uq.edu.au>

George Reese wrote:
> Natural language is a superset of any computer language I certainly
> have ever programmed in.  That would include both perl and python.  I
> honestly do not know how a computer language could express something
> that you could not express in English--how would you even talk about
> such a thing?
> 

There are a lot of problems that you can't talk about.  A mathematical
discussion often will become quieter as it goes beyond the non-trivial,
until nothing is heard but:

"How about..." <scratching of pencil>
"Yes, but..." <scratching of pencil>
etc.

Physicists have implicitly flagged the futility of trying to translate
quantum mechanics into natural language by the increasing arbitrariness
of the names they use.  Starting from deceptively normal sounding words
like mass and spin (which were really only ever analogies anyway), we
now have truth and beauty, charmed and strange.  And the mathematics is
as (verbally) inarticulate as always.

You talk about programming in natural language depending on a mechanism
to disambiguate natural language.  I think this shows a misunderstanding
of natural language.  *Humans* don't have a mechanism for disambiguating
natural language.  In fact, they have a propensity for *creating*
ambiguity.  Hence the continuing resistance of natural language to
standardization, and the continuing creation of slangs and subculture
dialects.  Put any three teenagers together, and within a week they'll
have a small and growing private vocabulary that nobody else understands
and that they haven't formally defined.

-- 
Jaime Metcher


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

Date: Mon, 14 Sep 1998 23:39:01 GMT
From: mmesmer@yahoo.com
Subject: Re: PERL and Updating files
Message-Id: <6tk9em$6k8$1@nnrp1.dejanews.com>




How could I get perl -pi -e 's/string1/string2/g to replace files down through
my hierarchy.  I want to create a simple mechanism for replacing all files
within /webserver/docs as well as webserver/docs/foo

Mike

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 15 Sep 1998 00:32:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PERL and Updating files
Message-Id: <6tkci2$msj$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    mmesmer@yahoo.com writes:
:How could I get perl -pi -e 's/string1/string2/g to replace files down through
:my hierarchy.  

That's what the find tool was created for.

--tom
-- 
I know I'm a pig-ignorant slut.  --Andrew Hume


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

Date: Mon, 14 Sep 1998 19:50:35 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: PERL routine using wtmp?
Message-Id: <35FDABCB.D171892@sneex.fccj.org>

Elaine -HappyFunBall- Ashton wrote:
> 
> photuris wrote:
> 
> > Does something like that already exist?
> 
> This isn't a Perl question, but you might try Big Brother.
> http://maclawran.ca/bb-dnld/
> 
> e.

True, not a perl question, but here is one way to do it:

#!/usr/local/bin/perl -w

use strict;
use diagnostics;

my $usrID = shift;

my $mailAdmin   = 'root'; # Send Log-On Reports to?
my $mailProject = 'root'; # Responsible for Project?
my $SENDMAIL	= '/usr/lib/sendmail'; # The location of your sendmail
binary...

$| = 1;  # Use unbuffered I/O...

open (MAIL, "| $SENDMAIL $mailAdmin") || 
	die ("$0:  Fatal Error!  Cannot open sendmail: $!\n");

print MAIL "Reply-to: $mailProject\n";
print MAIL "From: 'UserID.Access.Tracking.Server'\n";
print MAIL "To: 'FCCJ.Astro.SysAdmin'\n";
print MAIL "Subject: Access by $usrID\n";
print MAIL "X-Comments: ===== A Message from the $0 application...
=====\n";
print MAIL "SECURITY:  Access to $0 by (real $< )(effective $> )\n";

print MAIL "\n"; # To hide 'event' under X-Comments, comment out line...
print MAIL "UserID: $usrID has logged on \@ ", scalar localtime; # Who
logged in...

print MAIL "\n";
close (MAIL);

1;

# End of code...

In the /etc/profile, write something like:

/!path/to/perl /path/to/script $USER

PS - You may not like using it, it e-mails you everytime
the /etc/profile is read; plus it does not track FTP'er, etc...

Enjoy!
-Sneex- :] 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to 
our own... Your thoughts will adapt to service us...
 ...Resistance is futile...


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

Date: 15 Sep 1998 01:47:16 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: PERL routine using wtmp?
Message-Id: <905824034.558159@elaine.drink.com>

In article <35FD3DE4.CDBCD641@whoever.com>,
Martin C Brown  <mc@whoever.com> wrote:
>I don't have code for monitoring, but heres some very basic code for reading in
>wtmp/utmp entries.
>
>I just wrote it five minutes ago, so expect a few problems.
>
>The only things you'll need to change are the packstring (see the utmp manual
>entry) and ut_types - these values work for Solaris 2.5.1.
>
>----
>
>#!/usr/local/bin/perl5 -w
>
>use strict;
>
>my $packstring = "a8a4a12ssssl";

>    my ($user,$userid,$line,$pid,$type,$eterm,$eexit,$time) =
>unpack($packstring,$rec);


Note that wtmp & utmp are very system dependant. The format that
works on a Linux box won't work on a Solaris system. You will
want to alter the packstring & the fields depending on your
local wtmp format.


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

Date: Mon, 14 Sep 1998 17:53:07 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: regex help
Message-Id: <6tk383$liv$1@earth.superlink.net>

Hello -

Edward Glamkowski <eglamkowski@angelfire.com> writes:

>Actually, I had one suggestion that seems to have worked, using $+
>s/(U\.S\.|P\.O\.)|(\w+)\.)/$+/g;

>Anybody see any problems with this method?


Only a typo (the last ')' shouldn't be there).

It's actually surprisingly (to me) much faster than the one I'd
posted (which was similar but used $1 instead of $+).

I'm a believer :-)


David Black
dblack@saturn.superlink.net


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

Date: Tue, 15 Sep 1998 01:20:37 GMT
From: artbell9926@my-dejanews.com
Subject: Re: Registration Script
Message-Id: <6tkfd5$dpd$1@nnrp1.dejanews.com>

Try this URL:
http://www.cgi-resources.com/Programs_and_Scripts/Perl/Password_Protection/

Two scripts that I saw that may meet some or all of your criteria are Selena
Sol's Password Authorization and Solution Scripts: Access Denied.

Good luck with your site at Hypermart.

Art


In article <35FC5DA7.2BE272CE@jacksonville.crosswinds.net>,
  Tonya <tonya@jacksonville.crosswinds.net> wrote:
> Does anyone know where I can get a freeware registration cgi/perl
> script.
>
> This script would allow users to register their nick and a random
> password would be
> generated and then emailed to their email address.  Users could change
> their password
> via a form.  This would be use for members only areas of a website.
>
> and example:  http://lovecorner.hypermart.net
>
> Thanks in advance!!
> Tonya
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 14 Sep 1998 17:58:13 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: selective split
Message-Id: <6tk3hl$l4r$1@monet.op.net>

In article <35FD2E00.5F5E@astro.obs-mip.fr>,
Oliver Czoske  <oczoske@astro.obs-mip.fr> wrote:
>this should be a very common problem, but as I'm not used to regexps I
>haven't yet found a solution. What I want to do is to split a database
>entry where the fields are separated by ':'. Now, the fields themselves
>may contain colons which are then masked by a backslash. How do I get
>split to split at colons unless they are preceded by a backslash? 

I don't know any way to do it that is both simple and concise.  This
way is concise but not simple:

	$data = 'this:that:contains \: a colon:another::last';
	@fields = ($data . ':') =~ m/((?:.*?[^\\])??):/g;

I forget who invented this nightmare.  Anthony Foiani, maybe.
Extra points for using a nigh-useless ?? operator.

Another possibility is to look at the Text::CSV module and to do
whatever it does.

Another is to look at the FAQ, because that's what this is.



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

Date: Mon, 14 Sep 1998 17:38:36 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: selective split
Message-Id: <35FD9AEC.7A44C190@gpu.srv.ualberta.ca>

Mark-Jason Dominus wrote:
!
! In article <35FD2E00.5F5E@astro.obs-mip.fr>,
! Oliver Czoske  <oczoske@astro.obs-mip.fr> wrote:
! >this should be a very common problem, but as I'm not used to regexps I
! >haven't yet found a solution. What I want to do is to split a database
! >entry where the fields are separated by ':'. Now, the fields themselves
! >may contain colons which are then masked by a backslash. How do I get
! >split to split at colons unless they are preceded by a backslash?
! 
! I don't know any way to do it that is both simple and concise.  This
! way is concise but not simple:
! 
!         $data = 'this:that:contains \: a colon:another::last';
!         @fields = ($data . ':') =~ m/((?:.*?[^\\])??):/g;

well, with perl5.00502, you can have both simple and concise:

        $data = 'this:that:contains \: a colon:another::last';
        @fields = split /(?<!\\):/,$data;

regards
andrew


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

Date: Mon, 14 Sep 1998 18:18:02 -0500
From: opus@magibox.net (Brock Sides)
Subject: Re: selective split
Message-Id: <opus-1409981818030001@dave.magibox.net>

In article <35FD2E00.5F5E@astro.obs-mip.fr>, Oliver Czoske
<oczoske@astro.obs-mip.fr> wrote:

> Hi,
> this should be a very common problem, but as I'm not used to regexps I
> haven't yet found a solution. What I want to do is to split a database
> entry where the fields are separated by ':'. Now, the fields themselves
> may contain colons which are then masked by a backslash. How do I get
> split to split at colons unless they are preceded by a backslash? 
> 
> Thanks for any help.

Well, since I'm sure you've upgraded to 5.005 (you have upgraded to 5.005,
right?), you can use the wonderful addition of "lookbehind assertions":

my @fields = split /(?<!\\):/, $record;

See man (1) perlre for details on lookaheads and lookbehinds.

-- 
Brock Sides opus@magibox.net http://www.magibox.net/~brock/
for(0..4){$humps="."x($_*2+1);$camel.="($humps)"}
"Jtsutona reP reh\nrekcah l"=~/$camel/s;
for(1..5){eval"print scalar reverse \"\$$_\""};


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

Date: Mon, 14 Sep 1998 19:35:58 -0500
From: "Chris Reickenbacker" <chrisre@ecpi.com>
Subject: Re: Sending E-mail from Prel CGI in on NT4
Message-Id: <6tkbda$gn1$1@nntp.smartdna.com>

get yourself a copy of 'sendmail' for NT. open a pipe or do a system call.
You need an app to do the mail transport, perl does not have an automagic
function that just 'sends' your email. Make one using system calls or pipes.
:)

yair schaffer wrote in message <6tjbc1$edd$1@news.netvision.net.il>...
>Hi,
>
>Does anyone know how to
>
>    send mail from Perl CGI on NT4 ?
>
>
>    tanx,
>
>
>    yair.
>
>




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

Date: Mon, 14 Sep 1998 21:31:35 -0400
From: "Tim C." <tcraig1@umbc.edu>
Subject: Solaris 2.5 build error
Message-Id: <35FDC377.DCD4A058@umbc.edu>

I'm trying to get perl 5.005_02 to compile on Solaris 2.5.1.  I go
through the Configure script, and then once I type make, this is the
error I get.

`sh  cflags libperl.so miniperlmain.o` -KPIC miniperlmain.c
          CCCMD =  cc -DPERL_CORE -c -I/usr/local/include -O   
"./perlvars.h", line 21: invalid token: ##
"./perlvars.h", line 21: undefined or not a type: PL_
"./perlvars.h", line 21: syntax error before or at: Gcurinterp
"./perlvars.h", line 21: warning: old-style declaration or incorrect
type for: Gcurinterp

Then the last 4 lines are repeated for quiet some time.

  If anyone has any thoughts on what is causing this, I'd appricate it.

Thanks,
  Tim


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

Date: Sat, 12 Sep 1998 20:41:44 +0000
From: Funkybiz@aol.com (Sunni Leigh)
Subject: Re: SSI Problem
Message-Id: <Funkybiz-ya02408000R1209982041440001@news.wco.com>

In article <35F455E8.DEACE048@freewwweb.com>, Sam Wang
<samwang@freewwweb.com> wrote:

> come to think of it, there is a way to execute a perl prog even if your
IPP bans
> #exec.
> just create a blank gif file. upload it. then make your cgi script's only
output
> as "Content-type: image/gif\n\n" and then the contents of the blank image. (i
> believe you can use open(), then a read(), then print the contents of the
> buffer).
> 
> then in your html doc, put <IMG src="NAME_OF_YOUR_SCRIPT_.pl">
> 
> i suppose the only flaw is that you can put out any output, but i THINK
you might
> be able to do that with SSI #include.
> 
What exactly do you mean, I am pretty new at this so you might need to
write it in Layman's terms.
Thanks Sunni


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

Date: 14 Sep 1998 15:33:48 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: STD I/O for WIN32 Perl
Message-Id: <uvhmql3xv.fsf@vansel.alcatel.com>

steven_elias@ml.com (Stephen Elias) writes:

> myperl.pl < foo-in.txt > foo-out.txt

This sort of thing works for me---what trouble are you having?

-- 
BMurray     "But there is another deep source of conflict built into
SW Analyst   the office  of the ruler....  It is the conflict between
Alcatel      what the public good requires and what the public happens
             to want."   ---Joseph Tussman


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

Date: 15 Sep 1998 00:53:00 GMT
From: asher@magicnet.net (Asher)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <slrn6vre6o.20j.asher@localhost.localdomain>

On Mon, 14 Sep 1998 17:56:54 GMT, Elaine -HappyFunBall- Ashton 
<eashton@bbnplanet.com> wrote:
>Asher wrote:
>
>> Check out:
>> http://www.magicnet.net/~asher/comp.lang.perl.misc.html
>
>Interesting. Where is your protocol and your control for this? What are
Most newsreaders identify themselves via a User-Agent line or equivalent
in the message header.  My program assumes that the newsreader is telling
the truth about its identity.  And most newsreaders identify their
operating system in the same line - the ones that don't are generally
restricted to a single OS (e.g.  WinVN, turnpike, MacSOUP AFAIK) so at
least the general category of OS can be determined.  I hope I understood
your question.
>you endeavouring to prove here? Where is your standard error? e.g. I
>have been using Mozilla (gack) for the last few weeks due to my mungling
>xemacs which I havn't had time to un-mungle. 
I first became interested in this subject when I noticed a certain
type of post coming disproportionately from the Windows environment -
typically the post that says "Hand me everything on a silver platter
right now; my time is valuable!"  This led me to wonder whether Windows
users typically feel a lower inhibitory barrier to posting - an idea
which seems to be born out by the data. Unix users, in contrast, appear
more comfortable helping with someone else's problems, or adding to an
existing discussion.  Obviously, these are gross generalizations and
don't apply well to individuals.

I don't mean any disrespect to Windows users; the Windows users on clpm
have taught me plenty.

The margin of error in the graph is essentially contained in the "Unknown"
bar.  Presumably, most or all of the messages from non-identifying or
unknown newsreaders originated among the operating systems graphed.

Sorry to hear you have to use Moz - after a powerful newsreader, it can
be pretty frustrating.  But how does this connect to the margin of error?
>
>As raw data though, it is curious.
>
>e.
>
>"All of us, all of us, all of us trying to save our immortal souls, some 
>ways seemingly more round-about and mysterious than others. We're having
>a good time here. But hope all will be revealed soon." R. Carver


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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