[8824] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2441 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 13:17:41 1998

Date: Tue, 28 Apr 98 10:00:33 -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           Tue, 28 Apr 1998     Volume: 8 Number: 2441

Today's topics:
    Re: "Slurp"? <jc@ral1.zko.dec.com>
    Re: "Slurp"? <anonymous@matrox.com>
    Re: 'each' and recursion, do they mix? (Gurusamy Sarathy)
    Re: Binary Copy under Perl32 (Andrew M. Langmead)
        CGI help for a newbie mcad999@geb.meteo.fr
        CGI Newsgroup (was Re: Perl Scripts Newsgroup) (Abigail)
    Re: cgi-lib.pl or CGI.pm? <dfetter@shell4.ba.best.com>
    Re: Credit Card Verification scripts? <bmb@ginger.libs.uga.edu>
    Re: Credit Card Verification scripts? <rootbeer@teleport.com>
    Re: Defending Perl (Abigail)
    Re: Defending Perl (Mike Heins)
    Re: error opening Database file <bmb@ginger.libs.uga.edu>
    Re: Grabbing a webpage with Perl <jc@ral1.zko.dec.com>
    Re: If you solve this your are FANTASTIC! and it's some (Craig Berry)
    Re: image size for jpg and/or gif <jdf@pobox.com>
    Re: image size for jpg and/or gif <admin@hatsoft.com>
    Re: Just a thought... <jc@ral1.zko.dec.com>
    Re: New boy on the perl block (Abigail)
    Re: Odd Regexp Question (Abigail)
    Re: Odd Regexp Question <jdf@pobox.com>
    Re: Passing a Javascript cookie to a Perl/CGI script (Abigail)
        Perl Tutorial (Troy bull)
    Re: Perl Tutorial <brianm@kodak.com>
    Re: Permutations in hashes make Perl hurt (Abigail)
    Re: Permutations in hashes make Perl hurt (Tom Rokicki)
    Re: Print Currency <jdporter@min.net>
        Problem when terminating process started by system() ca <.@.>
    Re: Problem with Perl script (Probaply very simple) (Abigail)
    Re: QRe: == vs. eq (Andre L.)
    Re: Setuid tips aren't working! shapirojNOSPAM@logica.com
        Signal Trapping .. <anonymous@matrox.com>
        Text file transfers between OS's <mcs@in.net>
    Re: Text file transfers between OS's <andy@wonderworks.co.uk>
        Using '::' in variable names. (was Question on sorting) <bmb@ginger.libs.uga.edu>
    Re: where are the examples in the newer (blue) camel bo <sowmaster@juicepigs.com>
        Win32 Perl - Drag and Drop? (Pamela Culpepper)
        writing a format to a scalar. <foosejm@bp.com>
    Re: writing a format to a scalar. <cmargoli@world.northgrum.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Apr 1998 09:51:12 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: "Slurp"?
Message-Id: <3545DED0.5078835A@ral1.zko.dec.com>

Recommending using a module is likely a disservice here, when the original
message was pretty clearly asking for some basic info about perl.  The Slurp
module is useful for saving a few lines here and there, but using it isn't a
very good substitute for understanding what is going on.  

A more responsive answer would be to direct this "root" user to the part
of the documents that describe the <> operator, which is probably what
he/she was actually asking for.  The <> operator, of course, will slurp up
the entire contents of a file if called in array context.  So if F is an open
file, 
   $foo = <F>;
will deliver just one line from F, while
   @foo = <F>;
will read in the entire file and stuff it into the @foo array.  That's about
all there is to it, really, aside from the obvious warning that this can use
a lot of memory.   Little need for loading a module to do what can be
done with a two-character operator.

The main reason one might want to use the Slurp module is that you've
gotten tired of typing things like:
   open (F,$path) || croak "$0: Can't read $path [$!]\n";
   @foo = <F>;
   close F;
If you have the Slurp module installed, all this typing can be replaced by
   @foo = read_file($path);
plus of course the initial 
   use File::Slurp;
This is really only useful if you're slurping up files at several different
places in your program. For a small script that just reads one file, you 
won't save time (yours or the computers) by invoking the module.

For more information, dig around in your manual for a description of
the <> operator.   (And maybe you should send a note to the publisher
suggesting that they add "slurp" to the index in the next edition. ;-)

Irsan Widarto wrote:
> 
> DESCRIPTION
>  File::Slurp just reads and writes entire files with single commands
> 
> at http://theory.uwinnipeg.ca/CPAN/data/File-Slurp/ or your local CPAN.

> >I vaguely remember seeing a technique once where an entire input file
> >is read in with a single command, carriage returns and all.  My poor
> >memory also seems to think it was called "slurping" the file, but I
> >cannot find any reference to it in the camel book, the newsgroup, or
> >the FAQ.  Is there such a thing.  If so, how is it done (and what is
> >it really called)?
> >
> >Thank you.
> >
> >--
> >John Guthrie


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

Date: Tue, 28 Apr 1998 12:01:59 -0400
From: Anonymous <anonymous@matrox.com>
Subject: Re: "Slurp"?
Message-Id: <3545FD77.98A312CD@matrox.com>

