[6962] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 587 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 8 12:22:59 1997

Date: Sun, 8 Jun 97 09:00:26 -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           Sun, 8 Jun 1997     Volume: 8 Number: 587

Today's topics:
     Re: a real easy question (Bob Apthorpe)
     Re: a real easy question (Simon Hyde (aka Jeckyll))
     Re: a real easy question (Tad McClellan)
     Any pd perl script for class enrolment (Pui Ming WONG)
     Bizarre error (Gene Johannsen)
     Re: Bizarre error (Tad McClellan)
     BSD3.0 and Perl <khanmore@ultra.net.au>
     Re: call perl script from c program? <methanol@cyberwar.com>
     Re: Case Conversion (Tung-chiang Yang)
     Re: Checking if write to file is complete (Pythagoras Watson)
     Re: DB_File not recognizing external updates? (Paul Marquess)
     Re: Introductory Comparison of Perl and Python <rjm@theory.chem.ubc.ca>
     Re: most *robust* DBD::DBI/database combination ( <1M r (Alligator Descartes)
     Need ressources <groupe@dri.qc.ca>
     Parsing Comma Delemited Text DataBase <nzawawi@worldnet.att.net>
     Re: PERL assistance w/NT ("John Dallman")
     Re: Perl Camel Book (Andrew Starr)
     Re: Perl obfuscated contest <ajohnson@gpu.srv.ualberta.ca>
     Re: Reading (creating) compressed files (Paul Marquess)
     Redirection and timing out (William L Harrison)
     Re: Shared DBM files (Paul Marquess)
     sockets select() problem (Ruben Mendes)
     Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
     Re: String Compare Problem (Tad McClellan)
     trace mode - ksh equivalent of -x <zev@telaviv.ndsoft.com>
     Re: Upload security?? (Tung-chiang Yang)
     Writing a DBD driver: How? <gucsv@gd.gu.se>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 08 Jun 97 08:59:25 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: a real easy question
Message-Id: <5nds9f$hij@news.jump.net>

In article <01bad896$c7884300$73053cc3@surgery.powernet.co.uk>,
   "DAVID GILMARTIN" <david@gilmartin.uk.com> wrote:
>this cgi works
>
>what i want is to make the output a html file
>
>what do i have to add
>
>
>#!/bin/perl
>
>@my_name = ("Eric ","C. ","Herrmann");
>
>$myName[0] = "Scott ";
>$myName[1] = "E. ";
>$myName[2] = "Herrmann";
>
>print "content-type: text/html\n\n";
>
>print "Hello World @my_name wrote this\n";
>print "Really @myName wrote this\n";
>print "No Kidding $my_name[0] $my_name[1] $my_name[2] wrote this!\n";

There will probably be a bunch of responses to this. Or not. No matter.

Response #1:

Use the -w flag. Perl probably has something unpleasant but helpful to say if 
only you give it a voice.

Response #2:

Do you want this:
   print "Hello World @my_name wrote this\n";
or
   print "Hello World ", @my_name, " wrote this\n";

It's a matter of context. "_whatever_" is a scalar context; when you evaluate 
@something in a scalar context, you shouldn't be too surprised when you get 
scalar(@somthing) {the number of items in the list) as a result. Since print 
expects a list context, it will treat @something as, well, @something.

Backing up:

print "Hello World @my_name wrote this\n";
   is equivalent (I think) to
print "Hello World ", scalar(@my_name), " wrote this\n";

and

print "Hello World ", @my_name, " wrote this\n";
   is equivalent to
print "Hello World ", $my_name[0], $my_name[1], $my_name[2], " wrote this!\n";

Have fun,

Bob

Bob


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

Date: Sun, 08 Jun 1997 13:03:38 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: a real easy question
Message-Id: <339cabe7.9103282@news.uni-stuttgart.de>

On Sun, 08 Jun 97 08:59:25 GMT, arclight@io.com (Bob Apthorpe) wrote:

>Do you want this:
>   print "Hello World @my_name wrote this\n";
>or
>   print "Hello World ", @my_name, " wrote this\n";

Doesn't really matter they both produce virtually the same output. In fact since the first
will stick a space between each of the elements it produces better output

>
>It's a matter of context. "_whatever_" is a scalar context; when you evaluate 
>@something in a scalar context, you shouldn't be too surprised when you get 
>scalar(@somthing) {the number of items in the list) as a result.
scalar(@something) ne "@something"
"@something" eq join($",@someting)
normally $" eq " ";

>print "Hello World @my_name wrote this\n";
>   is equivalent (I think) to
>print "Hello World ", scalar(@my_name), " wrote this\n";

no, no, no, you think wrong.

>print "Hello World ", @my_name, " wrote this\n";
>   is equivalent to
>print "Hello World ", $my_name[0], $my_name[1], $my_name[2], " wrote this!\n";
true
and
print "Hello World @my_name, wrote this!\n";
is equivalent to
print "Hello World ",$my_name[0],$",$my_name[1],$",$my_name[2]," wrote this!\n";


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

Date: Sun, 8 Jun 1997 08:39:46 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: a real easy question
Message-Id: <2ncen5.nq.ln@localhost>

Bob Apthorpe (arclight@io.com) wrote:
: In article <01bad896$c7884300$73053cc3@surgery.powernet.co.uk>,
:    "DAVID GILMARTIN" <david@gilmartin.uk.com> wrote:


[ snip ]


: >#!/bin/perl
: >
: >@my_name = ("Eric ","C. ","Herrmann");
: >
: >$myName[0] = "Scott ";
: >$myName[1] = "E. ";
: >$myName[2] = "Herrmann";
: >
: >print "content-type: text/html\n\n";
: >
: >print "Hello World @my_name wrote this\n";
: >print "Really @myName wrote this\n";
: >print "No Kidding $my_name[0] $my_name[1] $my_name[2] wrote this!\n";

: There will probably be a bunch of responses to this. Or not. No matter.

: Response #1:

: Use the -w flag. Perl probably has something unpleasant but helpful to say if 
: only you give it a voice.

: Response #2:

: Do you want this:
:    print "Hello World @my_name wrote this\n";
: or
:    print "Hello World ", @my_name, " wrote this\n";

: It's a matter of context. "_whatever_" is a scalar context; when you evaluate 
: @something in a scalar context, you shouldn't be too surprised when you get 
: scalar(@somthing) {the number of items in the list) as a result. Since print 
: expects a list context, it will treat @something as, well, @something.


Ah, but print() and double quotish things are a different case.


: Backing up:

: print "Hello World @my_name wrote this\n";
:    is equivalent (I think) to
: print "Hello World ", scalar(@my_name), " wrote this\n";


???

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

@my_name = ("Eric ","C. ","Herrmann");

print "Hello World @my_name wrote this\n";                   #1

print "Hello World ", scalar(@my_name), " wrote this\n";     #2
--------------------

Output:

Hello World Eric  C.  Herrmann wrote this
Hello World 3 wrote this

Not equivalent...


in #1)

@my_name is interpolated, and the value of the $" special variable
(space, by default) is printed between each array element.

from the perlvar man page:

----------------------
=item $LIST_SEPARATOR

=item $"

This is like "C<$,>" except that it applies to array values interpolated
into a double-quoted string (or similar interpreted string).  Default
is a space.  (Mnemonic: obvious, I think.)
----------------------



: and

: print "Hello World ", @my_name, " wrote this\n";
:    is equivalent to
: print "Hello World ", $my_name[0], $my_name[1], $my_name[2], " wrote this!\n";


That is equivalent if @my_name contains exactly three elements (as it
does in this particular example, but they are not generally equivalent)

[ they are also not equivalent, you have an extra '!' in the 2nd one... ;-)
]


: Have fun,

If you are writing a Perl program, then you _are_ having fun ;-)


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


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

