[9905] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3498 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 21 03:07:23 1998

Date: Fri, 21 Aug 98 00:00:45 -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, 21 Aug 1998     Volume: 8 Number: 3498

Today's topics:
    Re: Coderef as hash-index (Abigail)
    Re: Converting to lowecase (Scott Erickson)
    Re: eq and == difference >>Abigail -> You are a LOSER.  (John)
    Re: EXCITE / ALTAVISTA-TYPE WEB SPIDER (Rich)
    Re: Greedy arrays in list assignments (Josh Kortbein)
    Re: Help: Problem with Pattern-Matching (Josh Kortbein)
    Re: Is Perl5.004 Year 2000 compilant? (Craig Berry)
    Re: Is this autoloading? <rra@stanford.edu>
    Re: Kermit Speaks etmgero@my-dejanews.com
    Re: Mailing List Sign up (Josh Kortbein)
    Re: New PERL user looking for sites running PERL5 on an (John D Groenveld)
    Re: perl -U don't work.. <rra@stanford.edu>
        Perl 5.04/Curses 1.02 Problem (Tan Buck Soong)
    Re: perl plea <rra@stanford.edu>
    Re: perl plea <zenin@bawdycaste.org>
    Re: Perl scripts (Josh Kortbein)
    Re: Perl scripts (Craig Berry)
    Re: Perl search for directory structure <rra@stanford.edu>
    Re: Perl to C (Josh Kortbein)
    Re: perl5.004_04-m1 <rra@stanford.edu>
    Re: Printing large numbers with commas (Josh Kortbein)
    Re: Protecting a data struc with local or my?--More Con (Craig Berry)
    Re: Removing one item from long list (Josh Kortbein)
    Re: Sigh <rra@stanford.edu>
    Re: solaris2.6 problems with h2ph && types.ph <rra@stanford.edu>
    Re: Taint Question <rra@stanford.edu>
    Re: Using Perl module without access to Perl installati <rra@stanford.edu>
    Re: Using Perl module without access to Perl installati <zenin@bawdycaste.org>
    Re: Utility for news article fetching selected by keywo <rra@stanford.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 21 Aug 1998 03:05:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Coderef as hash-index
Message-Id: <6rio6l$10a$3@client3.news.psi.net>

Chris Russo (news@russo.org) wrote on MDCCCXVI September MCMXCIII in
<URL: news:news-2008981753390001@buzz.hq.alink.net>:
++ In article <yaazpczit3k.fsf@dromi.ifi.uio.no>, Jan Egil Hagen
++ <janha@dromi.ifi.uio.no> wrote:
++ 
++ >What's going on? Is this a bug or a feature?
++ 
++ Let's call it "necessary".  I would think that garbage collection would
++ become a trifle more difficult for Perl if references to arbitrary data
++ could be stringified.

Uhm? What do you mean? References *can* be stringified. That's exactly
what's happening here.

I've always found it a misfeature of Perl that it stringifies hash keys.
I did a lot of LPC coding before I knew Perl, and in LPC you can index
hashes (or mappings as they are called) with *anything* (including arrays
and other hashes) without a silent conversion.

I don't have much of a need to index hashes with arrays or code references,
but being able to hash objects would be nice.


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: Thu, 20 Aug 1998 14:05:53 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: Converting to lowecase
Message-Id: <35dc2cc5.3112792779@news.mr.net>

Previously, Jonathan Feinberg wrote:

>Hauk Langlo <hauk@forumnett.no> writes:
>
>> The problem has been though that due to some problems with my
>> software, the server I'm using etc, I have not been able to use the
>> perl man and docs lately.
>
>If you can use perl, then you can use perldoc, since they're both in
>your PATH.  If you can use perldoc, then you've got the entire manual
>at hand, including all of the FAQs.

Not necessarily true. The sysadmin who installed Perl on my system,
for whatever reason, did not install perldoc. Eventually it was
installed, but, please, do not assume that if you have perl, you have
perldoc

Scott.


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

Date: 21 Aug 1998 03:29:33 GMT
From: falstaff@lennon.postino.com (John)
Subject: Re: eq and == difference >>Abigail -> You are a LOSER. Take that stick out of your ass!
Message-Id: <6ripit$5us$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Kermit the frog (kermit@sesamestreet.com) wrote:
: Why are you so fucking bitchy, loser??? In fact, it seems as though
[snip]
: GROW UP, ABIGAIL! (or are you already 40 and disgruntled with your
: life - sounds like it!)