Hmmmm.... I am not exactly an expert in this but you can do this ..

@file = <FILE>;

of course you should have your filehandle FILE defined.


> I vaguely remember seeing a technique once where an entire input file
> is read in with a single command, carriage returns and all.  My poor
> memory also seems to think it was called "slurping" the file, but I
> cannot find any reference to it in the camel book, the newsgroup, or
> the FAQ.  Is there such a thing.  If so, how is it done (and what is
> it really called)?


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

Date: 28 Apr 1998 16:00:35 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i4uf3$jq8@srvr1.engin.umich.edu>
Keywords: fractious Grayson multiplication pug

  [ mailed and posted ]

In article <6i4ink$mlo$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>In article <6i35ap$qtm$3@csnews.cs.colorado.edu>,
>>You could put it on the C<each> syntax node.  
>
>Yes, but the problem with putting anything on the syntax node in Perl
>is that each one is Yet Another Way in which perl subroutines are not
>real closures.  For example, [...]

You're ass_u_ming flaws that simply aren't there.  The association
with a node in the syntax tree would be implemented with a SV stashed
on the CV's pad.  Closure cloning makes a separate _copy_ of the 
entire pad for each clone (with some restrictions).  So, the other
poster's suggestion would work if implemented in the usual way.

That said, I'm sure you have some evidence of abnormalities wrt closures
to make these categorical statements.  Please check with the latest
devel versions, and feel free to send your observations to perlbug@perl.com.
Honest, we'll see if they can be fixed.

 - Sarathy.
   gsar@umich.edu




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

Date: Tue, 28 Apr 1998 16:52:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Binary Copy under Perl32
Message-Id: <Es4uvC.42z@world.std.com>

drummj@mail.mmc.org (Jeffrey R. Drumm) writes:

