[12364] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5964 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 11 15:07:19 1999

Date: Fri, 11 Jun 99 12:00:23 -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, 11 Jun 1999     Volume: 8 Number: 5964

Today's topics:
    Re: "System" function delays output (Andrew Allen)
    Re: Calculating weekday given year, month and day (Gregory Snow)
        DB_File/CGI/Apache Problem <spike1965@worldnet.att.net>
    Re: delete line ending with ) jimbob4334@my-deja.com
    Re: Difference of two variables (Larry Rosler)
    Re: File upload/download Web app. <cassell@mail.cor.epa.gov>
    Re: File upload/download Web app. (Andrew Allen)
        Form Redirection <davidf@gaylordusa.com>
    Re: Formmail with Credit Card Validation problems <emschwar@rmi.net>
    Re: Help with SIGCHLD and qx() (M.J.T. Guy)
    Re: How do I sort files in a dir by last modified time? (Larry Rosler)
    Re: how to check if file exists? (I R A Aggie)
    Re: I'm really peaved off! <ejohnso9@earthlink.net>
        I'm sorry for posting it twice bernd1615@my-deja.com
        installing modules <dscapin@harris.com>
    Re: Is anyone here tonight <jdporter@min.net>
    Re: Linus Torvalds and Carmen Electra? (I R A Aggie)
    Re: MIcrosofts Attack on Perl <jknoll@ipt-inc.com>
    Re: multiple match & replace regexp <xpalo03@vse.cz>
    Re: multiple match & replace regexp (Larry Rosler)
    Re: Perl String , RE 's jatgirl@yahoo.com
        PerlIS.dll on NT == Perl.exe COMPLETELY? <rhjones@arn.net>
    Re: shortest self printing perl program (John Stanley)
    Re: Silly old me <cassell@mail.cor.epa.gov>
        Silly Question: Define "Wrapper" <serstad@my-deja.com>
        using foreach w/anonymous array in hash <aporras@comstar.net>
    Re: using foreach w/anonymous array in hash <craig@mathworks.com>
    Re: using foreach w/anonymous array in hash (Larry Rosler)
    Re: Win95/DOS - can't install modules <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 11 Jun 1999 18:44:15 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: "System" function delays output
Message-Id: <7jrldv$973$4@fcnews.fc.hp.com>

Tom Phoenix (rootbeer@redcat.com) wrote:
: On 10 Jun 1999, Andrew Allen wrote:

: > print scalar(`command`);

: > If you need a return code, you'll need to use piped opens (and
: > closes).

: Really? That's not what perlvar says. But maybe I misunderstand you.
: Cheers!

Of course, $?. Thanks for the correction.

Andrew


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

Date: 11 Jun 1999 17:48:37 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: Calculating weekday given year, month and day
Message-Id: <7jri5l$po8$1@nntp6.u.washington.edu>

In article <7jq986$7g1$1@nnrp1.deja.com>,  <perl_beginner@my-deja.com> wrote:
>    what is the most efficient way to calculate the weekday (sunday=0,
>monday=1 ...) given the year, month, and day without using the module
>provided by perl (i.e using arithmatics and algorithm)? Any suggestion?
>

Another approach (that doesn't require any modules and the overhead
that comes with them) is:

  $day_of_week = ( dmy_to_julian( $day, $month, $year ) + 1 ) %7;

where dmy_to_julian is a good julian day converter (I use the one
available at the Perl Function Repository:
http://moiraine.dimensional.com/~dgris/perl/pfr/ ).


-- 
-------------------------------------------------------------------------------
     Gregory L. Snow         |   Imagination is the one weapon in the
     (Greg)                  |  war against reality.
snow@biostat.washington.edu  |                -- Jules de Gaultier


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

Date: Fri, 11 Jun 1999 13:18:02 -0400
From: Terry Mealy <spike1965@worldnet.att.net>
Subject: DB_File/CGI/Apache Problem
Message-Id: <376144CA.A52CF122@worldnet.att.net>

I can't get the following bit of code to work:

#!/usr/bin/perl -w 

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use strict;
use DB_File;

#### various declarations here

### open & close (text) ini file

tie (%city_data, "DB_File", 'citydb.db') or die "Can't tie: citydb";
tie (%air_data, "DB_File", 'airdb.db') or die "Can't tie: airdb";
tie (%con_data, "DB_File", 'condb.db') or die "Can't tie: condb";

The browswer returns "Software error: DB_File::BTREEINFO does not define
the method CLEAR at /home/httpd/cgi-bin/quotem.pl line 0"

The script seems to work fine w/o CGI methods.  It returns the same
thing when I run it interactively.

The permissions for the .db files are set to 666.  I am using an Apache
server on a Linux machine, w/o mod_perl.  Can anyone clue me in to what
might be happening, here?


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

Date: Fri, 11 Jun 1999 16:04:33 GMT
From: jimbob4334@my-deja.com
Subject: Re: delete line ending with )
Message-Id: <7jrc29$jfr$1@nnrp1.deja.com>