Oh, don't mind our Abbey. She's just the news group pit bull, 
and like Pavlov's dog, when she sees a newbie post a question 
answered in the FAQ, she starts frothing at the mouth. 

--
John



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

Date: 21 Aug 1998 03:49:28 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: EXCITE / ALTAVISTA-TYPE WEB SPIDER
Message-Id: <slrn6tpri6.1kq.richm@ll.aa2ys.ampr.org>

On Thu, 20 Aug 1998 02:26:16 GMT, girls@littlegirls.com <girls@littlegirls.com> wrote:
>Anyone know of a script/program that can perform this type of action
>and save the data to a delimited text file?
>

   Oh, sure - with a userid/domain name like the one you're posting from,
we're all just jumping up and down with eagerness at the though of
being associated with you.

- Rich

--
Rich Mulvey                                         
My return address is my last name, 
   followed by my first initial, @mulveyr.roc.servtech.com        
http://mulveyr.roc.servtech.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa


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

Date: 21 Aug 1998 03:26:58 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Greedy arrays in list assignments
Message-Id: <6ripe2$sjn$3@news.iastate.edu>

Craig Berry (cberry@cinenet.net) wrote:
: 0c$2@client3.news.psi.net> <6qr68u$jts$1@nnrp1.dejanews.com> <davel-1208981051590001@honeybee.spc.uchicago.edu> <slrn6t7plr.ggu.ken@pulsar.halcyon.com> <1ddrbcq.yp9jsj19h5mf4N@slip-32-100-246-136.ny.us.ibm.net>
: X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]

: Kevin Reid (kpreid@ibm.net) wrote:
: : Ken Pizzini <ken@halcyon.com> wrote:
: : > On Wed, 12 Aug 1998 15:51:59 GMT, Dave Lorand <davel@spc.uchicago.edu>
: : > wrote:
: : > >Or else:
: : > >
: : > >  ($temp, @arr, $temp) = split //, 'abcde';
: : > 
: : > That won't do what you meant it to: the @arr assignment is greedy...
: : 
: : Is there any reason why Perl (c|sh)ouldn't be changed so it isn't
: : greedy?

: Can't imagine how it could be in a consistent way.  After all, how would
: one handle

:   (@foo, $bar, @baz) = split //, 'abcde';

: in any such general scheme?  I suppose you could limit it to cases with
: at most one array in the list, count scalars following the array, and work
: backward...but that seems horribly awkward.

It seems more consistent (in my limited experience) to treat the
LHS as a flattened array, and distribute the split values left-to-right
until one side runs out.



Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay


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

Date: 21 Aug 1998 03:09:27 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Help: Problem with Pattern-Matching
Message-Id: <6riod7$sjn$1@news.iastate.edu>

Mooneer Salem (mooneer@earthlink.net) wrote:
: Try something like this:

: $text = "Many greetings to Petra and Sebastian";
: $text =~ tr/A-z/a-z/;
: $text =~ s/\s*(.)(*)\s*/$1$2/g;
: $text =~ s/ //g;

Did you even try this? Even without -w or use strict it bombs.

* is a quantifier. You have to give it something to quantify.

Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 21 Aug 1998 05:36:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is Perl5.004 Year 2000 compilant?
Message-Id: <6rj10g$jpv$3@marina.cinenet.net>

Jeff Gao (jeff_gao@bctel.net) wrote:
: Does anybody know that whether perl 5.004 is y2k compilant?

I'm sorry, you're not cleared for that information.  The answer can only
be obtained on the top-secret, heavily guarded www.perl.com or
www.dejanews.com websites, and as...oh, drat, now you know the URLs!  I'd
best stop talking before...oh, wait, excuse me, there's someone knocking
at the door an

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 20 Aug 1998 22:57:28 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Is this autoloading?
Message-Id: <m3iujmx4fr.fsf@windlord.Stanford.EDU>

Jim Amrhein <amrhein@harp.gsfc.nasa.gov> writes:

> After installing a few CPAN modules ( GD, Text::Wrapper) , I found a
> directory under my lib/perl/ directory ( I did install these packages
> locally rather then with root access) that had :

> lib/perl/auto/GD/.packlist
> lib/perl/auto/Text/Wrapper/.packlist