>My personal opinion is that fopen() should have text mode set for print and
>write, but not for syswrite (I think of syswrite as more of a "dammit, write
>what I meant, not what you think I meant" function). The binmode function would
>continue to do as it does now, though, and alter the behavior of print and
>write. But I'm sure that changinging this now would break a LOT of things . . .

The problem is that perl's syswrite() is just a small wrapper over the
C libraries write() (which on unix is a system call, but on MS-DOS is
a wrapper again over a system call.) and perl's print() is a call to
C's fwrite(), which eventually calls C's write() to perform the
work. It is in write() where the text/binary differentiation takes
place. (Assuming stdio and not some other I/O library.)

I guess syswrite() could set binary mode before the write() and
restore its previous value on exit, but do you want that kind of
overhead for a low level write()?

>I _have_ gotten into the habit of thinking of \n as 'newline', and representing
>the line termination character(s) for whatever platform I'm on.

>However, I think of chr(0x0A) as the line feed character, but Perl (or the C
>library it's compiled with) apparently thinks it's \n . . . which on Windoze is
>(chr(0x0D) . chr(0x0A)). In my mind, {print "some stuff",chr(0x0A)} and {print
>"some stuff\n"} should _not_ produce equivalent results.

Yeah, thats a pain. The problem here is that C's (and through
derivation perl's) newline is a single char, so the C library has to
convert the operating systems newline into a single character on
input, and so on output, the reverse needs to happen.
-- 
Andrew Langmead


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

Date: Tue, 28 Apr 1998 11:35:07 -0600
From: mcad999@geb.meteo.fr
Subject: CGI help for a newbie
Message-Id: <6i50gb$lgf$1@nnrp1.dejanews.com>

I am new to cgi scripting with perl.
I want my script to create a new file. But this generates
an "Internal Server Error: The server encountered an internal error
or misconfiguration and was unable to complete your request."

Anyone see anything that could help me ???

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 28 Apr 1998 15:21:16 GMT
From: abigail@fnx.com (Abigail)
Subject: CGI Newsgroup (was Re: Perl Scripts Newsgroup)
Message-Id: <6i4s5c$2ir$6@client3.news.psi.net>

Mikey Vaughan (mikey@in.net) wrote on MDCCI September MCMXCIII in
<URL: news:35457FD1.684F@in.net>:
++ Hello again,
++ 
++ Is there a specific newsgroup that can offer assistance for writing cgi
++ scripts??

Yes. It does have (surprise, surprise) "cgi" in its name.

The subject you choose is misleading.



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


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

Date: 28 Apr 1998 15:03:14 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: cgi-lib.pl or CGI.pm?
Message-Id: <6i4r3i$s29$1@nntp1.ba.best.com>

Martien Verbruggen <mgjv@comdyn.com.au> wrote:
> In article <6i38t7$a81$1@nntp1.ba.best.com>,
> 	David Fetter <dfetter@shell4.ba.best.com> writes:
> > Yong Huang <yong@shell.com> wrote:

> [snip]

> We knew that. What do you have to say, except a 10 line signature? :)

Oops.  My post was collateral damage from emacs and tin's battle for
control of my terminal.  I apologize.

Why to use CGI.pm instead of cgi-lib.pl:

 *  More Perl 5 features
 *  Arrays turn naturally into tables
 *  Database access goes smoothly with DBI, a Perl 5 feature
 *  CGI.pm is more flexible and extensible
 *  Support.  Those few who know much cgi-lib.pl don't brag about it.

OBTW, it's an 8 line signature ;)

D.
-- 
            David Fetter         888 O'Farrell Street Apt E1205
   shackle@ren.glaci.com          San Francisco, CA 94109-7089 USA
  http://www.best.com/~dfetter     +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)

The ad in the paper said 'Big Sale. Last Week.' Why advertise? I
already missed it. They're just rubbing it in.  
                                       Yakov Smirnoff


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

Date: Tue, 28 Apr 1998 11:12:27 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Credit Card Verification scripts?
Message-Id: <Pine.A41.3.96.980428110555.66756G-100000@ginger.libs.uga.edu>

A small word of caution.  I know plenty of adults whose guidance would not
necessarily keep you out of trouble.  Good Luck!

On Mon, 27 Apr 1998, Zisa wrote:
> Abigail wrote:
> > Maybe the best advice is: if you're new, don't do things like
> > dealing with credit card numbers.
> 
> The focus here is not credit card numbers but learning. I'm 12 and have
> plenty of time to get it right but it wont do me any good if you don't
> answer my questions. Don't worry, I have plenty of adult guidence to
> keep me out of trouble. I just need
> the information.

---
Brad Baxter, UGA



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

Date: Tue, 28 Apr 1998 16:50:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: zisa@ns.onramp.net
Subject: Re: Credit Card Verification scripts?
Message-Id: <Pine.GSO.3.96.980428094649.15049H-100000@user2.teleport.com>

On Mon, 27 Apr 1998, Zisa wrote:

> I'm 12 and have plenty of time to get it right but it wont do me any
> good if you don't answer my questions.

Being 12 is neither a crime nor an excuse; it's merely irrelevant. On
Usenet, no one knows you're a dog. :-)

In any case, c.l.p.misc is not a help desk. If no one answers your
questions, that's more likely to be your fault than ours! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 1998 15:01:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Defending Perl
Message-Id: <6i4qvs$2ir$1@client3.news.psi.net>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCI September
MCMXCIII in <URL: news:6i3nof$5ek$1@mathserv.mps.ohio-state.edu>:
++ [A complimentary Cc of this posting was sent to Abigail
++ <abigail@fnx.com>],
++ who wrote in article <6i3iur$ltl$2@client3.news.psi.net>:
++ > ++ > ++ what's so hard about
++ > ++ > ++ ./configure
++ > ++ > ++ make
++ > ++ > ++ make install
++ > ++ > ++ 
++ > ++ > ++ ????
++ 
++ > That doesn't work in my case; that is, if I want to make it pass the
++ > make install stage.
++ 
++ Abigail, what happened to you?  If you do not want `make install', do
++ not type it.
++ 
++ Or did I misparse what you said?

I dunno about you, but I generally download software for the sake
of using it, not to get a kick out of compiling it.

I *do* want to install Perl, but I have to run Configure to get
it installed right.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: 28 Apr 98 16:47:32 GMT
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Defending Perl
Message-Id: <35460824.0@news.one.net>

Abigail <abigail@fnx.com> wrote:
> Jason Gloudon (jgloudon@hyssop.bbn.com.bbn.com) wrote on MDCCI September
> MCMXCIII in <URL: news:slrn6kad77.jrt.jgloudon@hyssop.bbn.com>:
> ++ Abigail <abigail@fnx.com> wrote:
> ++ .
> ++ >Installing gcc is easy. You just follow the manual. You don't get
> ++ >questions which makes you wondering "what the f*ck is it asking me?"
> ++ 
> ++ I think the real problem is that the instructions about 'Configure -des' occur
> ++ too far into the INSTALL file.  This of course is only a problem if you don't
> ++ read all of INSTALL.

> No. That's not the problem.

> The problem is Configure -des guesses wrong.

There are of course ways to get around this if you know what the 
wrong guesses will be -- I usually pre-edit the hints file or create my
own. I also frequently use Configure -d and then edit config.sh when prompted.

The most common problem I have is Configure not recognizing when to
statically link an extension, and that is usually corrected easily by just
removing the extension name from dynamic_ext and putting it in static_ext.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Just because something is           131 Willow Lane, Floor 2  | ||  _ \
obviously happening doesn't         Oxford, OH  45056         | || |_) |
mean something obvious is           <mikeh@minivend.com>     |___|  _ <
happening. --Larry Wall             513.523.7621 FAX 7501        |_| \_\


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

Date: Tue, 28 Apr 1998 11:16:44 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: error opening Database file
Message-Id: <Pine.A41.3.96.980428111249.66756H-100000@ginger.libs.uga.edu>

Your syntax is opening for input, so yes, you do need to create the file
first.  Try 'man perlfunc' or 'perldoc -f open' for other syntax.

On Tue, 28 Apr 1998, Adam Klein wrote:
> I am trying to open an ascii database using perl and I keep getting this
> error.  The code that I am using is:
> open(DATABASE, "$database") || die "Content-type: text/html\n\nCannot open
> database! " . $database;
>   @database = <DATABASE>;
>   close(DATABASE);
> but I get an error returned in the browser that says that it can't open the
> database file.  Why is this happening?  Do I need to create the file first?
> How do I fix this problem?
> Please help :)
> Thank you,
> Adam

---
Brad Baxter, UGA



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

Date: Tue, 28 Apr 1998 10:00:08 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: Grabbing a webpage with Perl
Message-Id: <3545E0E8.9A5920AC@ral1.zko.dec.com>

scott@softbase.com wrote:
> 
> Chris (munu@munu.com) wrote:
> > Does anyone know how to have a Perl program get a web page?
> 
> I wrote this just the other day.  Take the example client in
> Programming Perl, and change it to go to port 80. Print:
> 
> GET /file.html HTTP/1.0
> 
> to the socket, and read what the socket gives you back. It
> should be the web page. (Or an error.)


It should be noted that if you just send the above GET command
with a single \n at the end, you won't get anything back at all.
You need \n\n at the end of a HTTP/1.0 GET request.  Otherwise
you'll sit there forever wondering when the data will arrive.


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

Date: 27 Apr 1998 16:42:12 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: If you solve this your are FANTASTIC! and it's something real simple (I think)
Message-Id: <6i2ch4$68h$1@marina.cinenet.net>

stevenf@pcdynamics.nl wrote:
: Check out the HTML code.
[snip]
: <form method=POST action="/cgi-bin/test.pl">
: <input type="Submit" name="submit" value="Submit">
: <input type=hidden name="picture" value="test.gif">
: <input type=hidden name="text1" value="This is a cool picture">
: <input type=hidden name="text2" value="It's a 325td BMW ">
: </form>
[snip]
: What I want it to do is, that it has to pas on the variables to the perl/cgi
: program.
: So that it will make a new HTML page with the picture and some text.

Untested...

  #!/usr/bin/perl -w

  use CGI qw( :all );

  print header,
        start_html('Demo page'),
        h1('Demo of CGI.pm goodies'),
        img({src => param('picture')}),
        p(param('text1')),
        p(param('text2')),
        end_html;

: If you can help me could you please send it to my email address because I
: can't read the newsgroup from my PC at work!

You got here once, you can get here again... :)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 28 Apr 1998 11:34:25 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Henry Wolff" <admin@hatsoft.com>
Subject: Re: image size for jpg and/or gif
Message-Id: <vhrtzyzy.fsf@mailhost.panix.com>

[psted and mailed]
"Henry Wolff" <admin@hatsoft.com> writes:

> > make install
> result:
> You do not have permissions to install into
> /usr/libdata/perl5/site_perl/i386-bsdos at -e line 1
> *** Error code 2

Ah, you just need to read perlfaq8, "How do I keep my own
module/library directory?"

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Tue, 28 Apr 1998 09:38:44 -0700
From: "Henry Wolff" <admin@hatsoft.com>
Subject: Re: image size for jpg and/or gif
Message-Id: <354605c3.0@news.greatbasin.net>

>perl5 Makefile.PL PREFIX=/libs
Worked Ok
>make && make test
Worked Ok
>make install
You do not have permissions to install into
/usr/libdata/perl5/site_perl/i386-bs
dos at -e line 1
*** Error code 2

Could it be something in the perl setup? The /user/bin/perl is a 4 version
so you have to type perl5 to get it to compile right. Is there a different
make for perl5 maybe?

Henry Wolff
Send Some Virtual Postcards - FREE
http://www.hatsoft.com/webcard/index.html





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

Date: Tue, 28 Apr 1998 10:36:18 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: Just a thought...
Message-Id: <3545E962.EA2DB5A1@ral1.zko.dec.com>

Tom Christiansen wrote:

> Now, to the subject: Political correctness is loathesome.
> Changing the name of something just because somebody
> bitches is so, is so, I dunno, Californian?  American?
> Whatever it is, it's stoooopid.  I won't play that game.

While I'd agree in general, in this case I think you're over-reacting.
The "CE/BCE" notation has been around for much longer than
any of us have; it dates back to at least the mid-1800's, if not
earlier.  And in some scholarly fields (especially among historians)
its use is quite conventional, and not PC at all.  It's likely that you
could get quite a lot of historians to agree that the use of "BC/AD"
is a sign that the writer is either 1) writing for the general public
or 2) religious, and in either case their scholarly credentials are
somewhat suspect.  (Of course, this is an exceedingly snobbish
attitude, but I think you'll find it common. ;-)  

In any case, even most of the religious scholars seem to now
agree that, whenever Jesus was born (if he even actually ever
existed), the most likely birth date was in 3 or 4 BC(E), so the
Western calendar is not actually based on his birth date, but on
a medieval scholar's mistaken calculations.

And to get back on topic somewhat, we could point out that the
suggestion that we date things from 1970 is not at all a radical
idea.  That's what all Unix-like systems do, after all.Of course,
we also have all those library routines to translate Unix time to
the Western calendar (and a few other calendars, for that matter).
But internally, a good fraction of the existing computer systems
are using 1970-based dates routinely.

I also haven't seen anyone mention the dating scheme that
astronomers use.  That might be a real good alternative.  And
it's a good illustration of the way that an alternative calendar
can become established within a population when there are
real problems with the "standard" calendar.

I wonder if we could get a movement going to use Unix timestamps
openly in messages as a "standard" way of specifying dates and
times?  It'd be interesting to see the public reaction (if any).

X-posted-at: 893774168   ;-)


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

Date: 28 Apr 1998 15:14:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: New boy on the perl block
Message-Id: <6i4rp4$2ir$3@client3.news.psi.net>

Richard Cooper (RCooper@rnib.org.uk) wrote on MDCCI September MCMXCIII in
<URL: news:6i4413$f2c$1@flex.news.pipex.net>:
++ I am using a combination of perl, IDC/HTX and Active Server Pages to
++ query a database.  The database if basically a product catalogue and
++ ordering system.  I only want at the moment verified past customers to
++ place orders, so I need to verify the customers identification at the
++ beginning before they are allowed to place an order. 
++ 
++ Has anyone got any good suggestions as to what techniques  are best to
++ use to verify the customer is valid, stop anyone else from ordering,
++ keep a record of the customer identification throughout there
++ ordering, quering of stock and ordering session.


I think a customer is valid if and only if the name starts with 
an 'A'. That makes a pretty good perl function to check:

        sub is_valid ($) {
            my $name = ucfirst shift or die "This is horrible!";
            'A' eq substr $name, 0, 1;
        }



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 28 Apr 1998 15:17:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Odd Regexp Question
Message-Id: <6i4rup$2ir$4@client3.news.psi.net>

Derek Balling (dballing@speedchoice.com) wrote on MDCCI September
MCMXCIII in <URL: news:82E778210F2134E4.2D55884FF8E43598.17BACF09A2DD9CCD@library-proxy.airnews.net>:
++ OK, I'm parsing a message which will contain two different
++ strings "123456-12" and "987654" (actual numbers will vary,
++ of course).
++ 
++ Right now I'm doing:
++ 
++ ($number_1) = /(\d{6}\-\d{2})/
++ ($number_2) = /(\d{6})[^\-]/
++ 
++ (I know that they will not appear in the midst of a
++ seven-digit or anything like that, so I'm not concerned
++ about what appears on either side, EXCEPT that this won't
++ detect $number_2 if it appears at the very end of the
++ string.
++ 
++ You're looking for 123456
++ 
++ There is no non-"-" character afterward, so it fails.
++ 
++ Any thoughts on how to achieve this? Can I do something
++ like:
++ 
++ ($number_2) = /(\d{6})([^\-]|$)/  
++ 
++ telling it to match 6 digits next to either a non-"-" or the
++ end of the string? I didn't think that would work, but I'm
++ open to suggestions.


What happened when you tried?


But in general, if you want to say something not followed by 
something else, look up the (?! ) syntax in perlre.


Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: 28 Apr 1998 11:50:59 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Derek Balling <dballing@speedchoice.com>
Subject: Re: Odd Regexp Question
Message-Id: <somxzy8c.fsf@mailhost.panix.com>

[posted and mailed]
Derek Balling <dballing@speedchoice.com> writes:

> Any thoughts on how to achieve this? Can I do something
> like:
> 
> ($number_2) = /(\d{6})([^\-]|$)/  
> 
> telling it to match 6 digits next to either a non-"-" or the
> end of the string? I didn't think that would work, but I'm
> open to suggestions.

Umm, Derek, did you *try* it?  It would have worked.  But, since you
asked, I'll say that

  you don't need to escape the '-' character

  you could use a zero-width lookahead assertion (instead of a
  capture)

      ($foo) = /(\d{6})(?=[^-]|$)/;
  
See perlre.
                       
-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 28 Apr 1998 15:19:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Passing a Javascript cookie to a Perl/CGI script
Message-Id: <6i4s1c$2ir$5@client3.news.psi.net>

Alan McCoy (a.r.mccoy@larc.nasa.gov) wrote on MDCCI September MCMXCIII in
<URL: news:6i4k5b$pn4$1@reznor.larc.nasa.gov>:
++ I have a page that uses JavaScript to create a cookie with the user's most
++ recent query data.  How can I retrieve and use that same cookie later in a
++ Perl or CGI script to run a search with that query?

Perl doesn't care who created the cookie. In fact, Perl doesn't
know what cookies are. They are just an environment variable
set by the the server.

use CGI; and read the documentation.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Tue, 28 Apr 1998 15:15:20 GMT
From: troy.bull@uni.edu (Troy bull)
Subject: Perl Tutorial
Message-Id: <3545f224.68376420@news.uni.edu>

I am an experienced programmer.  I have worked with C/C++ UNIX and
many other tools.  I have never taken the time to learn PERL.  I have
decided to allocate some time over the next few months to learning it.
Where is the best on line tutorial I don't need any programming
theory, just syntax, tips and tricks.

Thanks
Troy


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

Date: Tue, 28 Apr 1998 12:13:07 -0400
From: Brian Mathis <brianm@kodak.com>
To: Troy bull <troy.bull@uni.edu>
Subject: Re: Perl Tutorial
Message-Id: <35460013.1E5EC2A7@kodak.com>

Troy bull wrote:
> 
> I am an experienced programmer.  I have worked with C/C++ UNIX and
> many other tools.  I have never taken the time to learn PERL.  I have
> decided to allocate some time over the next few months to learning it.
> Where is the best on line tutorial I don't need any programming
> theory, just syntax, tips and tricks.
> 
> Thanks
> Troy

There's loads of documentation that comes with the perl dist.  use
'perldoc perl' to get an index of available pages.  'perldoc perlfunc'
might be of particular interest to you.  You should also look at
www.perl.com.

Brian Mathis


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

Date: 28 Apr 1998 15:08:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i4rdg$2ir$2@client3.news.psi.net>

Mark-Jason Dominus (mjd@op.net) wrote on MDCCI September MCMXCIII in
<URL: news:6i4la8$n5p$1@monet.op.net>:
++ 
++ 5. If Perl had an operator for selecting the number of buckets or the
++    hash function, you could use it here.  Then you could say
++ 
++ 	number_of_buckets %hash, 33;    # Instead of 8
++ 
++    and then your program wouldn't hurt so much.  

You mean  
        keys %hash = 33;    # Use at least 33 buckets.
?



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 28 Apr 1998 08:23:53 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i4sa9$9ph@cello.hpl.hp.com>
Keywords: algae ducat moribund replete

> for ( ; *s; s++) {
>           hash = hash * 33 + *s;
> }

Actually, it's something like

   hash = strlen(s) ;
   while (*s) hash = hash * 33 + *s ;

Changing it from 33 to 34 will probably only make it worse.  But other
multipliers might indeed help.

Something like

   hash = strlen(s) ;
   while (*s) hash = *s - hash * 33 ;

might also work much better.

I'm looking at this with an eye towards the sorted bucket idea so that
hash iterators could be set and restored in the presence of mutating
hashes; in order to do this, the hash function might need to change
anyway.

And just for clarification:  all of the

   keys %h = big-number-here

won't solve the problems with some set of keys such as permutations,
since the hash function simply always yields highly skewed values for
such strings.  Another example is 'az', 'by', ..., 'za', or numbers
that are `checksummed' (student id's with a checksum digit such that
the sum of the digits is always a multiple of ten, for instance).