thanks

had a typo: perl -pi -e '/$\)//q' temp.file
q was suppose to be g.

This:
perl -pi -e 's/\)$//g' temp.file

removed all ) on the end.


In article <f8jqj7.7q6.ln@magna.metronet.com>,
  tadmc@metronet.com (Tad McClellan) wrote:
> jimbob4334@my-deja.com wrote:
> :  How do I delect every line ending with ).
>
> : This is what I have - trying to escape out the )
>
> : perl -pi -e '/$\)//q' temp.file
>                 ^^
>                 ^^ that is a perl special variable. It is
interpolated,
>                    so the backslash does NOT escape the )
>
>    You are missing an 's'    s///
>
>    There is no 'q' option
>
>    You have the dollar sign in the wrong place
>
> : get: /)/: unmatched () in line 1
>
>       s/\)$//
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas
>

--
Check out http://www.imaxx.net/~djferree


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 11:01:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Difference of two variables
Message-Id: <MPG.11caeeef105e5724989bc1@nntp.hpl.hp.com>

In article <slrn7m0q72.2fo.abigail@alexandra.delanet.com> on 10 Jun 1999 
20:30:54 -0500, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCIX September MCMXCIII in
> <URL:news:MPG.11c979e3d6b69799989bab@nntp.hpl.hp.com>:
> @@ 
> @@ [Tom and Gnat:  Would order-preserving set difference be a useful 
> @@ addition to the FAQ?  I don't have my Cookbook at hand to see if it's in 
> @@ there.   "4.8. Computing Union, Intersection, or Difference of Unique 
> @@ Lists" might have it.]
> 
> Section 4.7 Finding Elements in One Array but Not Another 
> uses order preserving algorithms.

Yes; thanks for the pointer.  The Ram rules!

Though it shows this as 'idiomatic':

    foreach $item (@A) {
        push(@aonly, $item) unless exists $seen{$item};
    }

What I posted seems rather more idiomatic:

    @aonly = grep !exists $seen{$_} => @A;

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


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

Date: Fri, 11 Jun 1999 10:54:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: File upload/download Web app.
Message-Id: <37614D6B.C9CF5935@mail.cor.epa.gov>

Paul Bunkham wrote:
> 
> Jonathan Stowe wrote:
> >
> > Paul Bunkham <paul.bunkham@synetica.com> wrote:
> > > Why don't people actually help in this newsgroup? Jen here, may have
> > > posted to the wrong place, but that is no reason to not pass on
> > > information if you have it.
> > >
> >
> > I suppose you think we should pass on our recipes for doughnuts as well
> > if someone asks ? 
>
> [snip of valid comments] 
> I am not suggesting that you let off topic threads become the backbone
> of the group, but can't you politely help if you can, and point them in
> the right direction for future reference.  There are so many newsgroups,
> it is very hard to understand exactly where those grey area topics are
> supposed to be posted, and simply posting unhelpful replies is not going
> to stop these messages getting posted to the wrong place.

Many of us do try to be helpful when the thousands of off-topic posts
per day come rushing in like a tsunami of cluelessness.  Not all of
us succeed.  :-)  And some of us were once helpful responders, who
[through years of seeing the same irrelevant posts appear so frequently
that some might suspect an autobot was generating them under a slew
of fake email addresses] over time have become bitter recluses who 
now shout at the neighbor kids to get off their lawns.  :-)
 
> Surely a miscellaneous newsgroup on perl language topics can cater for
> the odd (hopefully related) question about CGI or copyright information,
> or anything else people need to know, including recipes for doughnuts if
> that is what's needed.