> Could someone explain the mechanics behind this?  I thought it might be
> part of autoloading, but find no reference to this "format" in
> Programming Perl.

No, packlist files are unrelated to autoloading.  They're installed
automatically by MakeMaker and are just a list of files that are part of a
given Perl module (they're used for uninstalls, among other things).

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


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

Date: Fri, 21 Aug 1998 05:48:05 GMT
From: etmgero@my-dejanews.com
Subject: Re: Kermit Speaks
Message-Id: <6rj1ml$b09$1@nnrp1.dejanews.com>

In article <35d6e68e.838078@enews.newsguy.com>,
  kermit@sesamestreet.com (Kermit the frog) wrote:
>
> Here's an interesting experiment: respond with silence to those who
> are not worthy of your knowledge...
>
> If you feel that the question posed is below you or is being asked by
> someone whom has 'not done their homework', then simply carry on to
> the next article.

 ...

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


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

Date: 21 Aug 1998 03:23:35 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Mailing List Sign up
Message-Id: <6rip7n$sjn$2@news.iastate.edu>

dgower@ilmioweb.it wrote:
: Hi all-

: I am looking for a mailing list sign up script that I can run on NT for
: ListServ.  I have seen many out there, but they all require sendmail or some
: other mail server on your system and we are using the ISP for mail.

: It seems like it would be simple to just take the email address, the name, and
: include the Subscribe and the other information in the body of the message.
: Then connect to SMTP server and send it to the list server address, but I have
: not found it yet.

: Any help is appreciated.  Thanks.

: -David...

If you have a list server, hopefully it contains a "subscribe" function
that works via email. So what you can do is: create a web page that
takes an email address to subscribe to the list. Then, depending on
how concerned with security you are, you can either

a) have the CGI send mail to the list server, ostensibly from the
address entered on the web page

b) have the CGI send mail to the address entered, telling them to
send the mail in to the list server. You could include some semi-unique
piece of information in that mail like a password or hashed email
address to better ensure that nasty people can't subscribe-bomb
people using your web page.

Your options for sending the mail include: using Mail::Internet and
such as in perlfaq9, using Mail::SMTP, opening a socket directly
to the SMTP port of your mail server, and probably plenty more.

Rhetorical question: If it's simple why don't you just write it yourself?


Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 20 Aug 1998 23:43:38 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: New PERL user looking for sites running PERL5 on an NT server with oracle DB
Message-Id: <6riqda$n1f$1@tholian.cse.psu.edu>

In article <35da7b7e.0@champ>,
Debra Ruch <Debra.Ruch@gov.edmonton.ab.ca> wrote:
>Firstly, is it possible to run PERL5 on an NT server connecting to an oracle
>dB (v7.2 and v7.3).  Our clients are running both windows 95 and NT.

DBI/DBD::Oracle can be used to access Oracle from Win95/NT.
Run, don't walk to your nearest CPAN mirror. http://www.cpan.org/

>Secondly, does PERL require its own listener on the server...do you use
>tcp-srv ?
An Oracle client written in Perl uses SQLNET just like SQL*PLUS.
John
groenveld@acm.org


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

Date: 20 Aug 1998 23:08:40 -0700
From: Russ Allbery <rra@stanford.edu>
To: "sCALP" <scalp@orka.fr>
Subject: Re: perl -U don't work..
Message-Id: <m37m02x3x3.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

sCALP <scalp@orka.fr> writes:

> i'm using a perl script to manage .htaccess files (or to do any critic
> commands) i have a perl like this:

> #!/usr/bin/perl -U
> cat /etc/shadow                          <-- it's just to try something
> 'critic'

That's not Perl code; are you sure that's what your script says?

> and i set its attributes to +x and +s.

> the file work when i'm root and that i type ./myfile, but when i'm not
> root (eg: user via internet (CGi)) it don't work...

/etc/shadow isn't world-readable.  Since you're running your script from
the web server, on any correctly configured web server your script will be
running as some distinguished user with no privileges, so it won't be able
to read /etc/shadow.

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


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

Date: 21 Aug 1998 03:26:06 GMT
From: tbs1@np.ac.sg (Tan Buck Soong)
Subject: Perl 5.04/Curses 1.02 Problem
Message-Id: <6ripce$kn4@triton.np.ac.sg>

I am trying to make use of Curses.pm, and encountered some difficulty.