On another topic:  keys() might work better than each() for certain
sizes of hashes and on certain machines simply because of data cache
locality issues . . .

-tom


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

Date: Tue, 28 Apr 1998 15:29:32 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Print Currency
Message-Id: <3545F73D.FD3@min.net>

M-J, I had an idea (in my sleep, I think), that you ought to
include predefineds for many of the perl intrinsic functions,
like length() and ref().  I find myself trying to print those
all the time.

John Porter


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

Date: Tue, 28 Apr 1998 17:21:18 +0100
From: "Chris" <.@.>
Subject: Problem when terminating process started by system() call
Message-Id: <893780594.16387.0.nnrp-11.9e9817ab@news.demon.co.uk>

Hi.

I've got a script to open a text file in an editor at a specific line number
by clicking on a link or submit button in an HTML form. The name of the file
to open and the line number at which to open it are passed via hidden form
input variables. I'm using O'Reilly Website 1.1e, with Perl 5.003 under
NT4.0.

I can open files in the editor correctly via the script, but when I close
the editor I get a Server Error 500, with the message

                "Empty output from CGI program c:/www/cgi-bin/pfe3.pl".

I don't want the page containing the form I called the script from to change
in the browser- I just want to start the text editor as a new separate
process, then terminate the script. I've tried calling the editor executable
via exec() and system(), but get the same result. It runs OK on the command
line though.