Date: 8 Jun 1997 06:49:03 GMT
From: s11976@net2.hkbu.edu.hk (Pui Ming WONG)
Subject: Any pd perl script for class enrolment
Message-Id: <5ndkkv$5jc$1@power42t.hkbu.edu.hk>

I'm a newbie in perl (i usually write shell script for my tasks).
Now i'm asked to write a cgi-bin perl script which is mainly for
students enrolling for their places in different class-sessions.
The thing is simply to have one file for each session , and when
the student fill in his name and preferred session, his name will
be appended to the corresponding file.
(One more thing is to limit the no. of people enrolling when the
max. seat is reached)
I think i could struggle thru and write a not so clever and cumbersome
perl script. yet if there's something similar out there i could get
, it'll be handy. (And i'm not too confident about file-locking
statments)
Pls suggest some site with such scripts
--
        __
   / \_/  )             __   Pui Ming WONG (E-mail: pm@hkbu.edu.hk) 
  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University 
   \_/ \__)                  224 Warerloo Road, Hong Kong 


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

Date: 8 Jun 1997 05:43:30 GMT
From: gej@spamalot.mfg.sgi.com (Gene Johannsen)
Subject: Bizarre error
Message-Id: <5ndgq2$bgc$1@murrow.corp.sgi.com>

Hey:

I got this error from a script:

    Bizarre copy of CODE in leavesub at /usr/asrs/mack.pl line 514

Line 514 of mack.pl looks like this:

    return unless get_crane_status( &INBOUND_FULL ) == &YES;

Can anyone explain this to me?

gene


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

Date: Sun, 8 Jun 1997 08:43:03 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Bizarre error
Message-Id: <7tcen5.nq.ln@localhost>