I wrote the following simple perl program

	#! /usr/local/bin/perl
	use Curses;
	initscr;

I tried to run this simple program, and always encountered the following
error messages:-

   Curses function 'initscr' is not defined by your vendor at.....


Your help is really appreciated. thanks


Some useful info:-

	Solaris 2.5
	Perl 5.004
	Curses 1.02

--
  BSTan -------  Tan Buck Soong                       Tel: (065)-4606771
  Ngee Anne Polytechnic, Computer Centre, Singapore   Fax: (065)-4672541
  Internet Address: tbs1@np.edu.sg
========================================================================


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

Date: 20 Aug 1998 23:30:42 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: perl plea
Message-Id: <m3u336vobx.fsf@windlord.Stanford.EDU>

dj adams8620 <dj_adams8620@my-dejanews.com> writes:

> I am having a problem with a certain subroutine I have written in a Perl
> script, presumably related to a syntax error that I can't find. When
> executed as a CGI in a browser, the browser returns the "500 Internal
> Server Error" indicating that there is a problem with the script.

This really isn't the right newsgroup for this question, since it's a CGI
question more than a Perl question (comp.infosystems.www.authoring.cgi
would be a lot better), but I'll see if I can help some.

This error generally means that the actual output from your script will be
in the server error logs.  What's there?  Do you have access to them?  (If
you don't, find a different web provider, since it's damn near impossible
to debug your scripts without that access.)

> When I run it over telnet, it prints out the html fine but it goes to
> the wrong subroutine because there is no way to attach through telnet
> the FORM values that the script normally collects through a form on an
> html page.  Basically, I can't use telnet to find out what is wrong with
> it.

Are you using the CGI module?  If you are, then you can run the script and
provide it form input/value pairs on stdin and it will behave as if it
were called by the web server with form input.  Great feature.

If you're not using the CGI module, why on earth not?  It will make your
life *much* easier.

> Alas, I also have but a commercial web hosting account, so I can not
> examine the server error log.

Ah, that answers that question.  Quite honestly, your commercial web
hosting provider bites.  But you may be able to work around that.  Do you
have write access anywhere with your script?  Can you do something like:

        $SIG{__WARN__} = sub {
            open (LOG, '>> /some/log/file') or die;
            print LOG @_;
        }

to capture your warning output, which is most likely what's confusing the
server?  Possibly the same with __DIE__?