Here's my script: (Don't be confused by the forward slashes - I use a Unix
shell emulator on the PC).

---------------------------------------------------------------------
#! /usr/binw/perl
push(@INC,"c:/www/cgi-bin");
#
# Using CGI-LIB.PL v2.12
#
require("cgi-lib.pl");
#
# Parse the forms input data
#
&ReadParse;
#
# Return appropriate MIME type to browser
#
print "Content-type: application/x-perl\n\n";
#
# Open the specified file in PFE at the desired line number
#
system("c:/utils/pfe/pfe32.exe /m /g $in{'lnum'} $in{'fname'}");
---------------------------------------------------------------------

If I've made any glaring error's I apologise - I'm new to Perl (but I've
aleady read the FAQ's!)

Can anyone offer any advice?

TIA,
     Chris.





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

Date: 28 Apr 1998 15:27:13 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Problem with Perl script (Probaply very simple)
Message-Id: <6i4sgh$2ir$7@client3.news.psi.net>

stevenf@pcdynamics.nl (stevenf@pcdynamics.nl) wrote on MDCCI September
MCMXCIII in <URL: news:6i48aj$ds6$1@nnrp1.dejanews.com>:
++ 
++ The problem is that I'm getting an : Internal Server Error 500

And the message in the error log is?



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Tue, 28 Apr 1998 12:44:23 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: QRe: == vs. eq
Message-Id: <alecler-2804981244230001@dialup-392.hip.cam.org>