Gene Johannsen (gej@spamalot.mfg.sgi.com) wrote:
: Hey:

: I got this error from a script:

:     Bizarre copy of CODE in leavesub at /usr/asrs/mack.pl line 514

: Line 514 of mack.pl looks like this:

:     return unless get_crane_status( &INBOUND_FULL ) == &YES;

: Can anyone explain this to me?


You mean beyond the explanation of the error message that is given
in the perldiag man page?


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


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

Date: Sun, 08 Jun 1997 14:41:19 +1000
From: Karl Hanmore <khanmore@ultra.net.au>
Subject: BSD3.0 and Perl
Message-Id: <339A37EE.37B@ultra.net.au>

Hi All,	
	I have hit a brick wall, and was wondering if any of you can help. 
Recently, we upgraded our operating system to BSDi3.0, and to my dismay,
the "bind" function under perl broke.  Next, I re-installed Perl5.004,
to no avail.  So I tried the contributed src off of the BSDi CD Roms,
still no go.  Does anyone have any ideas??  I am really stuck.

If you do have any ideas/experience with this problem, could you
possibly email me at avatar@ultra.net.au.

Any and all help will/would be greatly appreciated.



Regards, 	
	Karl


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

Date: 7 Jun 1997 17:47:59 GMT
From: "Methanol" <methanol@cyberwar.com>
Subject: Re: call perl script from c program?
Message-Id: <01bc7373$202721c0$788058ce@wacked.cyberwar.com>



Chun Xu <xuc@bayfront.org> wrote in article <3397000A.517A@bayfront.org>...
> I have two cgi programs, one written in c, another in perl.  Now, the C
> program needs to use a subroutine in the perl script.  Is it possible to
> call the perl script in the c program?    
> 
> Thanks a lot.
> 
> --Chun Xu
> 
Yes,
Just chmod +x  the perl subroutine into a small program and use the system
command in C to call it, like:
char *perlcommand ="theperlprogram";
system(perlcommand);
							Good Luck,
							Methanol


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

Date: Sun, 8 Jun 1997 06:19:27 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Case Conversion
Message-Id: <tcyangEBG1KF.D3x@netcom.com>

Well, if you feel he/she is doing his/her homework, this should be good
enough for him/her :)

==============================
Tom Phoenix typed when the mommy tyrannosaurus found him/her:
: On Fri, 6 Jun 1997, Tung-chiang Yang wrote:

: > tr/A-Za-z/a-zA-Z/;

: That's not going to work on accented characters.

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: 8 Jun 1997 03:54:34 GMT
From: py@ecst.csuchico.edu (Pythagoras Watson)
Subject: Re: Checking if write to file is complete
Message-Id: <5ndadq$bhn@charnel.ecst.csuchico.edu>

According to Glen Culbertson  <nnyxcu@ny.ubs.com>:
:Andrey Zmievski wrote:
:> I need to write a script that when periodically launched by cron will
:> check a certain directory for all the new files since the last time it
:> checked and do a certain operation on those files.  The files in the
:> directory will be ftp'ed from outside.  But! if a file is still being
:> written to, I don't want to do that operation on it.
:> 
:> So, how can I check if a file is currently being modified or written to?
:
:We run into this situation quite a bit, since we get sent a goodly number
:of files at odd times. The best thing that we have found to do is to check
:the size of the file, and then in a loop sleep a while, and check the size
:again. When the size of the file stops increasing between checks, we then
:assume that it is done.  This is not elegant, but we haven't found
:anything better.
:
:I would love to hear from anyone with something more slick.

Well, here are a few additional options, whether they are more slick or
not, I will leave for you to determine.

  1) If I have control over the upload process, I prefer to upload the file
     under one name, and then when the upload is done, issue a rename
     request from the original name to the name that the cron job will look
     for.  Note that this can be extended to a directory, so multiple files
     can be easily handled without having to rename them all.  Depending on
     your constraints (is it alright to miss a version, do all new files
     need to be the same version, etc.), the cron job can just use the
     renamed files or instead may want to rename them again.

  2) Modify the ftp server to do file locking, and then modify the cron job
     to do the same kind of locking.

  3) In addition to size and/or modification time checks, a check of the
     process list for the ftp from remote site may be of some use.
-- 
Py -- 3.141592653589793238462643383279502884197169399375105...
Pythagoras Watson -- "Live long and may all your kernels pop."
INET: py@ecst.csuchico.edu ============ COMPUSERVE: 72162,2676


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

Date: 8 Jun 1997 13:40:02 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: DB_File not recognizing external updates?
Message-Id: <5necni$6la$2@pheidippides.axion.bt.co.uk>

[ Posted & Mailed ]

