[9521] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3115 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 10 09:09:00 1998

Date: Fri, 10 Jul 98 06:01:11 -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           Fri, 10 Jul 1998     Volume: 8 Number: 3115

Today's topics:
    Re: -w on production code (was Re: better way of gettin (Bart Lateur)
    Re: -w on production code (was Re: better way of gettin (Bart Lateur)
    Re: -w on production code (was Re: better way of gettin <rra@stanford.edu>
    Re: -w on production code (was Re: better way of gettin (I R A Aggie)
    Re: -w on production code (was Re: better way of gettin (Alan Barclay)
        Arrays (The Wildman)
    Re: Arrays <simonf@conduit.co.uk>
        CGI: PB with NT network <sbecker@ireste.fr>
    Re: Dejanews/closed lists/moderated groups/lists [Was:  birgitt@my-dejanews.com
    Re: Dejanews/closed lists/moderated groups/lists [Was:  <rra@stanford.edu>
    Re: How do you delete arbitrary elements of an array in (M.J.T. Guy)
        Installing Perl5.004_04 (0000)
    Re: need to code a delete function <quednauf@nortel.co.uk>
    Re: new charter and moderator for comp.lang.perl.announ (Honza Pazdziora)
    Re: new charter and moderator for comp.lang.perl.announ (Bart Lateur)
    Re: new charter and moderator for comp.lang.perl.announ (Jeffrey R. Drumm)
    Re: perl 5.004.04 on AIX 4.2.1 (Jeffrey R. Drumm)
    Re: Perl security <quednauf@nortel.co.uk>
    Re: perl-installation eats more than 3 GByte of harddis <knocker@bauwesen.tu-cottbus.de>
    Re: Problem controlling smbclient via perl (Maurizio M. Munafo')
    Re: Question I can't find an answer for. <dlaser@ermine.ox.ac.uk>
    Re: Recognizing BACK and FORWARD button-visits staaldui@my-dejanews.com
        remove the first k lines of a string <uwtools@cse.cuhk.edu.hk>
    Re: remove the first k lines of a string <simonf@conduit.co.uk>
        sending mail from within perl <newsonly@usa.net>
    Re: Silly things to do in Perl (or: is that Laptop wate <quednauf@nortel.co.uk>
    Re: Single vs Double Quotes [was: Re: Abigail - Another (Tad McClellan)
    Re: SQL INFORMIX DATABASE <ljz@asfast.com>
    Re: Trouble with ActiveState - urgent <perlguy@inlink.com>
        trying to compile perl5.004_04 with cygwin32 tos@my-dejanews.com
        UNC Filename Open for Output wilfwilliams@my-dejanews.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Jul 1998 11:07:38 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <35b0f5e5.11682163@news.tornado.be>

Tom Christiansen wrote:

>That would be horrible.  Scripts would lose portability
>if the run-time environment were so unpredictable.

That DON'T make it a compilable option.

But you're not consequent, IMO. You don't mind new warning messages
added with every new version of Perl. That is an unpredictable run-time
environment in my book. And the raison d'jtre of this whole thread.

	Bart.


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

Date: Fri, 10 Jul 1998 11:07:40 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <35aae9c1.8574231@news.tornado.be>

Mike Stok wrote:

>Alan Barclay <gorilla@elaine.drink.com> wrote:
>
>>Why not keep everyone happy, and make a -W option, for no-warnings,
>>and make it a compile time option if -w or -W is the default.
>
>Why not leave it as it is?  People who want warnings can use -w...

Because newbies don't know about -w, while it's the most benificial to
them. Just look at the PODs. I strongly feel that something that should
be used by newbies, ought to be the default.

	Bart.


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

Date: 10 Jul 1998 04:08:35 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <m3r9zuezf0.fsf@windlord.Stanford.EDU>

Bart Lateur <bart.mediamind@tornado.be> writes:

> But you're not consequent, IMO. You don't mind new warning messages
> added with every new version of Perl. That is an unpredictable run-time
> environment in my book. And the raison d'jtre of this whole thread.

If you want a predictable runtime environment, you should hard-code the
version of Perl you're running under into the #! line.

Seriously.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Fri, 10 Jul 1998 07:53:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <fl_aggie-1007980753120001@aggie.coaps.fsu.edu>

In article <ltlnq25xfp.fsf@asfast.com>, Lloyd Zusman <ljz@asfast.com> wrote:

+ This kind of software-development environment is clearly not a good
+ idea from a doing-software-right point of view, but from the long-term
+ dollars-and-cents perspective of the company owners, it sometimes
+ actually works, believe it or not.

And this is an honest business? I would recommend *not* doing business
with them. If they're willing to cut corners on the quality of their
product, I'm sure they'll cut other corners, too.

And given an opportunity to screw you over, they will. As long as it
comes out positive on the bottom line...

James


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

Date: 10 Jul 1998 12:09:34 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <900072560.927975@elaine.drink.com>

In article <6o467q$4v9$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    Lloyd Zusman <ljz@asfast.com> writes:
>:I, for one, think that it's a postively wonderful idea!
>
>That would be horrible.  Scripts would lose portability
>if the run-time environment were so unpredictable.
>

It's not any more unpredictable than the current situation.

You can get the exact same variation in warnings by setting '-w'
in PERL5OPT by default (eg in /etc/profile), and having users
unset them if they want, or not doing this and having users set them
if they want.

Unless the author of the script specifically enables or disables warnings
then they do not know if warnings will be produced.

Lets split the idea down into 2 parts.

Firstly, adding a -W flag to disable warnings.

The advantage of adding a -W flag is so that you can do

perl -W script.which.warns

and disable warnings even though you have asked for them in PERL5OPT.

adding -W to the #! line is exactly equivilant to 
$^W=0; as the first line of the script, so there is no great advantage
other than for simplicity and more than one way to do it.

In either case, the script is in control about emitting warnings, the
user's preference comes second, and perls default comes third.

Secondly, adding an option "Enable warnings by default" to Configure

Perl installers who wish to enable warnings by default could patch the
the relevent startup code in perl, however not all Perl installers
have the necessary skills, or may feel reluctant to change the code,
or they could add the -w to the default enviroment, however as we know,
the default enviroment isn't always easy to specify in all cases (User
changes shell to /usr/local/bin/somethingstrange, running from cron/cgi
etc).
Adding this would make it simpler to change perls default, and allow
the Perl installer to easily set the default policy at their installation.


If both changes were in place (and the second would depend on the first
being accepted, as you wouldn't want a way for the default to be changed
without giving the user a way to specify their preference over the
installation preference), then the rules would be:

	the installation prefence, can be over ridden by
	the users preference, can be over ridden by
	the scripts startup

if a startup line, or command argument has multiple -w and -W's, then the
last one applies, eg "perl -w -W" script would mean disable.

IMO, the only changes we are making is simplifying things you can
do already.


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

Date: 10 Jul 1998 09:00:27 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Arrays
Message-Id: <slrn6qbmrt.m3d.the_wildman_98@foobar.net>

I'm having a little trouble with arrays. Okay, a LOT. I don't understand how
they work in perl at all. I'm trying to do something like this:
for ($i = 0;$i < MAX;$i++) {
    $array[$i] = $i;
}

But of course it isn't working. You can see what my coding background is,
too, I suppose. :D

-- 
The Wildman - wildman at microserve dot net
Do NOT reply to this post! All mail sent to the From/Reply-To will be
considered spam, and handled appropriately.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------


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

Date: Fri, 10 Jul 1998 11:12:15 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: Arrays
Message-Id: <35a5e832.0@nnrp1.news.uk.psi.net>

Well apart from the fact that MAX should be something like $MAX I can't see
a problem with the code, either way I would suggest reading the perldsc,
perldata and perllol for useful info.

Simon

The Wildman wrote in message ...
>I'm having a little trouble with arrays. Okay, a LOT. I don't understand
how
>they work in perl at all. I'm trying to do something like this:
>for ($i = 0;$i < MAX;$i++) {
>    $array[$i] = $i;
>}
>
>But of course it isn't working. You can see what my coding background is,
>too, I suppose. :D
>
>--
>The Wildman - wildman at microserve dot net
>Do NOT reply to this post! All mail sent to the From/Reply-To will be
>considered spam, and handled appropriately.
>Fight spam - http://www.cauce.org/
>-----BEGIN GEEK CODE BLOCK-----
>Version: 3.12
>GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+
PGP?
>t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
>------END GEEK CODE BLOCK------




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

Date: Fri, 10 Jul 1998 11:12:17 +0200
From: "Samuel Becker" <sbecker@ireste.fr>
Subject: CGI: PB with NT network
Message-Id: <6o4or2$44f$1@minus.oleane.net>

Hello,

I'm trying to make file copy on a WindowsNT Network in a perl script.
It looks like that:
copy \\IPAdress1\... \\IPAdress2\...

=> It's OK when I execute it in the command line
=> But not in a CGI script (Http Daemon: IIS) !

If i do a copy in a CGI script without using "\\AdresseIP\..." but copying
local files that's ok.

If anybody has an idea ..
Thanks.





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

Date: Fri, 10 Jul 1998 11:20:46 GMT
From: birgitt@my-dejanews.com
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <6o4tee$k5i$1@nnrp1.dejanews.com>

In article <fl_aggie-0107981306430001@aggie.coaps.fsu.edu>,
  fl_aggie@thepentagon.com (I R A Aggie) wrote:

>
> + If I pay for dejanews in one way or another indirectly, where is my
> + share of control I should have over the way it is functioning ?
>
> Since your "payment" is indirect, you have no control. The only control
> you might be able to exert is to have your posts removed from dejanews
> as a violation of your copyright.
>

Is it a matter of netiquette or is it really against the law (violation
of the author's copyright - is there really a written law for that ?)
to publish a private email response to a post
in a news group in a post as a follow-up to that response ?

What are my rights as the author of that email ? Have there been
cases where this became a point of a severe dispute ?

In that regard does it matter if the publication of the private
email response to a previous post happened in a news group or in
an open mailing list ?


Birgitt Funk

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


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

Date: 10 Jul 1998 04:52:10 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <m3vhp5exed.fsf@windlord.Stanford.EDU>

In news.groups, birgitt <birgitt@my-dejanews.com> writes:
> fl_aggie@thepentagon.com (I R A Aggie) wrote:

>> Since your "payment" is indirect, you have no control. The only control
>> you might be able to exert is to have your posts removed from dejanews
>> as a violation of your copyright.

> Is it a matter of netiquette or is it really against the law (violation
> of the author's copyright - is there really a written law for that ?)
> to publish a private email response to a post in a news group in a post
> as a follow-up to that response ?

So far as I know, it's never been tested in court, so we have no idea.
Copyright violations are, so far as I know, always civil complaints, so
you would have to sue for damages; under most circumstances, the damages
aren't going to exist, so the lawsuit isn't going to be possible.

> What are my rights as the author of that email ?

Basically, you could try to take them to court.  Beyond that, not much.

> Have there been cases where this became a point of a severe dispute ?

On Usenet, sure.  Not off Usenet so far as I know.

> In that regard does it matter if the publication of the private email
> response to a previous post happened in a news group or in an open
> mailing list ?

Probably not really.

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


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

Date: 10 Jul 1998 10:15:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How do you delete arbitrary elements of an array in one go?
Message-Id: <6o4pkn$gl7$1@pegasus.csx.cam.ac.uk>

F.Quednau <quednauf@nortel.co.uk> wrote:
>
>sub sorthing {
>   my @arr = @_; 
>   for (sort @_) { print $_;}
>   for (sort @arr) { print $_;}
>}
>
>
>&sorthing(5,4,6);
>
>Gives: 546456

That bug was mended in perl5.004.   Upgrade.


Mike Guy


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

Date: Fri, 10 Jul 1998 13:26:53 +0200
From: "0000-Admin(0000)" <kwoda@euv-frankfurt-o.de>
Subject: Installing Perl5.004_04
Message-Id: <35A5FA7D.7CA9@euv-frankfurt-o.de>

Hi there!
I'm currently trying installing Perl5.004_04 and after I had written "sh
Configure", I got the message: 
What command will force resolution on this system? [cc]  
Checking for GNU cc in disguise and/or its version number...
*** WHOA THERE!!! ***
    Your C compiler "cc" doesn't seem to be working!
    You'd better start hunting for one and let me know about it.
My gcc compiler is under /opt/FSFgcc/bin/gcc.
Could anybody help me writing to me the right command to
configure/compile this perl version?
My eMail is: kwoda@euv-frankfurt-o.de


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

Date: Fri, 10 Jul 1998 10:32:00 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: need to code a delete function
Message-Id: <35A5DF90.B620DD48@nortel.co.uk>

Doug Perry a.k.a drperry wrote:
> 
> This is driving me nutz! I have a nice content mangement tool that I
> out together to teach myself CGI/perl. So far I have a script to parse
> and write a datafile and one to display the data in a Web page. The
> funny thing is that I still haven't figured out a way to delete all
> the entries at once. 

You could also open that file for writing. In that way it is opened and
truncated to no contents:

open FILE, "> somefile.txt" or die "Ker-Pow: $!";


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

Date: Fri, 10 Jul 1998 08:50:11 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <adelton.900060611@aisa.fi.muni.cz>

Daniel Grisinger <dgris@rand.dimensional.com> writes:

[...]

> Personally, I think that it should be for the programmers, not for 
> the language.

Would you allow announce of new local-language mailing list/newsgroup
about Perl? I'm not really sure if it's for programmer or for
language ... Sometimes it's hard to say. I ask because the announce
of cz.comp.lang.perl was refused and later I learned that there are
people abroad (Czechs and other nationalities who understand Czech)
who would like to learn about it.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 10 Jul 1998 11:07:42 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <35acf116.10450909@news.tornado.be>

Nathan Torkington wrote:

>It's difficult to do that without letting the bigtime folks through.

Just how many big-time companies are you talking about? Not too many, I
would think.

And those few(?) should actually have something new to say, in order to
pass. Not just new commercials for the same old product.

	Bart.


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

Date: Fri, 10 Jul 1998 12:38:30 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <35a6fcd1.260898502@news.mmc.org>

On 10 Jul 1998 03:06:44 GMT, mgjv@comdyn.com.au (Martien Verbruggen) wrote:

>In article <6o3b93$c7l$1@tholian.cse.psu.edu>,
>	groenvel@cse.psu.edu (John D Groenveld) writes:
>> Let the commercial interests advertise in the Perl Journal
>> or some other median.
>
>Now, this is an idea I like.
>
>Martien

Hey, what's The Perl Journal?[1]  Is it a commercial publication? How would one
find out about such a publication if not through c.l.p.a? I suppose a web
search would eventually turn something up, or possibly a
somewhat-more-than-casual-look at the www.perl.com home page . . .

Should notices regarding subscription information be proscribed in c.l.p.a? If
yes, then, what about plugs for such geeky-cool things as the
just-recently-available Magnetic Perl Kits?

A 'no commercial interests' clause in the charter will serve to eliminate some
spamworthy junk, but there are definitely some commercial products out there
that are (IMHO) of TREMENDOUS interest to the Perl community. Especially the
Magnetic Perl Kits. :-)

Please, just let the moderator use common sense to determine what should show
up on c.l.p.a. It's not like anyone will be sued for what the moderator deems
inappropriate. And if the postings are properly labeled, it will be trivial to
filter out the ones you personally don't find to your liking.

[1] I'm already a TPJ subscriber . . . I was being purposefully disingenuous,
in that sentence anyway. Any other disingenuity in the above was purely
unintentional ;-)

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 10 Jul 1998 11:35:32 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: perl 5.004.04 on AIX 4.2.1
Message-Id: <35a5faa8.260345216@news.mmc.org>

[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]

On Thu, 9 Jul 1998 21:47:09 -0400, <mdunn@ibm.net> wrote:

>I had the same problem and never got it to work with gcc 2.8.1 and had to
>use AIX's C compiler, running on 4.2.1.
>
>Does anyone know if dynamic loading of Perl modules works at all with AIX.
>When I tell it to "use IO::Sockets" (or any module, for that matter), it
>says it can't find the module??

Works fine on my primary system . . . AIX 4.2.1, Perl 5.004_04. I used IBM's
xlC 3.1.

I've also compiled it with egcs 1.0.2 on AIX 4.1.4 without a whole lot of fuss.
I can mail you my config.sh files if you want.

I got a precompiled egcs from Bull's AIX freeware archive . . .
http://www-frec.bull.com.

(snip)

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 10 Jul 1998 10:36:44 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Perl security
Message-Id: <35A5E0AC.CFEB4718@nortel.co.uk>

Jorge Kinoshita wrote:
> 
> Hello everybody,
>     I heard that Perl CGI scripts have some holes in security. 

Better than holes in the socks.
At http://www.perl.com there is a link to FAQs, and there you will also find the
CGI Security FAQ, an extensive information resource on exactly that issue.

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Fri, 10 Jul 1998 12:00:22 +0200
From: Thomas Kobbe <knocker@bauwesen.tu-cottbus.de>
Subject: Re: perl-installation eats more than 3 GByte of harddisk
Message-Id: <35A5E636.44C2@bauwesen.tu-cottbus.de>

> when I do "sh Configure" and a "make depend" (perl5.004_04 on HP-UX 9),
> perl installation generates the file ".shlist" which blows up to over 3
> GByte of diskspace, an I must cancel the installation.
> 
> Can anybody help me please ???

Now is all okay. I used for compilation another shell (csh instead of
bash) and then the  installation was successful (only with a few
megabytes of diskspace).

Thomas

-- 
Thomas Kobbe, knocker@bauwesen.tu-cottbus.de, student in civil- &
building-engineering at Brandenburg University of Technology Cottbus,
Web: http://www.bauwesen.tu-cottbus.de/~knocker/


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

Date: 10 Jul 1998 09:13:46 GMT
From: mmmunafo@tuttocitta.it (Maurizio M. Munafo')
Subject: Re: Problem controlling smbclient via perl
Message-Id: <6o4m0a$4lb$1@menelao.polito.it>

Rainer Finocchiaro <rainer@demag.rwth-aachen.de> wrote:
> Hi all,
> I want to fetch the list of logged-in users from our NT domain server.
> As it should be done on a regular basis (every ten minutes) I want it to
> run without interaction, started by crond.

On the SAMBA site you can find either a Perl module SMB.pm or 
a CGI program smb2www-980429.tar.gz that implement a Perl interface with the
smbclient program.

A possible URL is ftp://gd.tuwien.ac.at/infosys/servers/samba/smb2www/

Maurizio



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

Date: 10 Jul 1998 11:21:05 +0100
From: Rob Hutchings <dlaser@ermine.ox.ac.uk>
Subject: Re: Question I can't find an answer for.
Message-Id: <yk3oguy9fce.fsf@ermine.ox.ac.uk>

comdog@computerdog.com (brian d foy) writes:

> 
> In article <6o3ng0$3t9$1@nnrp1.dejanews.com>, jevon@my-dejanews.com posted:
> 
> >I have just begun to script in perl. I am trying to make a CGI application
> >(This is a perl question) that will replace all instances of $name with $value
> >{$name} in a template HTML file.
> >
> >I beleive this should be able to be done in two foreach loops
> >
> >I have read the template file into the @lines variable
> >eg.
> >
> >foreach $lines (@lines) {
> >        foreach $name (@name) {
> >                ($line) = $lines =~ s/$name/$value{$name}/ig;
> >        }
> >}
> 
> that's pretty close.  let's try adding a few features though. :)
> 
(various excellent points snipped)

> ....  templating systems sometimes supply the boundary.  
> i like using %%, so my templates look like
> 
>    the quick brown %%cat%% jumped over the lazy dog.
> 
> i can recognize and replace that with something like
> 
>    s/%%\Q$name\E%%/$form{$name}/g;
> 
> this has the added benefit of solving another problem.  imagine
> replacing "cat" with "fox".  further along in the process you
> decide to change all occurances of "fox" to "weasel".  do you 
> want to change occurances of things already changed?  in the
> example above, the delimiter has been removed in the first pass
> so things only are changed only once.  think about this as you design 
> your system.
> 

Another way to avoid changing things twice is never to look at
anything more than once!


$keys = join "|", map "\Q$_\E", keys %keyval;
while (<FORM>) {s/\b($keys)\b/$keyval{$1}/og;
### dispose of $_ ###
}

Rob


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

Date: Fri, 10 Jul 1998 10:02:57 GMT
From: staaldui@my-dejanews.com
Subject: Re: Recognizing BACK and FORWARD button-visits
Message-Id: <6o4osg$fd8$1@nnrp1.dejanews.com>

In article <m3oguynxx0.fsf@windlord.Stanford.EDU>,
  Russ Allbery <rra@stanford.edu> wrote:
> staaldui <staaldui@my-dejanews.com> writes:
>
> > I'm trying to find a way to see the 'site-walking' behaviour of a
> > visitor. By this I mean I am looking for a way so I can see a visitor is
> > pressing the BACK and FORWARD-buttons to go through previously cached
> > pages. (e.g. a visitor comes in on page A, clicks on a link to page B,
> > clicks on a link to page C and clicks BACK to go back to page B
> > again. When the visitor comes back on page B this is recognized as a
> > repeated visit to page B.)
>
> > Theoratically this can be achieved by disabeling caching (through
> > HTTP-headers) and use cookies to tell the different visitors apart and
> > to tell which visitor is a first-time visitor and which is not, however,
> > I don't want to rely on cookies for that, since cookies can be blocked
> > by the client.
>
> Um...
>
>  (a) That's an *incredibly* obnoxious thing to do.  I can't think of very
>      many cases where someone has a legitimate reason to do that, and if I
>      ever visited a site and found that they were doing that, I'd never
>      visit that site again.

Lots of sites do this, but all of those sites attack the visitor by sending
cookies for this purpose (you'll know how annoying this is if you have your
browser not accepting cookies automatically). I am only trying to get a
reliable view on how often a page is (re)viewed (for your and the visitor's
piece of mind, without the visitor reloading the page again every time BACK
is pressed).



>  (b) This isn't even remotely a Perl question, so I'm not sure why you're
>      posting it to this group.  At best it's a CGI question, but if you're
>      talking about invalidating the cache, it's really a HTTP protocol
>      question.
Okay, true. I'm sorry... Yes, I was looking for a CGI-solution for this (maybe
combined with JavaScript) and I figured there would be people reading this
newsgroup that might know a solution. Sorry again.

>  (c) Without relying on some saved state, whether it be a form submission
>      or cookies (and form submission won't catch forward and back buttons)
>      you can't tell clients apart.  This is sort of a first principles
>      kind of thing.  You can at best look for connections from unique IP
>      addresses.  If that's good enough, then disable caching by claiming
>      that all your pages immediately expire, and that *might* work for
>      *some* browsers.

For your info: with MSIE 4.x my problem is not a problem at all. By sending
the correct HTTP-header it's possible to uniquely identify each visitor and
to recognize if it is a first view or a later view. For Netscape this trick
doesn't work though. Pragma: no-cache prevents the caching for that browser
(not for MSIE), but then there's no reliable way to tell first views and
later views apart (proxies make a reliable check on IP-addresses impossible).

I think a combined CGI (Perl) and JavaScript-solution would solve the problem,
but I have no idea in which direction I should be thinking there. :(

> I'd recommend asking any followup questions on a different group, read by
> people who know more about the issues involved.
I posted it to some other groups that would be better for my goal also, but so
far this has been the most informatie reply.


Thanks,

Arjan van Staalduijnen

>
> --
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
>

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


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

Date: 10 Jul 1998 09:20:30 GMT
From: Database and tools for Uniweb <uwtools@cse.cuhk.edu.hk>
Subject: remove the first k lines of a string
Message-Id: <6o4mcu$c4r@eng-ser1.erg.cuhk.edu.hk>

I have a string consisting of certain number of lines. I want to remove 
the first k lines from it.

E.g., $str = "1st\n2nd\n3rd\n4th\n5th\n";

after removal of the first 3 lines, $str eq "4th\n5th\n";

Thank you.


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

Date: Fri, 10 Jul 1998 11:07:47 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: remove the first k lines of a string
Message-Id: <35a5e72b.0@nnrp1.news.uk.psi.net>

Without checking two options spring to mind, you could try the following
substitution ( if I remember correctly '.' matches all things bar
newlines ):

$str =~ s/.+\n//;

and just do that however many times (k) you need to.
Or a slightly longer and probably slower way would be to split the string
into an array remove the offending elements and then join them up again,
i.e:

@lines = split /\n/, $str;
splice @lines, 0, $k;
$str = join "\n", @lines;

Hope this helps

Simon

Database and tools for Uniweb wrote in message
<6o4mcu$c4r@eng-ser1.erg.cuhk.edu.hk>...
>I have a string consisting of certain number of lines. I want to remove
>the first k lines from it.
>
>E.g., $str = "1st\n2nd\n3rd\n4th\n5th\n";
>
>after removal of the first 3 lines, $str eq "4th\n5th\n";
>
>Thank you.




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

Date: Fri, 10 Jul 1998 12:25:18 GMT
From: "Bob L." <newsonly@usa.net>
Subject: sending mail from within perl
Message-Id: <OKnp1.177$P8.556995@proxye1.nycap.rr.com>

Hi:

I'm running Perl under windows 95.  I want to send mail from a script but do
not have a mail server running.  I am connected 24/7 and wonder if I can use
my mail host (smtp.gte.net) to send the mail for me?

Thanks.

Bob

--





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

Date: Fri, 10 Jul 1998 12:06:00 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Silly things to do in Perl (or: is that Laptop waterproof?)
Message-Id: <35A5F598.985CCD6B@nortel.co.uk>

Oh *shish*, you're all a bunch of perfectionists :)

$how = shift; # write something like 'script.pl to morse'
$what = shift;# or 'script.pl from morse'

@args = split (' ',$what);
$routine = "alphabet_to_thing" if $how eq "to";
$routine = "thing_to_alphabet" if $how eq "from";

SWITCH: {
  $what eq "morse" && do {$QUE = "morse";last SWITCH;}
}

while (<DATA>) {
  chomp;
  /^ALPHA/ && push @alpha, split /\t/;
  /^$QUE/o && push @code, split (' ');
}

@translator{@alpha} = @code;
$translator{' '} = ' '; 

open FILE, "< /u/quednauf/temp/testfile.txt" or die "Can't: $!";

&$routine;

sub alphabet_to_thing {
  while (<FILE>) { 
    s/(.)/$translator{lc $1} /g;
    print $_;
  }   
  print "\n --- End of message ---\n";
}

sub thing_to_alphabet {
  my %antidot = reverse %translator; 
  while (<FILE>) {
    s/(.+?)\s/$antidot{$1}/g;
    print "$_\n";
  }
  print "\n --- End of message ---\n";
}

__DATA__

ALPHA:	a	b	c	d	e	f	g
------------------------------------------------------------
morse  .-      -...    -.-.    -..      .      ..-.     --.

ALPHA:	h	i	j	k	l	m	n
------------------------------------------------------------
morse  ....     ..    .---     -.-     .-..     --      -.

ALPHA:	o	p	q	r	s	t	u
------------------------------------------------------------
morse  ---    .--.     --.-    .-.     ...      -      ..-

ALPHA:	v	w	x	y	z	1	2
------------------------------------------------------------
morse  ...-    .--    -..-     -.--    --..   .----   ..---

ALPHA:	3	4	5	6	7	8	9
------------------------------------------------------------
morse  ...--  ....-   .....   -....   --...   ---..   ----.

ALPHA:	0	.	;	?	"	:	,
------------------------------------------------------------
morse  -----  .-.-.-  -.-.-.  ..--..  .-..-.  ---...  --..--



Expand the translation table in any way you want :)
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Fri, 10 Jul 1998 00:16:42 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Single vs Double Quotes [was: Re: Abigail - Another Question for you.]
Message-Id: <q384o6.me4.ln@localhost>

William R. Ward (hermit@cats.ucsc.edu) wrote:
: tadmc@flash.net (Tad McClellan) writes:
: >    [ I believe that it is misleading to use double quotes when there
: >      is no interpolation. Single quotes are more appropriate in
: >      that case.

: Isn't it also faster to use single quotes, as the interpreter can then
: know it doesn't have to scan for metacharacters such as $ or \ to
: interpolate?


Zenin and the Benchmark module have answered that one.

But I am more concerned with not wasting maintenance time than
I am with wasting CPU cycles anyway.


Grey matter cycles are so much more expensive  ;-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 10 Jul 1998 08:36:33 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: SQL INFORMIX DATABASE
Message-Id: <ltvhp551da.fsf@asfast.com>

On NPGE - III, "Edward Villalovoz" <edwardv@jps.net> writes:

> Can anyone tell me how to convert this csh script to perl?  I would rather
> not use any add-ons like dbi.  Thanks.
> 
> #!/bin/csh
> 
> setenv INFORMIXSERVER n36_shm
> dbaccess << eof
> database pmsys@n36;
> UNLOAD TO '/net/n28/u1/out/share/edv/Ebase/c04b.txt' DELIMITER '|'
> SELECT EXTEND (start, YEAR to DAY), EXTEND (start, HOUR to MINUTE), subj1,
> subj3, switchid,
> [ ... etc. ... ]
> FROM tmmc0_4b_980708
> WHERE EXTEND (start, HOUR to MINUTE) = "12:00";
> eof

Try this ...

  #!/usr/bin/perl

  $ENV{'INFORMIXSERVER'} = 'n36_shm';

  unless (open(DBACCESS, "dbaccess")) {
     die "unable to invoke: dbaccess\n";
  }

  print DBACCESS <<eof;
  SELECT EXTEND (start, YEAR to DAY), EXTEND (start, HOUR to MINUTE), subj1,
  subj3, switchid,
         dr_cand, dr_out, dr_in,
  [ ... etc. ... ]
  FROM tmmc0_4b_980708
  WHERE EXTEND (start, HOUR to MINUTE) = "12:00";
  eof

  close(DBACCESS);

Note that this example is indented here for clarity.  The assumption
is that the `#' in the first line is in the leftmost column.

You can see that here documents in Perl are similar to those in the
various *sh shells; however, note the trailing semicolon in the
`print DBACCESS <<eof;' line, but not in the subsequent `eof' line.


-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: Fri, 10 Jul 1998 11:44:22 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Trouble with ActiveState - urgent
Message-Id: <35A5FE96.A14E7BAA@inlink.com>

Ulf,

I have heard that there are many problems with modules on Activestate's
Perl.  I have also run into many problems with it and modules.

I suggest getting the G.S. version of Perl which comes with many modules
already pre-compiled.

Installation is just as easy as the Activestate port.  Use of it is
exactly (or close) the same as the Activestate port.

Good luck,

Brent


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

Date: Fri, 10 Jul 1998 08:46:29 GMT
From: tos@my-dejanews.com
Subject: trying to compile perl5.004_04 with cygwin32
Message-Id: <6o4kd4$a5h$1@nnrp1.dejanews.com>

Hello everybody,

i'm trying to compile perl5.004_04 on winNT using the
GNUPro Toolkit cygwin32. According to README.cygwin32
i did the first steps and ran the configure-file using
then cygwin32-bash. Everything looked fine until i get
the ugly message :

  Checking for GNU cc in disguise and/or its version number...
  gcc2: permission denied
  *** WHOA THERE!!! ***
    Your C compiler "gcc2" doesn't seem to be working!
    You'd better start hunting for one and let me know about it.

But when i do a 'gcc2 hello.c' with the wellknown threeliner which
only prints out "hello world", everything is ok.

Maybe that i lost orientation. Who can help me.

greetings from cologne, tosch

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


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

Date: Fri, 10 Jul 1998 10:34:35 GMT
From: wilfwilliams@my-dejanews.com
Subject: UNC Filename Open for Output
Message-Id: <6o4qns$h4q$1@nnrp1.dejanews.com>

I Try to open a UNC file name for output with no success like

$index_page ='> //DITLU21/DATA$/inetpub/wwwroot/TCP/index.html';
open(INDEX,$index_page) || die "ERROR:Cannot  open $index_page !!\n";

and several other combinations of > in different places. Without > it opens
fine but in append mode.

Can anyone suggest how to do this ?



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


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

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

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