In article <6i3kid$j86$2@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:

> In article <35453A24.FC967A05@coos.dartmouth.edu>,
>         Ronald J Kimball <rjk@coos.dartmouth.edu> writes:
> : Yes, a lot of unintelligent posts are made from web browsers.  Perhaps
that is
> : because so many posts are made from web browsers in general.  Until I see a
> : conclusive set of statistics, I refuse to accept this foolish stereotype.
> 
> The problem is that your denying the claim doesn't do anything.  The
> heuristic is already widely accepted among most of clpmisc's regular
> answerers.  (Has anyone yet resorted to killing based on the
> son-of-1036 forsaken X-Newsreader: header?)  


If this was a stockbrokers newsgroup, we'd hear things like: "Don't mind
that loser, he drives a Neon..."

A.L.


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

Date: Tue, 28 Apr 1998 12:00:46 -0400
From: shapirojNOSPAM@logica.com
Subject: Re: Setuid tips aren't working!
Message-Id: <MPG.fafc73abe60be89989680@news.logica.co.uk>

Just a mention of an interesting setuid fact. On AIX (I beleive version 
4.2 and above) scripts will not run in setuid mode. A script, I think, is 
any thing with #!/usr/bin/<your favorite script interpreter here> as the 
first line. So a Perl script wouldn't be able to setuid, while compiled C 
could. I wonder if this isn't happening in this case