georgeh@maagnum.com wrote:
: I'm having a strange problem with DB_File under Perl 5.004. I'm using the
: Beta version of the module that supports Berkeley DB 2.0, and am using
: 2.0 as my database.

: The application I've written consists of two parts. One part sits and
: waits for a key name on standard input, and returns on standard output
: the data associated with the key in the database. Simple enough. It keeps
: running for the life of the application.

: A second process is adding records to the database. The problem is that
: the first application never sees the updated records until the program is
: restarted (essentially, after an untie and a tie again. This isn't an
: acceptable situation, because the first process could be running for
: weeks or months while the data needs to be updatable at any time.

: Closing the database connection and reopening it after each request isn't
: an option either, as the first application could concievably be doing
: lookups numbering well into the double digits per second.

: Is this a limitation of the Berkeley DB system (I doubt it), a limitation
: of the tie mechanism in DB_File or am I just doing something wrong?

It is a deliberate feature of the version of DB_File you are using. The
copy you are running is only intended to allow existing code which used
Berkeley DB 1.85/6 to be easily moved to DB 2.0. The intention is for
DB_File code to work exactly the same with either DB 1.x or 2.x.

I am working on a new module, currently unnamed, which will support all
the new features of Berkeley DB 2.0.

Paul


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

Date: Wed, 04 Jun 1997 11:58:45 -0700
From: Richard Moss <rjm@theory.chem.ubc.ca>
To: Terry Reedy <tjreedy@udel.edu>
Subject: Re: Introductory Comparison of Perl and Python
Message-Id: <3395BAE5.41C6@theory.chem.ubc.ca>

Is there any reason, apart from C legacy (sigh), that in Python 
arrays/lists have a 0-based indexing, and not a much more rational
(unless you know C) 1-based indexing?

thanks,

Richard


Terry Reedy wrote:

[snip]
 
> TUPLES/LISTS, NUMBERS                   ARRAYS, NUMBERS
> words = ('camel','llama','oyster')      @words= ('camel','llama','oyster');
> i=0; correct='?' # 0-based index        $i = 0; $correct = '?'; # ditto
> while correct == '?':                   while ($correct eq '?') {
>   if guess == words[i]:                   if ($guess eq $words[i])
>     correct = 'y'                            {$correct = 'y';}
>   elif i < 2: i = i+1                     elsif ($i < 2) {$i = $i+1;}
>   else: break                             else {last;}
>                                         }

[snip]


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

Date: 8 Jun 1997 01:14:25 -0700
From: descarte@hermetica.com (Alligator Descartes)
Subject: Re: most *robust* DBD::DBI/database combination ( <1M records ) ??
Message-Id: <5ndpl1$f7v@nerfherder.hermetica.com>
Keywords: perl,database,DBD,DBI,cgi,www

In article <slrn5p7mp3.jj.amore@teleport.com>,
Linux_User <amore@teleport.com> wrote:
>
>After having scanned some www urls, I wonder which combination 
>of DBI and database is the most stable and robust? Which has 
>been the most time tested (esp. for www work) ?? 

For WWW work, either Oracle with mod_perl and Apache::DBI, or, if you want
something cheaper and more lightweight, either mSQL or mySQL. The Oracle,
mSQL and mySQL modules are amongst the most stable DBI drivers.

>Some of these modules/combinations seem as unstable as many MS
>products. Alphas, betas, etc. Help a newbie perl chap out :-)

You must remember that Microsoft push several billion dollars a year into
software development. The DBI modules have none, except the limited spare
time of the developers. Yes, some modules are buggy and experimental, but
they are marked as such. You get what you pay for.

>Any suggestions, or reference articles?

Why not read the DBI WWW pages, perhaps?

    http://www.hermetica.com/technologia/perl/DBI

>Brett

A.

-- 
Alligator Descartes       |
descarte@hermetica.com    |   "The reverse side also has a reverse side"
http://www.hermetica.com  |                         -- Zen saying


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

Date: Fri, 06 Jun 1997 11:35:13 -0700
From: Nathalie Poitras <groupe@dri.qc.ca>
Subject: Need ressources
Message-Id: <33985861.113F@dri.qc.ca>

HELLO,

I'M NOT SURE IF I CAN POST JOB OFFERS HERE BUT I WILL THIS TIME, AND IF 
ANY OF YOU WOULD BE ABLE TO LET ME KNOW WHERE I COULD POST IT WOULD BE
GREATLY APPRECIATED.