Well, it does say c.l.p.misc in the name, but there is a charter.
Since people are unable to read or learn anymore, someone does need
to: (1) explain that this is Usenet and not a chat room; (2) Usenet
does have its own rules that others are expected to follow; and 
(3) c.l.p.misc has its own rules which are printed up regularly in
the mini-FAQ and posters should be cooperative if they want
cooperation.

Are you volunteering?  :-)  You can get in line before me and
Tom Phoenix as some of The Official Helpful People.

> Sorry, I'm probably well out of line here, and I have just added (rather
> ironicly) to the multitude of off topic discussions, but I just wanted
> to get it off my chest.

Given the amount of blargh here lately, your post doesn't strike
me as that irrelevant.  Off the original topic, yes.

BTW, is this stuff on the floor what you were trying to get off
your chest?  If so, I suggest you see a good internist.  It looks
pretty bad.  [Sorry, I couldn't resist such an easy straight line.]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 11 Jun 1999 18:33:37 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: File upload/download Web app.
Message-Id: <7jrkq1$973$3@fcnews.fc.hp.com>

Paul Bunkham (paul.bunkham@synetica.com) wrote:

: > I suppose you think we should pass on our recipes for doughnuts as well
: > if someone asks ?
: > 

: Yes, why not?  All the other threads in this group that have got moans
: about the "perl community" and everything being open source, and you
: shouldn't help people if they want to keep their information.  Why don't
: you listen to what your saying?

The whole free software movement succeeds only with responsible users,
both newbies and experts. The newbies scan documentation until they
have a truly unanswered questions, and pose well-formed questions in
the proper forums. The responsible experts help people on newsgroups,
and add to the body and quality of free software via RFC's,
collaboration, and just a lot of hard volunteer coding. The
irresponsible people (newbies & experts) muck this whole process up.

Andrew


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

Date: Fri, 11 Jun 1999 11:46:05 -0700
From: David <davidf@gaylordusa.com>
Subject: Form Redirection
Message-Id: <3761596D.D817E3FB@gaylordusa.com>


Hash: SHA1

I'm designing a web page that has a list of contact info 
for a variety of service agents for my company.  I'm using 
a form that submits to a perl script called selection.pl.  The 
form works great while using Netscape but if I try it in 
Internet Explorer it doesn't work at all.  I'm not sure why, but 
I'm assuming it must be one of those browser specific html 
codes.  

The link to the site is http://www.gaylordusa.com/service-agents.html
and the perl script contents are as follows:

#!/usr/bin/perl
#
# selection.pl    --    A simple script to issue a redirect based on 
#           a form selection.
#
# Written by Collin Forbes in May, 1996
# Revised (1.01) in August, 1996
#
# The script takes the value of a field called "URL" from the form and

# issues a redirection response to that value.  It had better be a
valid
# URL or else the browser will report an error.  
#
# Unfortunately, browsers from Netscape and Microsoft will work using 
# relative URLs, but the HTTP specification says it needs to be an 
# absolute URL.  If you use relative URLs, and someone says it didn't
# work, don't say you didn't know!
#
# Ideally you would use this script with a form containing either the
# <select> element or radio buttons.  Use the GET method.

main: {

    @pairs = split(/&/, $ENV{'QUERY_STRING'} ); # GET Method

    foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);

        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $name =~ tr/+/ /;
        $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

        $FORM{$name} = $value;
    }


    $location = $FORM{'URL'};       # Use the field named "URL".
    print "Location: $location\n\n";    # Voila!

}

My company (and myself) wants the web page to be viewed by all 
browsers correctly and thus I need to fix this problem so it will work
with both of them.  If you have any suggestions please send them 
my way.  Respond directly to email if at all possible.  Thank You.

P.S.  I use Textpad (a pseudo vi for windows) to edit my web pages, 
so please give examples or hints in plain html or perl.



Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBN2FYUkTNaOpKOuebEQJzxACeO9gygZ0jya4uWUmMDrvQEbc32YYAn3TD
n5BgydrpaK+hXTpTkCemQBJX
=hqZb
-----END PGP SIGNATURE-----


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

Date: 11 Jun 1999 12:31:16 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Formmail with Credit Card Validation problems
Message-Id: <xkfogimk2rv.fsf@valdemar.col.hp.com>

elklabone@my-deja.com writes:
<snip>

> # Copyright 1996 Dave Paris (aka Spider)  All
> Rights Reserved.               #
> #

<snip>

> # Obtain permission before redistributing this
> software over the Internet or #
> # in any other medium.