jonathan shapiro



In article <Pine.GSO.3.96.980422150952.6132w-100000@user2.teleport.com>, 
rootbeer@teleport.com says...

> On some systems, the webserver runs as user nobody. If user nobody is uid
> -1 (or 65535), some systems (such as Linux) won't allow that user to
> change uids, as a security precaution. On those systems, setid scripts
> still run as nobody. For this reason, some webmasters make a user 'noone'
> which is id -2 (or 65534), and which can properly run setid scripts. 
> 
> > The exact same program translated into C works fine.
> 
> If C can do this, but Perl can't, your perl binary may be miscompiled. For
> example, was it compiled to do setid emulation? My guess is that it
> wasn't, so you don't have an sperl or suidperl binary. Recompile, and this
> may work for you. 
> 
> Hope this helps!
> 
> -- 
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
> 
> 


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

Date: Tue, 28 Apr 1998 11:59:05 -0400
From: Anonymous <anonymous@matrox.com>
Subject: Signal Trapping ..
Message-Id: <3545FCC9.B3D01964@matrox.com>

Hi .. I started learning Perl less than 3 weeks ago .. and I need some
help.

I am trying to trap a signale (SIGINT to be specific) and cause that to
exist the current subroutine I am in (call it &current_subroutine). I
use something like

$SIG{INT} = \&another_subroutine;

This conveniently traps the Ctrl-C signal and invokes
another_subroutine(). But once that is over, current_subroutine()
continues executing. How can I cause the Ctrl-C signal to exit the
current_subroutine()?

NB. The current_subroutine is called from the main body of the program
 .. that is where I want the execution to continue.

ThanX,

Ala Qumsieh


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

Date: Tue, 28 Apr 1998 11:17:59 -0500
From: Mark Schwartz <mcs@in.net>
Subject: Text file transfers between OS's
Message-Id: <35460137.BB97FF4A@in.net>

About a year ago I encountered the following problem.  While teaching
myself Perl,
I copied a script from a CDROM onto my Linux box.  The script refused to
run.
When I manually typed the exact (*very* small) script, it ran fine.
Rather then figure
out why that happened, I used the experience to force myself to learn
how to use vi,
which I needed to do anyway.

I have since developed an entire Web site for my employer using
Linux/Apache/Perl5.
*Everything works*