WE NEED PERL PROGRAMMERS WITH OPENVIEW, TCP/IP AS AN ASSET, 2 YEARS
EXPERIENCE TO BE ABLE TO WORK IN MONTREAL ABLE TO EXPRESS THEMSELVES IN
FRENCH, IT IS FOR A MAJOR COMPANY. SUBMIT YOUR RESUME ASAP !!!
-- 
[____________________________________________________]
[Groupe D.R.I.                                       ]
[Til. (514) 493-4771 ou (800) 351-5222               ]  
[fax. (514) 493-4367 ou (800) 366-0799               ] 
[E-mail. groupe@dri.qc.ca  WEB. http://www.dri.qc.ca ] 
[____________________________________________________]


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

Date: Sun, 08 Jun 1997 10:57:19 -0400
From: Nasser Al-Zawawi <nzawawi@worldnet.att.net>
Subject: Parsing Comma Delemited Text DataBase
Message-Id: <339AC84F.3832@worldnet.att.net>

I trying to figure out how to parse a Text DataBase that is Comma
delimeted and has "" Double quotes for its strings fields.  My problem
is withen these string fields you could have a comma that should not be
parsed.
Meaning
1,"Hello, World",6,"hi"
Should be parsed into 4 fields
1. 1
2. "Hello, World"
3. 6
4. "hi"

Not 5 fields
1. 1
2. "hello
3. World"
4. 6
5. "hi"

I can't figure out the regulare expression that could do that for me.
I tried to tackle this problem with both AWK and PERL with no luck.
I would appreciate any feed back about this.

Thanks,
Nasser


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

Date: Sun, 8 Jun 1997 14:24:44 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: PERL assistance w/NT
Message-Id: <EBGo18.Equ@cix.compulink.co.uk>

In article <5n4dvm$2jp$1@bilbo.reference.com>, simmonsl@smsndc.com () 
wrote:

> I have a directory 
> structure that I create for each user of a specific group.  This
> directory has several subdirectories, and the permissions within
> are always the same.  Obviously, there's not much to creating 
> the directories (by username), but how to assign permissions has
> me stumped a bit.

Perl's only built-ins for permissions are based on the UNIX permissions 
system. The NT model is rather more, err, complex and doesn't map onto 
UNIX permissions at all well. There are some command-line utilities in the 
NT resource kit that may well help; run them through system().

--- 
John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked: 
#!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, Perl for 
NT/Win 95 can be found at http://www.activeware.com, with an excellent FAQ 
file at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html 
and no, I don't have the slightest idea what's wrong with your CGI script. 
Try http://www.perl.com/perl/faq/idiots-guide.html


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

Date: Sun, 08 Jun 1997 10:49:57 -0600
From: use.net@bigfoot.com (Andrew Starr)
Subject: Re: Perl Camel Book
Message-Id: <use.net-0806971049580001@max09-46.qni.com>

Just saw "Learning Perl" at the bookstore yesterday (after I e-mailed you)
and it looked like it might be better for me than "Programming Perl."

Note, however, that the 2nd Edition of "Learning Perl" is due out soon
(this month, I think), so I wouldn't buy the first edition.

Good luck!

-Andrew

In article <5n8jib$t1u@nuscc.nus.sg>, isc60289@leonis.nus.sg (Thee Boon
Hoo) wrote:

> Hi, i just started learning Perl using the Camel book which i bought
> recently. The problem is : i'm not sure how to approach this book and i'm 
> confused. 
>  
> For e.g, in the beginning chapters, some examples given touch on subjects
> that have not been introduced before,(for e.g chap3 abt passing arguments
> by reference to subroutine, formats, package) and unless we have previous
> knowledge of Perl, i guess we have to flip thru later chapters to understand 
> some of the new functions being introduced. (The authors even say that if 
> we haven seen <these> before, jus look at the pictures first:)
>  
> Hmm...maybe my approach was wrong, or should i get another book first, 
> such as the llama book, to gain a strong background? Please enlighten me!:)
> 
> Btw, most of the time i really enjoy this book, and the way the authors 
> presented it with humor and accuracy, really a 'break' from the old and 
> boring programming books that i have read.:)
> 
> --
> boonhoo

-- 
Andrew Starr  <mailto:use.net@bigfoot.com>
http://www.amherst.edu/~atstarr/eudora has my unoff. Eudora Site
http://www.amherst.edu/~atstarr/eudora/faq.html by Hank Zimmerman
I have no connection to Qualcomm other than being a happy customer!
If I am answering a question: please post followup questions to the newsgroup as well as mailing me a copy. For new questions, please just post to the newsgroup. Thank you.


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

Date: Sat, 07 Jun 1997 20:27:47 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Perl obfuscated contest
Message-Id: <339A0A93.79D57965@gpu.srv.ualberta.ca>

Andrew M. Langmead wrote:
> 
> "CS" <cswanson@io.com> writes:
> 
> >Can any kind soul tell me where the Perl obfuscation contest hangs out. Web
> >site, email, news group, etc?
> 
> The first offical obfuscated perl contest was conducted by The Perl
> Journal. The results are at
> <http://orwant.www.media.mit.edu/tpj/contest-obfusc-entries>