> sub build {

> chmod 0777, '$page'; # chmod on file

You're not testing whether this succeeds; I'm also not sure why you're
doing this exactly.

> open(PAGE, "$page") || die "I can't open that file\n";

If the die here gets triggered, that will produce the error message that
you're reporting.

> open(PAGE, ">$page") || die "I can't create that file\n";

Ditto here.

> 		for ($a = 0; $a <= $sizelines; $a++) {
> 		$_ = $lines[$a];

This won't help with your error, but as an aside here this is more easily
written as just:

        for (@lines) {

and will actually do pretty much exactly the same thing in this case.  The
only difference is that $_ will be an alias rather than a copy.

>  	if (/<!--begin-->/) {
> 	    print PAGE "<tr><td width=\"100%\" colspan=\"2\" bgcolor=\"C0C0C0\"
> bordercolor=\"FFFFFF\" bordercolorlight=\"FFFFFF\" bordercolordark=
> \"FFFFFF\"><small><font face=\"Arial\"><strong>[$subject]</strong> - <strong>
> [<a href=\"mailto:$email\">$usrname</a>]</strong> - <strong>
> $time</strong></font></small></td></tr>\n";
> 		print PAGE "<tr><td width=\"100%\" colspan=\"2\"><small><font
> face=\"Arial\">[$comments]</font></small></td></tr><tr><td width=\"100%
> \">&nbsp; </td></tr>\n";
> 		print PAGE "<!--begin-->\n";

Urk.  This is totally unreadable.  I'd do this with heredocs or CGI module
methods or *something* other than this.

> open(MAIL, "| $sendmail -t") || die "I can't open sendmail\n";

Again here, if this fails, that would produce the error.

I'm afraid I don't see anything obviously wrong, but hopefully some of the
notes above will help some.

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


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

Date: 21 Aug 1998 06:42:05 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: perl plea
Message-Id: <903682261.486717@thrush.omix.com>

[posted & mailed]


dj_adams8620@my-dejanews.com wrote:
: I am having a problem with a certain subroutine I have written in a Perl
: script, presumably related to a syntax error that I can't find. When executed
: as a CGI in a browser, the browser returns the "500 Internal Server Error"
: indicating that there is a problem with the script.

        Add the line:
        
                use CGI::Carp qw(fatalsToBrowser);

        before anything else in your script, save for #!/usr/local/bin/perl
        of course.

: When I run it over telnet, it prints out the html fine but it goes to the
: wrong subroutine because there is no way to attach through telnet the FORM
: values that the script normally collects through a form on an html page.

        perldoc CGI

        The CGI module has command line level debugging options like this.

: Basically, I can't use telnet to find out what is wrong with it. Alas, I also
: have but a commercial web hosting account, so I can not examine the server
: error log.

        Well that is just plain stupid of them.  They allow you to run CGI
        programs at will, but won't let you see the error log nore offer
        any support. What a joke of an ISP....

        Run, don't walk, to www.best.com and get a real account if you want
        to run CGI programs on it.  Best not only allows you to run CGI
        programs at will, but also gives you your own error and access logs
        for just your part of the server, among countless other features
        that *no one* else offers at all, at least without co-locating a
        machine.

: Its almost 3am here now and I've been trying to get this script working for
: several hours. It actually edits the page that it is supposed to, but then
: returns the 500 message.

        Make *very* sure the first thing that gets out is a Content-type
        header.  Do that before you do anything else if you can.  Make *very*
        sure you are using CGI::Carp qw(fatalsToBrowser) to catch most fatal
        errors and send them to your browser.

: chmod 0777, '$page'; # chmod on file

        Ding, Ding, Ding, Ding!

        Why are you single quoting a variable?  Or do you really have
        a file called '$page'?  Take the quotes off completely.

        Why are you not testing the return value of chmod?

: open(PAGE, "$page") || die "I can't open that file\n";

        No $! in the error?  No "'$page'" in the error?  A new line
        at the end?  You won't now what went wrong ($!), if it was
        the file you thought it was ('$page', in quotes), or where
        in the script this error was thrown (the trailing newline
        suppresses the normal " at foo.cgi line 1234" message that
        perl gives you).

        Change your die() to something like:

                die "I can't open file '$page': $!, stopped";

        Never, ever put a new line at the end of a die() or warn()
        message unless you know exactly what it does and why you might
        want it to do something else.

: open(PAGE, ">$page") || die "I can't create that file\n";

        If you die at any of these die()s, you'll generate a 500 error.

        use CGI::Carp qw(fatalsToBrowser) will throw such errors to your
        browser instead of just the error log.  Use it, it is your friend.

: 		for ($a = 0; $a <= $sizelines; $a++) {
: 		$_ = $lines[$a];
:  	if (/<!--begin-->/) {
: 	    print PAGE "<tr><td width=\"100%\" colspan=\"2\" bgcolor=\"C0C0C0\"

        No Content-type header?  I hope it was printed earlier...

: print "Content-type: text/html\n\n";

        Hmm...or not...

        Any data before your full headers, stdout or stderr, can cause
        a 500 error.

: open(MAIL, "| $sendmail -t") || die "I can't open sendmail\n";

        Again, you need $!, the value of $sendmail, and no trailing
        newline on that message if it is to be of much real use.
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 21 Aug 1998 03:41:20 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Perl scripts
Message-Id: <6riq90$sjn$5@news.iastate.edu>

Ferdi (cogelog@wanadoo.fr) wrote:
: Do you know where can I find some freeware script?
: I'm looking for some scripts to build a newsgroup.

The only place I know is www.perl.com but unfortunately all of their
scripts cost a lot of money.







-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 21 Aug 1998 05:32:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl scripts
Message-Id: <6rj0oj$jpv$2@marina.cinenet.net>

Josh Kortbein (kortbein@iastate.edu) wrote:
: Ferdi (cogelog@wanadoo.fr) wrote:
: : Do you know where can I find some freeware script?
: : I'm looking for some scripts to build a newsgroup.
: 
: The only place I know is www.perl.com but unfortunately all of their
: scripts cost a lot of money.

And besides, you don't want scripts, anyway.  Scripts are filled with
security holes, and you can't copyright them.  Use the only language I've
found that's ideally suited for Web development:  Ada.  You won't regret
it.

   [Obligatory :) inserted per the Persons with Clue Deprivation
    Assistance Act]

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 20 Aug 1998 23:21:24 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl search for directory structure
Message-Id: <m3ww82vorf.fsf@windlord.Stanford.EDU>

jffitzge766 <jffitzge766@my-dejanews.com> writes:

> I need to make a search engine on a web site -but instead of searching
> HTML files I need to search through actual files and directories in
> UNIX.

> The problem is the size - there are 1000's of directories and files to
> search through so doing a system call to "find" or "ls" takes WAY too
> long.

> Wondering if there's an easy way to do this - thanks.

If find takes too long, then any equivalent of find implemented in Perl is
also going to take too long.  At this point you, as a programmer, want to
start thinking about where the problem is coming from and isolating it.
That's the first step in identifying how to fix it.

So let's see exactly what the situation is:

 * You have a large number of files that you need to search through.
 * These files are stored in a standard file system.
 * The file system itself is not sufficiently fast to traverse.
 * You're specifically traversing it in order to search files.
 * Regardless of how you come up with a list of files, you're still going
   to have to traverse the file system to open those files to search
   through them since that's the only way you can access them.

So if find/ls is too slow, meaning that the file system is too slow, then
you aren't going to be able to search each individual file for your
application or it will be too slow.  Time to start trying to find
alternatives, at which point you need to start asking questions:

 * Do you really have to search every file with every search, or do you
   have some way of narrowing the search space?
 * If you do have some way of narrowing the search space, can you use that
   to prune the file system traversal *before* you call find/ls or the
   equivalents?
 * If so, what information do you need to do that?  Do you need to store
   a list of files in a separate database?  If so, how will that get
   updated, and what will the format be?
 * Can you actually do the searching in advance and cache the results?
 * Can you cache something that isn't the actual searching but that will
   make the searching faster and/or narrow the search space?

At this point you should also be asking yourself how other people have
solved this same problem.  Search engines are a solved problem that have a
lot of deployed implementations.  If you look at them, you'll find that
what they do is that they build an index automatically from the set of
files, rebuild it on a periodic basis, and use a random access protocol to
search the index when someone starts a search, using that to return the
files that can be examined in more detail.

Hope this helps you in getting started.

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


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

Date: 21 Aug 1998 04:01:34 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Perl to C
Message-Id: <6rireu$sjn$6@news.iastate.edu>

Grant Griffin (grant.griffin@nospam.com) wrote:
: Tom Christiansen wrote:

: >  [courtesy cc of this posting sent to cited author via email]
: >
: > It would very likely do you no good.  Now go read the FAQ to learn why.
: >

: You know, I read the FAQ, and it left me confused, as a matter of faq.  If
: the Perl Compiler _might_ be used to solve problems a), b), c), or d) but
: it really isn't a good _solution_ to problems a), b), c), or d) then why
: does it exist?  Perhaps along with the reasons why it _shouldn't_ be used,
: the FAQ could also spell out why the Perl Compiler _should_ be used!

"To see if it can be done" seems like sufficient reason. :)



Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 20 Aug 1998 23:33:48 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: perl5.004_04-m1
Message-Id: <m3r9yavo6r.fsf@windlord.Stanford.EDU>

Dipl -Ing Markus Rosenkranz <rosenkranz@mathconsult.co.at> writes:

> Last week I downloaded perl5.004_04-m1.tar.gz from CPAN (from some
> German server), my first time installing Perl.  I wasted some hours
> trying to get it compiled on my DEC Alpha with Digital Unix 4.0D.  A
> friend of mine who has installed Perl successfully on the same platform
> told me that he has used perl5.004_04.tar.gz.  I downloaded that one,
> and it worked immediately.  Fine.

> But can anyone tell me what the -m1 means.

Maintenance trial one.  In other words, it was the first *beta* of
5.004_04, not the final shipped 5.004_04 version.  You pretty much always
want to grab whatever stable.tar.gz points to in the src directory on CPAN
rather than looking for individual versions.

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


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

Date: 21 Aug 1998 04:06:41 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Printing large numbers with commas
Message-Id: <6riroh$sjn$7@news.iastate.edu>

John Porter (jdporter@min.net) wrote:
: Tom Phoenix wrote:
: > On Fri, 14 Aug 1998 heinrich7486@my-dejanews.com wrote:
: > > Subject: Printing large numbers with commas
: > FAQ.

: I sense the robot's patience is finally beginning
: to wear thin...

Cool, does that mean it's not just a robot but an expert system? :)



Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 21 Aug 1998 05:41:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Protecting a data struc with local or my?--More Confusion
Message-Id: <6rj19v$jpv$4@marina.cinenet.net>

Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
: Craig Berry <cberry@cinenet.net> wrote:
: > Rick Delaney (rick.delaney@shaw.wave.ca) wrote:
: > : Unfortunately 'exists' will also allow references to spring into
: > : existence with some flavours of perl (5.004_04).  For example:
: > [example snipped]
: > 
: > Not so, you're bringing the intermediate-level key into existence in your
: > 
: > :             print "$y\n" if exists($ref->{$x}{$y});
: > 
: > line in the test function.  (Had me worried there for a minute, though...)
: 
: That's the problem.  As Rick said, 'exists' allows references to spring
: into existence.

OK, I see your point, though of course it's really creating an
intermediate hash on its way to check for the "actual target" (so to
speak).

: If $ref->{$x} does not exist, should Perl immediately return false, or
: should it first create $ref->{$x}, and then return false when it finds
: that $ref->{$x}{$y} does not exist?
: 
: It appears that some people expect the former behavior.  :-)