Call it a hunch, but I bet you didn't get permission to redistribute this 
software on USENET.  I'm certainly not about to go tattle, but if anybody 
was so inclined, they'd be able to get you in a bunch o' trouble.

Besides, why did you have to post a 1316-line program?  You should be
able to reduce it to a 40-line example that illustrates your problem
quite well.  If you can't, then you probably don't understand the problem 
well enough anyway.

-=Eric


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

Date: 11 Jun 1999 17:19:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Help with SIGCHLD and qx()
Message-Id: <7jrgf1$ie8$1@pegasus.csx.cam.ac.uk>

Derek  <derek@fortstar.demon.co.uk> wrote:
>
>Basically, what I think is happening is that my signal handler is
>reaping the child process forked by the qx(), and is then changing the
>$? variable from the correct value (0) to something horrible (-1) even
>though @lines contains what I want.

Not quite right.   The signal handler is indeed reaping the child process
and setting $?, before the qx() completes.    Then the qx() tries to wait
for the child, which by now doesn't exist, which causes a return value
of -1 and the error 'No children' in $!.    (This error return doesn't
seem to be documented for either qx() or system() )

Note that perlvar says, under $?

             Note that if you have installed a signal handler for
             SIGCHLD, the value of $? will usually be wrong
             outside that handler.

The real moral is that you shouldn't mix qx()/system() and $SIG{CHLD}.

It may be that the 'safe signals' changes in Perl5.006 improve this
situation.


Mike Guy


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

Date: Fri, 11 Jun 1999 10:03:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I sort files in a dir by last modified time?
Message-Id: <MPG.11cae13c3560acba989bc0@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37613532@cs.colorado.edu> on 11 Jun 1999 10:11:30 -0700, Tom 
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc, 
>     "AEF" <aef@pangea.ca> writes:
> :How do I sort files in a directory, on the last modified time, and print
> :that time out in a formated month, day , year?
> 
> % ls -lt
> total 7
> drwxrwxrwt   2 root     root         2048 Jun 11 10:10 vi.recover
> drwxr-xr-x   2 tchrist  wheel        1024 Jun 11 10:05 card-listings
> drwx------   2 tchrist  wheel        1024 May 24 04:02 OOPerl_PS
> drwxr-xr-x  43 tchrist  wheel        1024 May 22 04:02 papers
> drwxr-xr-x   5 root     root         1024 Apr 17 13:05 recover
> drwxrwxrwx   2 tchrist  wheel        1024 Mar 26 04:02 upload

Yeah, sure.  So where is the year that AEF wants printed?  Even if the 
files are older, some of last year's files will not have the year 
printed, but the time (as these do).  So there is a formatting problem  
in any case.

Anyhow, we knock people for using `date` instead of localtime, etc.  How 
is this different?

Oh, now I see the invisible smiley in your response.  Let's make it more 
visible:  :-)

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


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

Date: 11 Jun 1999 17:50:57 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: how to check if file exists?
Message-Id: <slrn7m2ja9.17c.fl_aggie@thepentagon.com>

On Fri, 11 Jun 1999 18:35:20 +0200, R!k <rusenet@bigfoot.com>, in
<7jrdrj$tqs$2@enterprise.cistron.nl> wrote:

+ 1. Can a .pl crash (Error 500 ) on opening a non-existing file?

Yes.

+ 2. How do i check if a file exists?

Using a file operator as described in 'man perlfunc', specifically
'-e filename'?

Like:

#yes, I write perl like fortran, sue me...

if (-e $some_file) then {
   open(INPUT,$some_file) or die "$some_file: $!";
}else{
   # plan b
}

James


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

Date: Fri, 11 Jun 1999 11:10:17 -0700
From: Erik Johnson <ejohnso9@earthlink.net>
Subject: Re: I'm really peaved off!
Message-Id: <37615108.5EC432C8@earthlink.net>



brian d foy wrote:

> In article <3761395d@news2.vip.uk.com>, "Tobin" <Tobin@breathemail.net> posted:
>
> > ---------------------
> > Errors:
> > [Fri Jun 11 09:23:57 1999] access to /data1/hypermart.net/tobin/data1.pl
> > failed for 194.176.215.106, reason: file permissions deny server execution
> > exec of /data1/hypermart.net/tobin/data1.pl failed, reason: Exec format
> > error (errno = 8)
> > [Fri Jun 11 09:24:24 1999] access to /data1/hypermart.net/tobin/data1.pl
> > failed for 194.176.215.106, reason: Premature end of script headers
> > --------------------