actually that was the 0th annual obfuscated perl contest  :-)
and the 1st is to be formally announced in the next issue (#6) of
the Perl Journal

regards
andrew


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

Date: 8 Jun 1997 13:47:10 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Reading (creating) compressed files
Message-Id: <5ned4u$6la$3@pheidippides.axion.bt.co.uk>

[ Posted & Mailed ]

Filip M Gieszczykiewicz (filipg@paranoia.com) wrote:
: Greetings. I've checked the archives and the FAQ and unless I missed
: it, I didn't see any mention of my question.

: I have the need to access (search) highly-compressible text files
: in my web site (gzip 2MB->100KB :-).

: I want to know if:

: 1) I can internally pipe the files through gzip -d when reading them
: (I fear that scanning it all into memory would excessively load
: down the server...) in a "block-by-block" fashion... Or is this
: too system dependent (Linux) or just plain impossible?

Yes, you can do that.

    open (F, "gunzip -c $file | ") ;
    while (<F>) {
	# process a line...
    }

: 2) Obtain some gzip -d implementation in perl that allows me to
: search the file. I believe Linux has zlib which is a libc with
: transparent read-only compression - I need THAT as a function
: inside my program... I must plead ignorance to even knowing
: if it's possible to access parts of the compressed file without
: having to uncompress it all...