I guess for whatever reason I expected the latter so deeply that the
former never even occurred to me.  Gosh, maybe I'm finally being
assimilated into the Perl Collective!

Needless to say, you could get the incremental-check behavior by doing it
explicitly:

  if (exists $ref->{$x} && exists $ref->{$x}{$y}) {

 ...though admittedly that seems unperlishly redundant.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 21 Aug 1998 03:35:58 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Removing one item from long list
Message-Id: <6ripuu$sjn$4@news.iastate.edu>

George H (george@tapestry.net) wrote:
: For the maintenance of a large opt-in mailing list, I use a simple shell
: script to remove an address from a new-line delimited list of addresses.  I
: don't think the script is very efficient.  Basically, it will take the
: address I give it at the command line, verify there is only one match in
: the list, grep (-v) everything but that address into a temporary file, and
: then write the temporary file back into the place of the original.

: This works and has been sufficient until now, but the list is getting large
: and I was wondering if someone with more advanced programming skill could
: offer an alternative in Perl.  I think my current script is too processor
: intensive ... especially if I have a large list of people to remove on a
: given day.

Non-programmatic solution: if you have a large list of people to
remove in a day, wait until the end of the day and remove in one
fell swoop, so you don't go running grep fifty times in the day.



Josh

-- 
Like the ski resort full of girls hunting for husbands and husbands hunting
for girls, the situation is not as symmetrical as it might seem.
        - Alan Lindsay Mackay



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

Date: 20 Aug 1998 23:12:27 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Sigh
Message-Id: <m33eaqx3qs.fsf@windlord.Stanford.EDU>

Adam Rabung <arabung@neweducation.com> writes:

> Presumably, seasoned programmers are here to help.  If you know the
> answer, let the group know.  Otherwise, roll your eyes and click "next".

Lots of us do that.  We're just not as visible as the people who don't,
for somewhat obvious reasons.

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


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

Date: 20 Aug 1998 23:04:56 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: solaris2.6 problems with h2ph && types.ph
Message-Id: <m3af4yx43a.fsf@windlord.Stanford.EDU>

timh <timh@pasport.press.net> writes:

> perl 5.004_04
> In /usr/include/sys/types.h line #381:

> 	#define P_MYPID ((pid_t)0)

> Using h2ph translates this to types.ph line #84

> 	eval 'sub P_MYPID () {(( &pid_t)0);}' unless defined(&P_MYPID);

> A number of scripts that I've run produce the following error:

> Number found where operator expected at (eval 19) line 1, near ")0"
>         (Missing operator before 0?)

> Q. Is the error in the original types.h file or is h2ph doing something
> it shouldn't?

h2ph is doing something that it shouldn't (it does that a lot).  The
version of h2ph that's in 5.005_02 is considerably better than the version
in 5.004_04; if you really need to be able to use those header files from
inside Perl, I recommend you give the new version of Perl a try.

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


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

Date: 20 Aug 1998 23:15:11 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Taint Question
Message-Id: <m3zpcyvp1s.fsf@windlord.Stanford.EDU>

Scratchie <upsetter@ziplink.net> writes:

> Can anyone explain why 

> 	$input =~ m|^/?([\w-]+)$|;
> 	$tag_file = $1;

> results in an untainted $tag_file, but

> 	($tag_file) = ( $input =~ m|^/?([\w-]+)$| );

> doesn't?

Just because that's how tainting works.  It taints anything used on the
same line as the tainted expression, but it doesn't taint the special
regex variables $<digit> so you can use them to untaint things.

man perlsec is a bit unclear on this subject, yes.

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


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

Date: 20 Aug 1998 23:00:35 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Using Perl module without access to Perl installation
Message-Id: <m3g1eqx4ak.fsf@windlord.Stanford.EDU>

Darryl Lee <lee@spam-me-not-darryl.com> writes:
> Regarding the subject line...
> mjtg@cus.cam.ac.uk (M.J.T. Guy) referred us to:

>>> perldoc perlfaq8
>>> 
>>>      How do I keep my own module/library directory?
>>> 
>>>      When you build modules, use the PREFIX option when
>>>      generating Makefiles:
>>> 
>>>          perl Makefile.PL PREFIX=/u/mydir/perl

> This worked fine.  But when i tried the following:

>>>          use lib '/u/mydir/perl';

> i received the following unpleasant message:

> Can't locate Date/Calc.pm in @INC (@INC contains: /home/notyou/perl/ /usr/local/ lib/perl5/i386-freebsd/5.00404 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/i386-freebsd /usr/local/lib/perl5/site_perl .) at ./ski.cgi line 503.
> BEGIN failed--compilation aborted at ./ski.cgi line 503.

> When i dug through my perl directory, and replaced the use lib line
> with something like:

>    use lib '/u/mydir/perl/lib/site_perl';

> ...things started working handily.

In general, I don't think that PREFIX does what I want when installing
modules in a non-standard location.  I always set LIB on the command line
instead, and that puts things where I expect it to.  I haven't had a
chance to take a look at ExtUtils::MakeMaker (which is an ungodly mess)
and figure out where to correct it so that it does what I expect.

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


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

Date: 21 Aug 1998 06:52:53 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Using Perl module without access to Perl installation
Message-Id: <903682909.443031@thrush.omix.com>

Russ Allbery <rra@stanford.edu> wrote:
        >snip<
: In general, I don't think that PREFIX does what I want when installing
: modules in a non-standard location.

        For personal use, it normally doesn't.  Setting it to $HOME or
        similar however, can be very useful (and thus automatically set
        stuff to $HOME/lib/perl5 $HOME/bin $HOME/man, etc).

        It's more for things like PREFIX=/opt.  By default it is set
        to /usr/local unless someone overrided(sp?) it at perl build
        time.

: I always set LIB on the command line instead, and that puts things where
: I expect it to.

        PREFIX also puts things where you expect it to, so long as you are
        expecting the same thing from PREFIX as MakeMaker is.

        :-)