My employer wants me to get everything running under NetWare 4.11/Novell
Web Server 3.1.
(Don't ask :-(

I mounted a DOS formatted floppy and copied all my Perl scripts and
HTML.  I then copied
everything onto the NetWare server in the office.  The straight HTML
works fine, but
the scripts keep erroring out.  After lengthy, fruitless discussions
with Novell Tech Support,
I decided to type, from scratch, using EDIT.COM, one of the scripts.  As
soon I did that,
the script worked flawlessly.

Since I am not inclined to re-type 40 odd pages of scripts all over,
could someone please tell
me is there some procedure, or flag/switch that I need to toggle when
copying text files over
to a DOS floppy under Linux.  Novell opened the file under a 'real' text
editor which displays
hidden characters, etc.  and it showed nothing.  But when they re-typed
it from scratch, it ran
for them as well.  I have tried opening and re-saving the copied files
under two different text
editors, but to no avail.

Thanks.

Sincerely,

Mark Schwartz
mcs@in.net



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

Date: Tue, 28 Apr 1998 17:36:31 +0100
From: Andy Armstrong <andy@wonderworks.co.uk>
Subject: Re: Text file transfers between OS's
Message-Id: <IJAPWIAPWgR1Ewlt@wndrwrks.demon.co.uk>

In article <35460137.BB97FF4A@in.net>, Mark Schwartz <mcs@in.net> writes

[snip]

>Since I am not inclined to re-type 40 odd pages of scripts all over,
>could someone please tell
>me is there some procedure, or flag/switch that I need to toggle when
>copying text files over
>to a DOS floppy under Linux.  Novell opened the file under a 'real' text
>editor which displays
>hidden characters, etc.  and it showed nothing.  But when they re-typed
>it from scratch, it ran
>for them as well.  I have tried opening and re-saving the copied files
>under two different text
>editors, but to no avail.

Assuming you're talking about line endings why not just knock up a Perl
script to fix all the files?

-- 
http://www.wonderworks.co.uk --> Free RISC OS software
Andy Armstrong, WonderWorks


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

Date: Tue, 28 Apr 1998 11:05:29 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Using '::' in variable names. (was Question on sorting)
Message-Id: <Pine.A41.3.96.980428104823.66756F-100000@ginger.libs.uga.edu>

Very interesting.  All this time I thought only letters, numbers and
underscores were valid in variable names (aside from the special
variables, and aside from those fully qualified with the package name).
However, the following script appears to do what you would expect (though
I'm not sure it's really doing only what it appears to be doing :-):

#!/usr/local/bin/perl -w
use strict;
$str:: = "hey\n";
print $str::;

I do see in the Camel book, "The symbol table for a package happens to be
stored in a hash whose name is the same as the package name with two
colons appended."  Since perl is doing this for me, I guess I assumed that
perl could use the double-colon, but not me--I just never tried it.

New question: Assuming I name variables this way (unlikely), am I asking
for trouble doing so?


On Mon, 27 Apr 1998, Ronald J Kimball wrote:
> Brad Baxter wrote:
> > Now I am curious.  The two "Use of uninitialized ..." messages above
> > make me wonder how perl is interpreting the first quoted string:
> > "$one::$two::$tre\n";
> "${one::}${two::}$tre\n";

---
Brad Baxter, UGA



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

Date: Tue, 28 Apr 1998 12:34:50 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: where are the examples in the newer (blue) camel book?
Message-Id: <3546052A.6D1A@juicepigs.com>

Lloyd Zusman wrote:
> 
> Randal Schwartz <merlyn@stonehenge.com> writes:
> 
> > >>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
> >
> > Tom> Randal pumps himself:
> > >> As I was shepherding the new Camel through the final months of writing
> > >> (as lead writer), I had to make some tradeoffs given the limited
> > >> resources we had.
> >
> > Tom> Funny, I would have bet money that Larry was lead writer on the
> > Tom> Camel.  And you know something?  I bet he would, too.
> >
> > Tom> Larry's name isn't first on the author list out of some sense of
> > Tom> misplaced vanity.  It's because he did the most work, and also had
> > Tom> ultimate editorial control.
> >
> > Tom> Please give him due credit next time.
> >
> > Tom, stop making this a public battle.
> >
> > I was *lead* writer on the project.  [ ... ]
> >
> > [ ... etc. etc. etc. ... ]
> 
> To *both* of you: is it really necessary to air this in public?

Atleast they haven't taken it to Jerry Springer or Ricki Lake yet. :)

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 28 Apr 1998 16:15:22 GMT
From: culpep@bcm.tmc.edu (Pamela Culpepper)
Subject: Win32 Perl - Drag and Drop?
Message-Id: <6i4vaq$m2k@gazette.bcm.tmc.edu>

Using MacPerl, I can drag whatever file I want to
process over the MacPerl camel icon and start Perl
using that file.

Can I do the same thing using Perl on Win32?

Thanks,
Pam
-- 
Pamela A. Culpepper                               Senior Systems Analyst  
Baylor College of Medicine        phone: 713/798-3733  fax: 713/798-6521
Houston, Texas 77030                                  culpep@bcm.tmc.edu


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

Date: 28 Apr 1998 15:46:35 GMT
From: "Joe Foose" <foosejm@bp.com>
Subject: writing a format to a scalar.
Message-Id: <01bd72bc$b69b6fa0$3f8a63a1@amervw29436.clv.am.bp.com>

How does one go about writing a format to a scalar variable rather than to
a filehandle without having to use an intermediate file?  Is there a way to
associate a filehandle with a scalar variable?  Any help appreciated. 
Thanks, joe.



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

Date: Tue, 28 Apr 1998 16:20:14 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: writing a format to a scalar.
Message-Id: <354601BE.6C4A@world.northgrum.com>

Joe Foose wrote:
> 
> How does one go about writing a format to a scalar variable rather than to
> a filehandle without having to use an intermediate file?  Is there a way to
> associate a filehandle with a scalar variable?  Any help appreciated.
> Thanks, joe.

How about the 'formline' builtin function?
-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

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

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