: 3) If #2 is true but I can't block the reads, I'll use it and
: just block the file before compression (duh)... this will
: increase file system accesses but should reduce the amount of
: memory used down to a reasonable size. It's very possible
: that 2-25 users will be running this program at once... so
: right now, the worst case scenario is 25*2MB which just isn't
: possible... If I could get (if it's possible) to only scan
: the files by block, I could get that down to maybe 25*100KB
: or... that would be a lot more reasonable.

Have a look at my Compress::Zlib module (available on CPAN). This
allows you to do the equivalent of the code above, without having to
spawn a sub-process.

Paul


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

Date: 8 Jun 1997 15:20:48 GMT
From: harrison@cs.uiuc.edu (William L Harrison)
Subject: Redirection and timing out
Message-Id: <5neikg$aoo$1@vixen.cso.uiuc.edu>

Hi-

	I'm trying to write a timeout routine which accomplishes:

1. Given a script S, it forks off a new process and runs S,
2. there is a duration D, after which the process running S is killed,
3. all of STDOUT and STDERR from S are redirected or stored in some manner.

	I've found that writing a Perl script that performs 1 & 2 is easy
using fork, exec, and the alarm signal, but I can't seem to get 1&2&3. Here's
a code outline which might make my problem more clear:

	# the parent process P
	    unless ($child = fork) { # the child process C
		exec "S > outfile 2> errfile";
	#	exec "S";
	    }
	# set up P's alarm signal, etc.

	I need know what $child is so that, if C executes too long, it can be
killed by P. But if I redirect S's output as above, a *new* process is
spawned, so killing $child may just zombify this new process. I've tried using
"select" before the "exec", but of course, "exec" creates a fresh process
where STDOUT is the usual filehandle. 

	Does anyone have any suggestions for how I can accomplish 1&2&3?
This question may boil down to:
- is there a Perl routine which will return a list of child processes?, or
- is there some kind of "lightweight" exec which wouldn't blow away "select"?

	I'm a relative Perl newbie and I appreciate any pointers or help you
can give. If you do have any suggestions, could you email me at
"harrison@cs.uiuc.edu"? 

				Thanks in Advance,
					Bill Harrison
-- 

                  "Right now I'm having amnesia and
                  deja vu at the same time. I think
                  I've forgotten this before."


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

Date: 8 Jun 1997 13:33:36 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Shared DBM files
Message-Id: <5necbg$6la$1@pheidippides.axion.bt.co.uk>

Brooks Davis (brooks-n-janet@worldnet.att.net) wrote:
: Gene Johannsen <gej@spamalot.mfg.sgi.com> wrote in article
: <5n91hl$3lh$1@murrow.corp.sgi.com>...
: > I am working on a project where I'd like to use a DBM file to share
: > data between two perl scripts, running at the same time.
: > 
: > The problem is that there seems to be some sort of buffering causing
: > the reading script not to see the data the writing script puts in
: > there.
: >
: > Now, I know I can close and reopen the hash in order to get the data,
: > but I'm wondering, is there an easier way?

: With standard DBM, the answer is no.  On the other hand, there are
: syncronization and locking functions in Berkley DB.

Note that the current interface to Berkeley DB, namely DB_File, does
not support these featues... yet. A new version which will support all
the new stuff in Berkeley DB 2.0 is in the works.

Paul


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

Date: 8 Jun 1997 00:54:21 GMT
From: etruben@ci.ua.pt (Ruben Mendes)
Subject: sockets select() problem
Message-Id: <5ncvrt$f8n$1@news.ua.pt>

Hello, thank you for reading.

I am trying to translate a C program I made to Perl. I have only one
problem (not bad considering its my first Perl hack :). Here's what I do:

I call select() to block until one of two socket descritors is ready for
_reading_ . In C it works fine because it returns as soon as there is
one byte to be read.
It seems that in Perl the select() returns only when some buffer is full.

Is there a way to disable buffering for reading and tell select() to 
return as soon as any amount of information is received in any of the
sockets?


Thanks again for any help.

--
Ruben Leote Mendes - etruben@ua.pt - CT1ETZ - ARUA


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

Date: 8 Jun 1997 15:43:19 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <5nejun$t5b$1@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 31 May 1997 09:38:06 GMT and ending at
07 Jun 1997 07:00:18 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" e-mail address and name.

Excluded Posters
================

perlfaq-suggestions@mox.perl.com

Totals
======

Total number of posters:  409
Total number of articles: 938
Total number of threads:  358
Total volume generated:   1606.9 kb
    - headers:    640.5 kb
    - bodies:     914.1 kb (654.5 kb original)
    - signatures: 50.3 kb

Averages
========

Number of posts per poster: 2.3
Number of posts per thread: 2.6
Message size: 1754.2 bytes
    - header:     699.3 bytes
    - body:       997.9 bytes (714.5 bytes original)
    - signatures: 54.9 bytes

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

  107   172.4 ( 90.3/ 82.1/ 57.1)  Tom Phoenix <rootbeer@teleport.com>
   42    67.2 ( 27.8/ 39.4/ 21.1)  Chipmunk <Ronald.J.Kimball@dartmouth.edu>
   28    35.5 ( 16.6/ 18.9/ 14.7)  Nathan V. Patwardhan <nvp@shore.net>
   24    47.3 ( 14.5/ 32.8/ 19.2)  Tad McClellan <tadmc@flash.net>
   17    29.0 ( 12.0/ 16.9/  9.1)  Douglas Seay <seay@absyss.fr>
   17    25.9 ( 10.2/ 11.3/  5.1)  "John Bokma" <jbokma@caiw.nl>
   15    28.1 ( 10.3/ 14.0/  8.2)  Russ Allbery <rra@stanford.edu>
   14    31.0 ( 13.3/ 15.1/  7.5)  abigail@fnx.com
   13    19.6 (  8.0/ 11.5/  7.0)  Tung-chiang Yang <tcyang@netcom.com>
   11    21.7 (  5.5/ 16.0/ 11.0)  Andrew M. Langmead <aml@world.std.com>

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 172.4 ( 90.3/ 82.1/ 57.1)    107  Tom Phoenix <rootbeer@teleport.com>
  67.2 ( 27.8/ 39.4/ 21.1)     42  Chipmunk <Ronald.J.Kimball@dartmouth.edu>
  47.3 ( 14.5/ 32.8/ 19.2)     24  Tad McClellan <tadmc@flash.net>
  35.5 ( 16.6/ 18.9/ 14.7)     28  Nathan V. Patwardhan <nvp@shore.net>
  32.9 (  7.7/ 25.2/ 18.6)      9  perlprogrammer@hotmaill.com
  31.0 ( 13.3/ 15.1/  7.5)     14  abigail@fnx.com
  29.0 ( 12.0/ 16.9/  9.1)     17  Douglas Seay <seay@absyss.fr>
  28.1 ( 10.3/ 14.0/  8.2)     15  Russ Allbery <rra@stanford.edu>
  25.9 ( 10.2/ 11.3/  5.1)     17  "John Bokma" <jbokma@caiw.nl>
  23.8 ( 11.7/ 12.1/  7.6)     10  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   15  data structure question
   15  any editor for perl?
   15  Newbie question
   13  why won't 'print <<end_print...end_print' work?
   13  How can I set up this server to run perl faster?...
   11  LOG base 10  operator
   10  pack template that packs like 'a' but unpacks like 'A'
   10  inconsistent opendir behaviour in Perl for win32
   10  Finding string length
    9  Isdigit(), isalpha()  in Perl

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  47.4 ( 12.4/ 34.5/ 22.7)     13  How can I set up this server to run perl faster?...
  32.8 ( 10.1/ 22.4/ 16.6)     15  data structure question
  27.6 ( 11.6/ 15.9/ 10.2)     15  any editor for perl?
  22.1 (  2.4/ 19.7/ 19.2)      4  Statistics for comp.lang.perl.misc
  20.8 (  8.0/ 12.1/  8.9)     10  pack template that packs like 'a' but unpacks like 'A'
  20.7 ( 11.3/  9.3/  6.0)     15  Newbie question
  20.3 (  8.8/ 10.8/  6.1)     13  why won't 'print <<end_print...end_print' work?
  19.7 (  3.0/ 16.2/ 10.9)      4  Introductory Comparison of Perl and Python
  19.1 (  3.2/ 15.8/  9.6)      5  More PERL questions
  17.7 (  4.3/ 12.9/ 10.1)      6  Printing Prime Numbers

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      21  comp.lang.perl
      18  comp.lang.perl.modules
      13  comp.infosystems.www.servers.unix
      13  comp.os.linux.setup
      13  comp.os.linux.misc
       9  comp.lang.tcl
       9  comp.lang.c++
       7  comp.lang.javascript
       7  alt.fan.e-t-b
       7  comp.lang.python

Top 10 Crossposters
===================

Articles  Address
--------  -------

      12  "Bill Erwin" <bill.erwin@gsa.gov>
      12  "Vineet S. Joshi" <vineet@usa.net>
      12  Don Yuniskis <dgy@rtd.com>
      12  "Max Rondon" <PRAXIM@prodigy.net>
      12  rmycroft@cyberatl.net
      12  Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
      12  Christopher Thompson <thompson@scapa.cs.ualberta.ca>
      12  perlprogrammer@hotmaill.com
       8  abigail@fnx.com
       8  "Manfred Schneider" <manfred.schneider@rhein-neckar.de>


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

Date: Sun, 8 Jun 1997 08:06:58 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: String Compare Problem
Message-Id: <ipaen5.fm.ln@localhost>

Chipmunk (Ronald.J.Kimball@dartmouth.edu) wrote:
: In article <5n718f$n2k$1@news.netusa.net>
: Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:

: > Chipmunk <Ronald.J.Kimball@dartmouth.edu> wrote:
: > > pcartier@ix.netcom.com (Paul Cartier) writes:
: > > > Could someone give me an example on how I can search the
: > > > begining of a string for a match.
: > > ^ matches the beginning of a string.
: > > $ matches the end of a string.
: > 
: > Close, but no cigar. ^ matches the beginning of a line (or string)
: > $ matches the end of a line (or string). \A matches the begining of
: > a string. \Z matches the end of a string.

: For the perlre manpages:

:      By default, the "^" character is guaranteed to match only at the
:      beginning of the string, the "$" character only at the end (or
: before
:      the newline at the end)

: In order to make ^ and $ match at the beginning/end of a line, you need
: to use the /m modifier.


In order to make ^ and $ match at the beginning/end of a line
*in a multiline string*, you need to use the /m modifier.


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

$_ = 'Ronald Kimball';

print "matched\n" if /^Ron/; # no 'm' here, matches beginning of line just fine
----------------------


The /m modifier has no effect if you are only matching against
single line strings.


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


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

Date: Sun, 08 Jun 1997 11:01:33 +0300
From: Zeev Gross <zev@telaviv.ndsoft.com>
Subject: trace mode - ksh equivalent of -x
Message-Id: <339A66DD.5CB16E95@telaviv.ndsoft.com>

Hi All,

Does any one know if there is a way to execute a standard perl script in
trace mode as in ksh -x switch. I need to be able to distinguish
between  a command statement and its output.

Thanks is advance
Zev@telaviv.ndsoft.com



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

Date: Sun, 8 Jun 1997 06:19:29 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Upload security??
Message-Id: <tcyangEBG1KH.D4n@netcom.com>

Not sure if there are any Web pages, but you should post this question
in 'alt.food.asian' -- that group is more on-topic for your question
than CLPM :)