Permissions problems are either errno 2 (ENOENT - "No such file or directory")
or errno 13 (EACCES - "Permission Denied"). This is errno 8 (ENOEXEC -
- "Exec format error") I can't see what you're doing with exec, but that is where
you need to focus. Perhaps try to run the code you are exec'ing directly and make
sure it is free of errors?

Hope that helps,
-ej

>
> >
> > I would be really greatful if anyone could let me know why this error
> > occurres.
> > I have made sure that the file is transferred in ASCI mode to the server,
>
> it looks like the file permissions are wrong. *shrug*  perhaps you
> should talk to your ISP since they'll know a lot more about their
> system than we will.
>
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>




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

Date: Fri, 11 Jun 1999 16:10:45 GMT
From: bernd1615@my-deja.com
Subject: I'm sorry for posting it twice
Message-Id: <7jrcdr$jm2$1@nnrp1.deja.com>

Sorry that I posted this message twice

Markus


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 14:03:16 -0400
From: Deamon George Scapin <dscapin@harris.com>
Subject: installing modules
Message-Id: <37614F64.C7D495CA@harris.com>


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

I tried to install a module called Image::Size.

I put it in \perl\lin\Image subdirectory and it is pointed to by @inc

When I try to use the module and refer to function in it, I get an
error.

C:\Program Files\sambar42\cgi-bin>perl image.pl
Can't locate auto/Image/Size/autosplit.ix in @INC (@INC contains:
C:\PERL\lib\si
te C:\PERL\lib c:\perl\lib c:\perl\lib\site c:\perl\lib\site .) at
C:\PERL\lib/A
utoLoader.pm line 84.
 at C:\PERL\lib/Image/Size.pm line 211
Content-Type: text/html

What is this autosplit.ix and why can't it be found anywhere?  Is this a
file that is automatically generated because I found the file in several
other module subdirectories.   Thanks in advance.

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

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I tried to install a module called Image::Size.
<br><br>
I put it in \perl\lin\Image subdirectory and it is pointed to by @inc
<p>When I try to use the module and refer to function in it, I get an error.
<p><font face="Courier New,Courier"><font size=-2>C:\Program Files\sambar42\cgi-bin>perl
image.pl</font></font>
<br><font face="Courier New,Courier"><font size=-2>Can't locate auto/Image/Size/autosplit.ix
in @INC (@INC contains: C:\PERL\lib\si</font></font>
<br><font face="Courier New,Courier"><font size=-2>te C:\PERL\lib c:\perl\lib
c:\perl\lib\site c:\perl\lib\site .) at C:\PERL\lib/A</font></font>
<br><font face="Courier New,Courier"><font size=-2>utoLoader.pm line 84.</font></font>
<br><font face="Courier New,Courier"><font size=-2>&nbsp;at C:\PERL\lib/Image/Size.pm
line 211</font></font>
<br><font face="Courier New,Courier"><font size=-2>Content-Type: text/html</font></font><font face="Courier New,Courier"><font size=-2></font></font>
<p>What is this autosplit.ix and why can't it be found anywhere?&nbsp;
Is this a file that is automatically generated because I found the file
in several other module subdirectories.&nbsp;&nbsp; Thanks in advance.</html>

--------------69DB53CF7436EC0F18429538--



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

Date: Fri, 11 Jun 1999 15:54:31 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Is anyone here tonight
Message-Id: <7jrbfi$j8i$1@nnrp1.deja.com>



This isn't a chat room.  Get a clue.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 11 Jun 1999 17:53:07 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Linus Torvalds and Carmen Electra?
Message-Id: <slrn7m2jec.17c.fl_aggie@thepentagon.com>

On Fri, 11 Jun 1999 12:23:27 -0400, John Bjorgen <john.bjorgen@cplc.com>, in
<7jrd6c$6vc$1@gaddy.interpath.net> wrote:

+ By the way, what is killfiled?

Means the person doing the killfiling will never see your posts until
they choose to remove you from their killfile.

James


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

Date: Fri, 11 Jun 1999 16:29:23 GMT
From: jrknoll <jknoll@ipt-inc.com>
Subject: Re: MIcrosofts Attack on Perl
Message-Id: <7jrdgk$k2t$1@nnrp1.deja.com>