: I haven't had a
: chance to take a look at ExtUtils::MakeMaker (which is an ungodly mess)
: and figure out where to correct it so that it does what I expect.

        Well, I would really recommend against trying to patch MakeMaker
        if that is the intent.

        If you want a finer grain for where things are installed,
        check out the man page for MakeMaker and look for the INSTALL*
        macros.  You can pretty much put any part of an install anywere
        you want with them.  Setting LIB or PREFIX is just a simple
        way to glob all the INSTALL* stuff cleanly.
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 20 Aug 1998 23:03:51 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Utility for news article fetching selected by keywords ?
Message-Id: <m3d89ux454.fsf@windlord.Stanford.EDU>

Gildas Perrot <perrot@francenet.fr> writes:

> Is there any tool to fetch in certain newsgroups, articles selected by
> keywords ?

No, I'm afraid that there is no tool that I know of, although as other
people have pointed out you can probably construct your own tool using
Net::NNTP (which I like somewhat better than News::NNTPClient, although
it's largely a matter of personal taste).  The way that you would do it is
to go into a newsgroup that you're interested in, download the overview
information, and then use standard Perl code to search through that hash
for subject lines containing keywords you're interested in.  That will
give you a set of article numbers, which you can then retrieve using
Net::NNTP and the article() method.

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


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

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


Administrivia:

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

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


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3498
**************************************

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