====================================
mw@xtra.co.nz typed when the mommy tyrannosaurus found him/her:
: Hi,

: When allowing poeple to upload to their directory via their browser, what
: security issues are there?

: If someone uploaded a .exe or a file with a virus in, could these be
: activated?

: Are there any useful web pages with regard to upload security.

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Sun, 08 Jun 1997 17:29:02 +0200
From: Svante =?iso-8859-1?Q?S=F6rmark?= <gucsv@gd.gu.se>
Subject: Writing a DBD driver: How?
Message-Id: <339ACFBE.60D4C921@gd.gu.se>

Hi all!

I need to write a driver for an arcane RDBMS called Mimer (from Sysdeco)
and any pointers would be greatly appreciated. =


It has an embedded SQL c-compiler. I have read re perlxs-docs, and I
think I get the idea. =


Now, do I start by hacking the Informix driver (for example) or should I
start from scratch? =


-- =

MVH /
Svante S=F6rmark
------------------------------------------------------------------------
 G=F6teborgs DataCentral   | Gibraltargatan 25     | 412 96 G=F6teborg   =
   =

------------------------------------------------------------------------
 Email:  gucsv@gdc.gu.se | Tel: +46-31-772 83 36 | Fax: +46-31-772 83 90
------------------------------------------------------------------------


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

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

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