I understand the need for protection of open source.  But do you really
think MS can hurt perl?  Realistically?  MS would only invest if they
thought it was a good thing, so why not at least give it a chance and
see what comes of it?
IMHO
lol no i dont work for MS
--
JESSE KNOLL
--Senior - Ball State University - INDIANA --
jrknoll@cwix.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 19:18:32 +0200
From: Ondrej Palkovsky <xpalo03@vse.cz>
Subject: Re: multiple match & replace regexp
Message-Id: <376144E8.A5C40C6D@vse.cz>

regurg wrote:

> What I don't know, however is this: what if I want to
> replace $1 ... $3 with something else? Analagous to this
> (which doesn't work):
>      if (/...( )...( )...( )/) {
>         $1 = "foo";
>         $2 = "bar";
>         $3 = "smar";
>      }
> 
> I feel sure this has been answered before, but I
> haven't been able to come up with a good search for
> this in the archives :-(.

What about 
s/(...) (...) (...) /$1foo$2bar$3smar/;

Ondrej Palkovsky
-- 
Live long and prosper.
		-- Spock, "Amok Time", stardate 3372.7


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

Date: Fri, 11 Jun 1999 11:08:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: multiple match & replace regexp
Message-Id: <MPG.11caf068d9a3c6c7989bc2@nntp.hpl.hp.com>

In article <929116131.27132@www.remarq.com> on Fri, 11 Jun 1999 07:48:49 

-0800, regurg <anonymous@web.remarq.com> says...
+ I have a need to trigger an action when I see several things
+ occur in a string based on a re. Say I have special
+ delimiters that delimit 3 things in a line of text. I am
+ interested in what is delimited. I know that I can use
+ parenthesis in the re to isolate these, and that I can refer
+ to the things matched as $1, $2, $3. I know that I can do
+ this with my re:
+      if (/...( )...( )...( )/) {
+      }
+ Ignore what the .'s are, and assume there is some good stuff
+ within the parenthesis. The match succeeds. The conditional
+ will return true, and inside the curleys I can reference the
+ matches as $1, $2, $3. This I know.
+ 
+ What I don't know, however is this: what if I want to
+ replace $1 ... $3 with something else? Analagous to this
+ (which doesn't work):
+      if (/...( )...( )...( )/) {
+         $1 = "foo";
+         $2 = "bar";
+         $3 = "smar";
+      }

You are looking for the ability of the right-hand side of a substitution 

operator to be an arbitrary block to be evaluated.  For example:

        s{(...)(.+)(...)(.+)(...)(.+)}
         {
           my ($x2, $x4, $x6) = ($2, $4, $6);
           # insert modifications to $x2, $x4, and $x6 here
           "$1$x2$3$x4$5$x6"
         }e;

See perlop for more.

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


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

Date: Fri, 11 Jun 1999 16:02:26 GMT
From: jatgirl@yahoo.com
Subject: Re: Perl String , RE 's
Message-Id: <7jrbub$jeo$1@nnrp1.deja.com>

Thanks Dean, it worked out pretty well.


Thanks
J

In article <7jqlab$ih1@cypress.nwnet.net>,
  deanh@nwnet.net wrote:
> In article <7jorj0$nee$1@nnrp1.deja.com>,  <jatgirl@yahoo.com> wrote:
> >I have following expression that I need to manipulate in a Cgi/perl
> >script.    Cgi script receives following format from a web based form
> >
> >LastName, firstName, NIckName, Email
LastName,FirstName,Nickname,Email
> >LastName, FirstName,Nickname LastName,FirstName, Nickname, Email
>
> First, make sure there isn't an easier way to set up your form data
with
> CGI.pm and descriptive names for your input tags.
>
> Supposing your data is in an array as above (a line of data containing
> an arbitrary numbers of entries ordered as implied) you could try
> sending your data into an array of hashes:
>
> # ----- code ----- #
> #!/usr/bin/perl -w
>
> use strict;
> use Data::Dumper;
>
> my @ar;
>
> while ( <DATA> ) {
>     s/,\s+/,/g;   	# make the data easier to deal with
>     for ( split ) {
>         my ( $hsh );
>         @$hsh{ qw( last first nick email) } = split /,/;
>         push @ar, $hsh;
>     }
> }
>
> print Dumper @ar;
>
> __END__
> LastName0, firstName0, NickName0, Email0
LastName1,FirstName1,Nickname1,Email1
> LastName2, FirstName2,Nickname2 LastName3,FirstName3, Nickname3,
Email3
>
> # ----- code ----- #
>
> Here's what it looks like; once you've got this you can format it
> however you like:
>
> $VAR1 = {
>           'email' => 'Email0',
>           'first' => 'firstName0',
>           'last' => 'LastName0',
>           'nick' => 'NickName0'
>         };
> $VAR2 = {
>           'email' => 'Email1',
>           'first' => 'FirstName1',
>           'last' => 'LastName1',
>           'nick' => 'Nickname1'
>         };
> $VAR3 = {
>           'email' => undef,
>           'first' => 'FirstName2',
>           'last' => 'LastName2',
>           'nick' => 'Nickname2'
>         };
> $VAR4 = {
>           'email' => 'Email3',
>           'first' => 'FirstName3',
>           'last' => 'LastName3',
>           'nick' => 'Nickname3'
>         };
>
> BTW, one of the splits in the code you posted is broken. :(
>
> dean.
> --
> --
> dean hudson, <deanh@verio.net>		Verio Systems Engineering
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 12:29:13 -0500
From: "Ron Jones" <rhjones@arn.net>
Subject: PerlIS.dll on NT == Perl.exe COMPLETELY?
Message-Id: <3761471c@news.usenetnews.org>

I posted another message regarding not being able to get .pl files to be
served from my web server, but instead it's attempting to download the file,
but the .plx files seem to work just fine.

My question is this:  is the ISAPI Perl (PerlIS.dll) which is processing the
 .plx files perfecty equal to regular perl in every way, except that it's
faster?  If that is true, then why make a distinction between .plx files and
 .pl files at all?  Why not just make the mapping of all perl-cgi type files
go through the faster ISAPI  by having the mapping go to ".pl" instead of
'.plx"?  (or even add ".cgi" if desired)?

Is there anything wrong (security or otherwise) with this idea?  (Is ISAPI
Perl completely equivalent to regular Perl?)

TIA.
Ron Jones
rhjones@arn.net





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

Date: 11 Jun 1999 17:41:49 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: shortest self printing perl program
Message-Id: <7jrhot$kuq$1@news.NERO.NET>

In article <7jrabd$iqd$1@nnrp1.deja.com>,
John Porter  <jdporter@min.net> wrote:
>In article <87iu8vd1no.fsf@gate7.olympiakos.com>,
>  Kiriakos Georgiou <kgnews@olympiakos.com> wrote:
>>
>> printf($x,39,$x='printf($x,39,$x=%c%s%c,39);',39);
>
>  seek DATA,0,0;print<DATA>;
>  __DATA__

Neither is the shortest self-printing program. The shortest self
printing program is, or course, the null program, which prints out
nothing.

onyx 112: cat nl
onyx 113: perl nl > nl2
onyx 114: diff nl nl2
onyx 115: 



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

Date: Fri, 11 Jun 1999 10:27:12 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Silly old me
Message-Id: <376146F0.1F6B23A5@mail.cor.epa.gov>

Tad McClellan wrote:
> 
> CacheBoy (chongsun@krdl.org.sg) wrote:
> [snip]
>
> : Thanks. Pls understand that I am very new to perl and my knowledge is not as
> : much as most of you here so please refrain from giving me the
> : you-mean-dont-know kind of answers.
> 
>    You mean you don't know to check Perl's standard docs before
>    posting to the Perl newsgroup?

Rats!  Doggonit Tad, *I* wanted to be the first one to say
"you mean you don't know" in my reply.

Crushed,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 11 Jun 1999 16:41:38 GMT
From: Sped Erstad <serstad@my-deja.com>
Subject: Silly Question: Define "Wrapper"
Message-Id: <7jre7v$kd3$1@nnrp1.deja.com>

Hi,

This may or may not show my ignorance, but can someone give me a good
definition of the term "wrapper" -- I'm pretty sure that I'm using it
correctly, but would like some confirmation:

I'm pretty much gathering that it's just a function (or routine,
whatever) whose main purpose is to call another fucntion -- usually with
some more restrictions so as to "protect" that function a little bit.
Kind of like a function with a little "value-addedness" to it.

Any thoughts?

Thanks,
Sped (sped@mailandnews.com)


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 18:27:11 GMT
From: Alex Porras <aporras@comstar.net>
Subject: using foreach w/anonymous array in hash
Message-Id: <376155AA.9DDD029C@comstar.net>

OK, the answer is probably really stupid.
Let's say I have a hash with a key as follows:

$hash{KEY}

and the value of the key is an anonymous array, i.e:
$hash{KEY}[0] = joe
$hash{KEY}[1] = greg
etc..

How can I do a foreach that will operate on the
number of array entries within that key?


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

Date: Fri, 11 Jun 1999 14:35:33 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: using foreach w/anonymous array in hash
Message-Id: <376156F5.420BA22F@mathworks.com>

I believe this is what you are looking for:

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

use strict;

my %hash;

$hash{KEY}[0] = "joe";
$hash{KEY}[1] = "greg";

foreach my $value ( @{$hash{KEY}} ) {
    print $value . "\n";
}

Craig

Alex Porras wrote:

> OK, the answer is probably really stupid.
> Let's say I have a hash with a key as follows:
>
> $hash{KEY}
>
> and the value of the key is an anonymous array, i.e:
> $hash{KEY}[0] = joe
> $hash{KEY}[1] = greg
> etc..
>
> How can I do a foreach that will operate on the
> number of array entries within that key?



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

Date: Fri, 11 Jun 1999 11:55:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: using foreach w/anonymous array in hash
Message-Id: <MPG.11cafb8d1e09fa8b989bc3@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <376155AA.9DDD029C@comstar.net> on Fri, 11 Jun 1999 18:27:11 
GMT, Alex Porras <aporras@comstar.net> says...
> OK, the answer is probably really stupid.

Even if the question is stupid (which it isn't, by the way, just 
ignorant :-), why should the answer be stupid?  I hope mine isn't.

> Let's say I have a hash with a key as follows:
> 
> $hash{KEY}
> 
> and the value of the key is an anonymous array, i.e:
> $hash{KEY}[0] = joe
> $hash{KEY}[1] = greg
> etc..
> 
> How can I do a foreach that will operate on the
> number of array entries within that key?

You might want to read perlref or perlreftut (a tutorial on references).

Perlref says this:

Anywhere you'd put an identifier (or chain of identifiers) as part of a 
variable or subroutine name, you can replace the identifier with a BLOCK 
returning a reference of the correct type. In other words, the previous 
examples could be written like this: 

 ...
    push(@{$arrayref}, $filename);
 ...    

So it's simply (or stupidly, as you wish):

    foreach (@{$hash{KEY}}) { ... }

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


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

Date: Fri, 11 Jun 1999 11:14:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Ben Hambidge <ben@expo-systems.co.uk>
Subject: Re: Win95/DOS - can't install modules
Message-Id: <376151FA.E33CB25E@mail.cor.epa.gov>

[courtesy cc to poster]

Ben Hambidge wrote:
> 
> I'm trying to install DBD::Xbase and MIME::Base64 modules, but I'm
> guessing (as with everything else round here :-)) that its all intended
> for UNIX.

Actually, while some modules are unix-centric, others work
on all Perl platforms.  But that's probably not a real issue
here.
 
> I've downloaded a few incantations of Perl.

On a win32 box, you probably should be using ActiveState Perl.
If you have that, then you have a ppm program which will do
these installs for you.  Read the HTML docs on your system,
and you'll see the section on using ppm to download modules
from activestate et al.

>                                        The instructions for install
> a CPAN module always involve 'perl Makefile.pl'.
> 
> This then creates a 'Makefile' file. Typing 'make' then does nothing.
> 
> Am I right in assuming this is a C makefile? I next tried downloading
> DJGPP and running make, but then I got the following error:
> 
> make.exe: *** [blib\lib\MIME\.exists] Error -1

If you have a module which needs a 'make', then go to Microsoft's
website [yes, Microsoft, I'm not kidding] and get nmake15.exe .
Stick it in a temp directory and double-click it.  It will unzip
into nmake.exe and nmake.err .  Put these somewhere your path
will find them [like C:\Windows\Command].  ActiveState modules
seem to do better with nmake than gmake or dmake.

> Where am I going wrong? What am I supposed to be doing? I've tried the
> FAQs, the Camel book and Dejanews, so I think I'm not asking a over-
> repeated question.

Actually, you may be trying too hard here.  Try to be lazier. :-)
[look up 'laziness' in the glossary of 'Programming Perl']

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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