[12001] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5601 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 7 20:07:22 1999

Date: Fri, 7 May 99 17:00:24 -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, 7 May 1999     Volume: 8 Number: 5601

Today's topics:
    Re: ?= Faster??? <pvorishatesspam@earthlink.net>
        Adding nonexistent functions to symbol table <neb@one.net>
    Re: CGI timeout in web-based listserv (PhelanP)
        Extracting an index from a MS Word 97 doc <gibsonc@aztec.asu.edu>
    Re: Find all files regardless of extension (Bart Lateur)
    Re: Frequent Posters: new group for WWW applications of (Larry Rosler)
    Re: Function vs Object oriented (Alastair)
    Re: HASH references... (Fuzzy Warm Moogles)
        Help with tie hash to file <jv25@andrew.cmu.edu>
    Re: How to keep travelled path in hash ? (Benjamin Franz)
        local vs. my rmhaman@bigfoot.com
    Re: local vs. my <emschwar@rmi.net>
    Re: local vs. my (PhelanP)
    Re: local vs. my <pvorishatesspam@earthlink.net>
        Mind boggling: Unmatched curly brackets worked anna@water.ca.gov
    Re: Mind boggling: Unmatched curly brackets worked (Joey Hess)
    Re: Mind boggling: Unmatched curly brackets worked (John Stanley)
        multi-dimensional arrays (Max Lee)
    Re: PGP package doesn't install...need help (Alastair)
    Re: PGP package doesn't install...need help (Pete Holsberg)
        Rejecting unwanted hits <writer@wi.net>
    Re: tcgrep not expanding command-line wildcards <ebohlman@netcom.com>
        Telnet module and perl script to telnet to remote, perf (KaledBait)
        unable to pass $_ into nested Safe (Joey Hess)
    Re: unable to pass $_ into nested Safe (Andrew Allen)
    Re: using $, (was Re: having problems) (Bart Lateur)
    Re: using $, (was Re: having problems) (Larry Rosler)
    Re: Why my? <emschwar@rmi.net>
    Re: Why my? <design@raincloud-studios.com>
        Win32 Shell SHxxx functions for Perl? (Diego Barros)
    Re: Writing to directory (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 07 May 1999 16:09:50 -0700
From: Phil Voris <pvorishatesspam@earthlink.net>
Subject: Re: ?= Faster???
Message-Id: <373372BE.A40B5341@earthlink.net>

I sw this in MRE as well.  I think that the application you chose for it
definitely avoids its point.  The idea is to be able to find foo only
when followed by bar as in:

/(foo)bar/

which puts foo in $1 and foobar in $&.

whereas

/(foo)(?=bar)/

would put foo in both $1 and $&.

I personally do the former, but I imagine that lookahead could be useful
if you want to start the next match somewhere in the middle of bar. 
Normally, the next match begins after the current $& -- to my
knowledge.  So, you could simply come up with more matches using
lookaheard.  I think.  God knows I never use this.  :)



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

Date: Fri, 07 May 1999 19:53:53 -0400
From: Ben <neb@one.net>
Subject: Adding nonexistent functions to symbol table
Message-Id: <37337D11.4979219E@one.net>

I have the code for a function in a scalar is there anyway to put
this code in the current symbol table so I can use it like a normal
function?  Please email me at neb@one.net.

Ben.



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

Date: 7 May 1999 23:08:25 GMT
From: phelanp@aol.com.gov.zx (PhelanP)
Subject: Re: CGI timeout in web-based listserv
Message-Id: <19990507190825.20931.00001050@ng-ch1.aol.com>

>How can I get this to run such that the sender gets the "done" page rather 
>than a server error message?

Start the Perl mailer script asynchronously, and have it mail the sender the
done page.  The user gets their machine back nearly instantly, and you can take
as long as needed.  If need be, you can have a small Perl script start the
asynch mailer script, and send a result page describing the async start instead
of the mailer result.


==========
I detest SPAM, and boycott the SPAMmers.  Send me ads for your competitors!
(my real email address ends in .com)


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

Date: Fri, 7 May 1999 16:32:31 -0700
From: "gip" <gibsonc@aztec.asu.edu>
Subject: Extracting an index from a MS Word 97 doc
Message-Id: <7gvt87$11a@bmw.hwcae.az.Honeywell.COM>

Does anyone know how to automatically fetch an index from a Word '97
document?

What I'd like to do, using Perl, (or C/C++), is to automate the following
process:

1) Open a Word document
2) Generate an index
3) Fetch the index and save it as a file

The next steps I can handle:

Import index as table into a MS Access db.

Thanks for your time,

Please email me at gip_123@yahoo.com





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

Date: Fri, 07 May 1999 22:51:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Find all files regardless of extension
Message-Id: <37356e3a.15212467@news.skynet.be>

Larry Rosler wrote:

>> 	opendir DIR,$dirpath;
>> 	@matches  = grep { /^filename\./ } readdir(DIR);
>> 	closedir(DIR);
>
>      my $PoB = $dirpath =~ /^[a-z]:/i && '(?i)'; # or something :-)
>	@matches  = grep { /$PoB^filename\./o } readdir(DIR);

Nah... You seem to have overlooked the fact that readdir() returns the
bare filenames (aka "basename"). /^filename\./ is fine.

	Bart.


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

Date: Fri, 7 May 1999 16:33:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Frequent Posters: new group for WWW applications of Perl?
Message-Id: <MPG.119d1816f9cf6053989a05@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

Sorry for quoting the whole thing.  It's hard to cut this yet retain the 
context.  Also sorry for the miserable line wraps in the quoted stuff.  
When I have to change the marker so my newsfeed will accept it my 
response, the lines wrap.  There are just too many to fix.  Please write 
shorter lines, folks!

In article <JXEY2.47$vP2.138@news.rdc1.tn.home.com> on Fri, 07 May 1999 
16:57:13 GMT, Charles R. Thompson <design@raincloud-studios.com> says...
+ >B] The newsgroup comp.lang.perl.misc is IMO a bit too narrowly 
focused
+ >on Perl. It's not just CGI; it's ANYTHING in the "real world". Want 
to
+ >learn more about sockets? Then, clpm is not for you. Damned. Even
+ >questions about proper file locking don't really belong here.
+ >Aren't we being just a bit too narrow-minded?
+ 
+ I don't think so. I think the FP'ers have a good thing going, but as 
the web
+ grows even more it's gonna get worse. They can keep pushing the 
misposters,
+ but a well thought out alternative group would probably take a load 
off.
+ 
+ I'm going to stick my neck out and just say what's on my mind. With 
web
+ development..
+ 
+ 1) I don't always have the option of the newest release of Perl.
+ (Yeah..sometimes 5.000 pre 4 )

Me too, but I haven't found that a problem in c.l.p.misc, except when I 
post an occasional protest or warning response to UPGRADE OR DIE 
answers.

+ 2) I cannot always use modules because of version issues.
+ 3) I usually end up needing only 5% of most modules' functionality so 
I write
+ code myself.
+ 4) Most of what I do is on 'virtual' or 'shared' servers, so
+ 'get-in'-'get-out' efficient Perl code with very little overhead is 
essential.
+ 5) We (web developers) are governed by things like CPU usage time and 
memory,
+ etc. One too many modules can consume a bit too much CPU and your 
script is
+ banned until you streamline it. When you develop for clients, this 
cannot
+ hapopen.

Agreed, which is one reason I'm interested in benchmarking performance.

+ This is the real world I live in, the FP'ers may find it laffable... 
but it's
+ how I make my living.
+ 
+ Most of my solutions have to be written out line by line to fit the 
enviroment
+ I'm thrown in. (Yeah I do use my own reusable libraries... I'm not a 
total
+ idiot). It changes monthly depending on the job I'm on.

My CGI library is less than a hundred lines.  It includes all HTML and 
URL encoding and decoding (about a one-line subroutine each :-), and all 
error checking and handling.

+ There needs to be an area where those of us who cannot be on the 
cutting edge,
+ or use the bloated modules can talk about web-based issues with Perl. 
This is
+ mainly concerned with performance on the web-server.
+ 
+ >C] I can understand Tad's feeling that it's doesn't belong in the
+ >comp.lang.* hierarchy. OTOH, other newsgroups in the heirarchy aren't 
so
+ >picky. Want to know how to get the images dimensions from a GIF file 
in
+ >Delphi? Ask in the Delphi newsgroup. Nobody minds (except if it's a 
FAQ
+ >;-).
+ 
+ It's funny you should mention this, because it helps illustrate the 
point.
+ Someone asked about GIF dimensions with Perl in cgi yesterday. They 
got their
+ answer. Now imagine if it had taken place here, or in another *Perl 
Specific*
+ NG... it needed to. A GIF-Perl question is perfectly valid in 
Perl.misc, or a
+ web-based Perl NG because GIF is a frequently used image type of the 
web. It
+ has nothing to do with CGI.

The question is asked in c.l.p.misc or c.l.p.modules (and answered with 
Image::Size) about once a week, I would guess.  I don't recall anyone 
refusing to answer.
 
+ >Anyway, something like this may be nice:
+ > comp.programming.realworld.perl
+ >Where ANY programming problem, provided that the solution must be
+ >produced in perl, would be acceptable.
+ 
+ >That's what people not accustomed to clpm would expect from it.

The posts I see FPs blowing away are along the lines of 'How do I 
configure my web server to process CGI programs instead of returning 
them to the browser?'.  Questions like, 'It worksd from the command 
line, but not via CGI.' get answered with a FAQ pointer.

+ Umm.. I think Tad may have a word or two on that. Because it steals 
the
+ thunder from here. ANY problem also encompasses problems here. We have 
a
+ phrase we turn in my business that involves any business problem that 
we solve
+ on the web...
+ 
+ I was thinking...
+ 
+ comp.programming.perl.websolutions
+ 
+ Doesn't that encompass FTP, HTTP, HTML, CGI etc... and the Perl 
language in
+ one nice neat package and strip out the non-web related content? It 
also meets
+ Tad's criteria of not being in the lang.perl heirarchy. Perl coming 
first
+ illustrates that the NG isn't just a catch all for web programming. 
It's a
+ Perl group.
+ 
+ Anyone have feedback?

I think there are too many Perl groups already.  I don't think 
comp.lang.perl.moderated has added any value, though I know I am in a 
minority on that.  If this proposal were accepted, there would be even 
less point in having two groups that cover the same narrow (pure Perl 
language -- and function library, I presume -- issues only).

People will still post web-related things here, out of habit or 
ignorance. 

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


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

Date: Fri, 07 May 1999 22:09:43 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Function vs Object oriented
Message-Id: <slrn7j6snj.5c.alastair@calliope.demon.co.uk>

Gabe <grichard@uci.edu> wrote:
>It seems (at least with CGI.pm) that function oriented programming reduces
>keystrokes. Other than that it isn't obvious to me what the significant
>differences are and/or benefits of either. The docs for this module seem to
>prefer the object oriented style, but why?

The CGI docs mention some reasons for the difference (I just noticed yesterday
by chance) ;

For object-orientated, they say ;

<quote>
Although more verbose, this coding style has the advantage of allowing you to
create multiple CGI objects, save their state to disk or to a database, and
otherwise manipulate them to achieve neat effects.

The object-oriented mode also has the advantage of consuming somewhat less
memory than the function-oriented coding style. This may be of value to users
of persistent Perl interpreters such as mod_perl. 
</quote>

I've found myself prefering the function-orientated style more nowadays though.


-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Fri, 07 May 1999 22:21:23 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: HASH references...
Message-Id: <3734672c.13306355@news.oz.net>

On Fri, 07 May 1999 19:11:55 GMT, "Charles R. Thompson"
<design@raincloud-studios.com> wrote:

>>%hash=qw/a 1 b 2 c 3 d 4 e 5/;
>
>I've never seen that before. Interesting.

(The other) Larry would like to see hash slices get more exposure:

    @hash{'a'..'e'} = 1..5;

-- 
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Fri, 7 May 1999 19:34:23 -0400
From: "Jason Vardzel" <jv25@andrew.cmu.edu>
Subject: Help with tie hash to file
Message-Id: <009b01be98e2$23bad430$01454580@digity>

I am trying to write a simple cgi that uses the tie() method.  I am also
very new to perl.  I know that I need a class to tie the hash to, but I
cannot find a simple class to use.  I looked at DB_File but that seemed a
bit too much.  If anyone has worked with this and can point me to a simple
module for use with tie() I would be grateful.

-Jason



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

Date: Fri, 07 May 1999 23:08:53 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: How to keep travelled path in hash ?
Message-Id: <9oKY2.10547$ny.815295@typhoon-sf.snfc21.pbi.net>

In article <7gvjl6$sab$1@xenon.inbe.net>,
Michel Dalle <michel.dalle@usa.net> wrote:
>In article <QyGY2.9081$ny.796334@typhoon-sf.snfc21.pbi.net>, snowhare@long-lake.nihongo.org (Benjamin Franz) wrote:
>>In article <AmFY2.9066$ny.790708@typhoon-sf.snfc21.pbi.net>,
>>Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
>>>In article <7gskak$qpq$1@news.mch.sbs.de>,
>>>Michel Dalle <michel.dalle@usa.net> wrote:
>>>>Hi,
>>>>
>>>>here is a little brain teaser. :-)
>>>>
>>>>I want to keep track of the number of times a certain PATH is travelled 
>>>>through a website/city/forrest/..., and I have a file containing the
>>>>the different pages/pubs/trees/... by each visitor.
>>>>
>>>>E.g. : (who when where)
>>>>mike 01:52 post1
>>>>mike 01:53 post2
>>>>john 01:53 post3
>>>>mike 01:54 post1
>>>>john 01:55 post1
>>>>john 01:56 post2
>>>>mike 01:57 post3
>>>>john 01:58 post2
>>>>..
>>
>>For some reason I just couldn't leave this one alone (probably
>>because I've been considering adding path analysis to my
>>log analysers).
>>
>>Mk 2:
>[some excellent piece of code snipped]
>
>Before you get to Mk 3 :-) can I just point out that your version does not 
>keep track of the FULL path (as I was trying to tackle in the original
>message) ?
>In the current version of aWebVisit, I already keep track of the individual
>links "followed" (although my code is a mess), but I found that the overall 
>picture was still missing. So here it is again :
>
>How do I know in the end that :
>        578 people followed the path : post1->post2-post3->post1
>        1034 people followed the path : post2
>        2454 people followed the path : post1->post2->post1
>        etc.
>and keep this in a structure that doesn't swallow my whole available memory ?
>
>I did a test with :
>        - 100 pages/pubs/...,
>        - each with between 1..20 predefined links to other pages/pubs,
>        - 10000 visits starting at any of the first 10 pages/pubs,
>        - each between 1 and 100 steps long.
>and ended up with 86000+ nodes in my tree. :-(
>
>I still feel there has to be a more efficient way to keep track of this, but
>I haven't figured it out (yet).
>

Ah. Well, I think you have a contradictory set of requirements in that in the
worse case the size of the structure is directly proportional to the size of
the log because you _could_ have a unique path for every visitor - which
would mean your structure would have to have at least one entry per log 
entry to preserve *all* of the paths. You have to impose a 'cut off' depth
to prevent the size explosion. Otherwise the structure grows without limit
if you continue to process logs over time and aggregate the data. You can't
retain *ALL* information from a log in a report or the report becomes as
large as the log it is supposed to be summarizing. I could write something
that could track an indefinite depth - but it would grow indefinitely large.

-- 
Benjamin Franz




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

Date: Fri, 07 May 1999 22:13:10 GMT
From: rmhaman@bigfoot.com
Subject: local vs. my
Message-Id: <7gvohj$3d1$1@nnrp1.deja.com>

I've been reading thru the FAQ on the difference between local() and my() and
have been getting confused.  What is the difference and in which situations
should I use either?

Thanks in advance
Ryan Haman
rmhaman@bigfoot.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 07 May 1999 17:00:30 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: local vs. my
Message-Id: <xkfk8ukjxip.fsf@valdemar.col.hp.com>

rmhaman@bigfoot.com writes:
> I've been reading thru the FAQ on the difference between local() and my() and
> have been getting confused.  What is the difference and in which situations
> should I use either?

I was about to answer this, but I realized I was just going to be
paraphrasing the FAQ.  So perhaps you could explain to us what parts of
the FAQ confused you?  That way, we might be able to improve it so that
others wouldn't be so easily confused.

-=Eric


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

Date: 7 May 1999 23:02:47 GMT
From: phelanp@aol.com.gov.zx (PhelanP)
Subject: Re: local vs. my
Message-Id: <19990507190247.20931.00001043@ng-ch1.aol.com>

>I've been reading thru the FAQ on the difference between local() and my() and
>have been getting confused.  What is the difference and in which situations
>should I use either?

Check out either Programming Perl (the Camel book), or Learning Perl for more
details.  In general, you will almost always want to use my until you clearly
understand the difference (which you may never need to know).

==========
I detest SPAM, and boycott the SPAMmers.  Send me ads for your competitors!
(my real email address ends in .com)


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

Date: Fri, 07 May 1999 16:29:57 -0700
From: Phil Voris <pvorishatesspam@earthlink.net>
Subject: Re: local vs. my
Message-Id: <37337775.D813D86C@earthlink.net>

quick n dirty:

You almost always want to use my.  my limits scope to the sub whereas
local replaces the global version of something for the duration of the
scope, returning the original global value at the end of the block. 
Makes perfect sense, right?  Use my.



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

Date: Fri, 07 May 1999 22:33:39 GMT
From: anna@water.ca.gov
Subject: Mind boggling: Unmatched curly brackets worked
Message-Id: <7gvpo3$4dn$1@nnrp1.deja.com>

The interpreter complained there were one too many right curly brackets.  So I
took out the "offending" right bracket.  The program ran fine afterwards.  But
when I count the number of brackets, the number of left brackets do not match
the the number of right brackets.   ?!?!?!  How could this be?

$
$ runSNOWDATA.0 < z.mail
$ grep \{ runSNOWDATA.0 | wc -l
26
$ grep \} runSNOWDATA.0 | wc -l
25
$

Thanks in advance for your reply,
Anna

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 07 May 1999 22:42:44 GMT
From: joey@kite.kitenet.net (Joey Hess)
Subject: Re: Mind boggling: Unmatched curly brackets worked
Message-Id: <slrn7j6r34.hbd.joey@kite.kitenet.net>

In article <7gvpo3$4dn$1@nnrp1.deja.com>, anna@water.ca.gov wrote:
| The interpreter complained there were one too many right curly brackets.  So I
| took out the "offending" right bracket.  The program ran fine afterwards.  But
| when I count the number of brackets, the number of left brackets do not match
| the the number of right brackets.   ?!?!?!  How could this be?
| 
| $
| $ runSNOWDATA.0 < z.mail
| $ grep \{ runSNOWDATA.0 | wc -l
| 26
| $ grep \} runSNOWDATA.0 | wc -l
| 25
| $

print "{"

Just one of many possibilities. How do you expect anyone to be able to help
you if you don't post the code?

-- 
see shy jo


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

Date: 7 May 1999 23:01:19 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Mind boggling: Unmatched curly brackets worked
Message-Id: <7gvrbv$89n$1@news.NERO.NET>

In article <7gvpo3$4dn$1@nnrp1.deja.com>,  <anna@water.ca.gov> wrote:
>when I count the number of brackets, the number of left brackets do not match
>the the number of right brackets.   ?!?!?!  How could this be?

Brackets or braces? Try counting the braces in the following lines.
Perhaps it will give you a clue. (Hint: the number of left braces is the
same as the number of right braces.)

{{{{{{{{{{
}
}
}
}
}
}
}
}
}
}



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

Date: 7 May 1999 23:44:12 GMT
From: maxlee@barley.cs.jhu.edu (Max Lee)
Subject: multi-dimensional arrays
Message-Id: <7gvtsc$8bh@foobar.cs.jhu.edu>

After creating a multi-dimensional array -- let's say a 2-D array --
what's the simplest way of traversing it element by element without
knowing in advance the number of rows or columns in the array?  I would
like to do something to the effect:

For a 2-D array "@arr"

for $x (0..some_number) {
	for $y (0..some_other_number) {
		print $arr[$x][$y]; 
	} 
}

In my particular case, I'm reading data into a 2D array from a file.  Each
element on a line (column) is separated by whitespace and each line
constitutes a row of an array -- with each line and the number of
lines in the file being of indeterminate length.  Of course, I can
determine the number of lines and elements per line while reading the
file, but it seems a little awkward doing so, when with one-dimensional
arrays, I can simply do a "foreach" statement or a "for ($x = 0; $x <
@arr_1d; $x++)".

Thanks,

Max S. Lee


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

Date: Fri, 07 May 1999 22:24:15 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: PGP package doesn't install...need help
Message-Id: <slrn7j6tir.5c.alastair@calliope.demon.co.uk>

Pete Holsberg <pjh@mccc.edu> wrote:
>
>Can't locate PGP/Pipe.pm in @INC (@INC contains:
>/usr/local/lib/perl5/sun4m/5.00401 /usr/local/lib/perl5
>/usr/local/lib/perl5/site_perl/sun4m
snip

Just tried it as well. Same problem. Given the module is dated 1996, I'd hazard
a guess that it's not quite kept up with the times. Perhaps one of the other PGP
modules will be more useful.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 7 May 1999 23:44:26 GMT
From: pjh@mccc.edu (Pete Holsberg)
Subject: Re: PGP package doesn't install...need help
Message-Id: <7gvtsq$hju$1@lawrenceville.mccc.edu>

Alastair (alastair@calliope.demon.co.uk) wrote:
: Pete Holsberg <pjh@mccc.edu> wrote:
: >
: >Can't locate PGP/Pipe.pm in @INC (@INC contains:
: >/usr/local/lib/perl5/sun4m/5.00401 /usr/local/lib/perl5
: >/usr/local/lib/perl5/site_perl/sun4m
: snip
: 
: Just tried it as well. Same problem. Given the module is
: dated 1996, I'd hazard a guess that it's not quite kept
: up with the times. Perhaps one of the other PGP modules
: will be more useful.

I take it that I cannoy just create the directories and
copy Pipe.pm to them?

Is there another PGP module that does PGP?

Thanks,
Pete


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

Date: Fri, 07 May 1999 16:45:06 -0500
From: Ed Lake <writer@wi.net>
Subject: Rejecting unwanted hits
Message-Id: <37335EE2.1626D17A@wi.net>

I'm looking for a way to reject hits on my web site that come from links
on certain other web sites.  Someone told me that it can be done by
inserting some PERL code into the index.cgi file.

I'm totally new at this, and I'm wondering if this is the right place to
start asking questions.  I've never coded anything in PERL, and I've
never modified my index.cgi file.  Among other things I'm going to need
to know is how to quickly recover if what I try to do doesn't work.  Is
there a FAQ file?  Am I in the right ballpark here?

Ed




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

Date: Fri, 7 May 1999 23:21:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: tcgrep not expanding command-line wildcards
Message-Id: <ebohlmanFBDy7F.IL3@netcom.com>

Eric Pement <epement@jpusa.chi.il.us> wrote:
: I suspect the problem is with ActiveState perl itself, because it fails
: the following test where tcgrep is in the current directory:

:      perl -ne "print if /match/" tc*.*

: generating this error message:

:      Can't open tc*.*: No such file or directory

: This behavior definitely did not occur with build 315, nor with earlier
: versions of Perl for DOS. Has anyone noticed this problem before? Any
: suggested fixes?

The 300-series builds incorporated built-in (transparent) command-line 
glob expansion.  The more recent versions don't, but there's a workaround 
as shown in this rather old message from Gurusamy Sarathy:

>From ix.netcom.com!www.nntp.primenet.com!globalcenter1!news.primenet.com!nntp.primenet.com!newsxfer3.itd.umich.edu!news.eecs.umich.edu!srvr1.engin.umich.edu!gsar Sun Sep 14 05:43:18 1997
Path: ix.netcom.com!www.nntp.primenet.com!globalcenter1!news.primenet.com!nntp.primenet.com!newsxfer3.itd.umich.edu!news.eecs.umich.edu!srvr1.engin.umich.edu!gsar
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Newsgroups: comp.lang.perl.misc,comp.lang.perl.tk
Subject: Re: Win 95 Perl & Tk
Date: 13 Sep 1997 16:26:53 GMT
Organization: University of Michigan, Ann Arbor
Lines: 44
Message-ID: <5veesd$mov@srvr1.engin.umich.edu>
References: <340F31AC.7D86@erols.com> <5vd4qf$nlr@q.seanet.com>
NNTP-Posting-Host: aatma.engin.umich.edu
Xref: ix.netcom.com comp.lang.perl.misc:94028 comp.lang.perl.tk:5225

  [ mailed and posted ]

In article <5vd4qf$nlr@q.seanet.com>, Allen Evenson <ase@seanet.com> wrote:
>Harold Corbin wrote in article <340F31AC.7D86@erols.com>...
>>I haven't run much yet, just the widget demo and there is only one way
>>to describe it - WOW,  WOW!!!!!!!  Thank You Gurusamy Sarathy and
>>everyone who helped make this available.
>
>I second this emotion! I have also had success downloading and installing
>the port on my Win95 box.

Glad to hear it works, thanks.

>The only trouble i've had to date, is with argv globbing that used to work
>with a
>previosly installed activeware port.
>
>my old script (a grading program) used to work untouched with the following
>invocation:
>'perl -w grader key *.grd'
>
>with the new port i received "*.grd" not found, until I READ THE
>DOCUMENTION!
>I needed to  'use File::DosGlob 'glob';  # override CORE::glob'
>and modify my script to glob each argv element [...]

There's of course a more transparent way to get @ARGV globbing
(one that doesn't involve hacking every source file).

Set PERL5OPT in your environment to "-MWild" (or append, if you already
have something in PERL5OPT), and make sure you put Wild.pm below in
your perl's "lib" directory:

# Wild.pm - emulate shell @ARGV expansion on shells that don't
use File::DosGlob;
@ARGV = map { my @g = File::DosGlob::glob($_) if /[*?]/; @g?@g:$_ } @ARGV;
1;

Unlike compiling the @ARGV expansion into the binary (which has
compatibility and reliability problems too), this is a fully
*optional* solution.

 - Sarathy.
   gsar@umich.edu




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

Date: Fri, 07 May 1999 22:17:11 GMT
From: smith157@marshall.edu (KaledBait)
Subject: Telnet module and perl script to telnet to remote, perform commands and log output
Message-Id: <37335db3.201587@news.fuse.net>

Hi,

	I am attempting to write a perl script that will connect to a
remote host via telnet, login, perform a couple of commands, log the
output generated by those commands and then logoff.

	In a previous post a few weeks ago I noticed someone mention
there is a telnet module that will allow you to perform commands on a
remote host.

	Can someone give me or point me to more information on this ?

Thanks

	KaledBait - smith157ATmarshall.edu


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

Date: Fri, 07 May 1999 22:32:36 GMT
From: joey@kite.kitenet.net (Joey Hess)
Subject: unable to pass $_ into nested Safe
Message-Id: <slrn7j6qg2.hbd.joey@kite.kitenet.net>

I'm seeing this problem with perl 5.004_04 and perl 5.005_56. If I try to
pass data into a Safe's reval() command using $_, it works, but if I am
already inside a safe and try to pass data into another call to reval(), it
doesn't.

My test case is below. If I pass 1 to it, it runs code in a Safe, and gives:

% perl test.pl 1
safe code got: test
nested safe code got: 

If I pass nothing to it, it runs the code inside eval and I get the results
I'd expect if I ran it in a Safe:

% perl test.pl
safe code got: test
nested safe code got: test

Here's the test case:

#################################################################
#!/usr/bin/perl

my $use_safe=shift;

use Safe;
$safe=Safe->new;
$safe->permit_only(qw{:default entereval});
$safe->share(qw{ &safe_run });

sub safe_run {
	$code=shift;
	$_="test";
	return $safe->reval($code) if $use_safe;
	return eval $code;
}

print safe_run(q{
	return "safe code got: $_\n".
	safe_run(q{
		return "nested safe code got: $_\n";
	});
});
################################################################

I had assumed this would work because the docs for Safe.pm say that:

     By default, the only variables shared with compartments are the
     "underscore" variables $_ and @_ (and, technically, the less frequently
     used %_,

-- 
see shy jo


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

Date: 7 May 1999 23:24:12 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: unable to pass $_ into nested Safe
Message-Id: <7gvsms$ei7$1@fcnews.fc.hp.com>

Joey Hess (joey@kite.kitenet.net) wrote:
: I'm seeing this problem with perl 5.004_04 and perl 5.005_56. If I try to
: pass data into a Safe's reval() command using $_, it works, but if I am
: already inside a safe and try to pass data into another call to reval(), it
: doesn't.

I think this is explained by the Safe module docs:

  Any string eval which is executed by code executing in a
  compartment, or by code called from code executing in a
  compartment, will be eval'd in the namespace of the
  compartment. This is potentially a serious problem.

  Consider a function foo() in package pkg compiled outside a
  compartment but shared with it. Assume the compartment has a
  root package called 'Root'. If foo() contains an eval
  statement like eval '$foo = 1' then, normally, $pkg::foo will
  be set to 1.  If foo() is called from the compartment (by
  whatever means) then instead of setting $pkg::foo, the eval
  will actually set $Root::pkg::foo.

In a roundabout way, safe_run is doing the warned-about eval (via
reval). That's illustrated by changing the last statement in your
example to:

  print safe_run(q{
          return "safe code got: $_ ".(*_)."\n".
          safe_run(q{
                  return "nested safe code got: $_ ".(*_)."\n";
          });
  });

which prints

  safe code got: test *main::_
  nested safe code got:  *Safe::Root0::_

In other words: eval's (and by extension, reval's) in Safe
compartments can't access shared variables.

Andrew


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

Date: Fri, 07 May 1999 22:50:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: using $, (was Re: having problems)
Message-Id: <37346d81.15027095@news.skynet.be>

Larry Rosler wrote:

>Did this drop out of your copy of my benchmark?  Writing to a real file 
>adds system overhead and variance.
>
>open OUT, '>NUL' or die "Couldn't open 'NUL'. $!";
># Pardon my misspelling of '/dev/null'.  :-)

To quote a word that was used heavily today: "it was implicit". :-)

I changed the code, and I did't post the changes. I put the file in my
"temp" directory, so it gets removed automatically next time I boot.

	Bart.


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

Date: Fri, 7 May 1999 16:35:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: using $, (was Re: having problems)
Message-Id: <MPG.119d188586819180989a06@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37346d81.15027095@news.skynet.be> on Fri, 07 May 1999 
22:50:12 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Larry Rosler wrote:
> 
> >Did this drop out of your copy of my benchmark?  Writing to a real file 
> >adds system overhead and variance.
> >
> >open OUT, '>NUL' or die "Couldn't open 'NUL'. $!";
> ># Pardon my misspelling of '/dev/null'.  :-)
> 
> To quote a word that was used heavily today: "it was implicit". :-)
> 
> I changed the code, and I did't post the changes. I put the file in my
> "temp" directory, so it gets removed automatically next time I boot.

What file?  I think you missed the smiley.  :-)

NUL is the PoB name for /dev/null.  If you are using Unix, use 
'/dev/null' and there will be no file to write or remove.

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


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

Date: 07 May 1999 16:50:57 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Why my?
Message-Id: <xkfn1zgjxym.fsf@valdemar.col.hp.com>

"Charles R. Thompson" <design@raincloud-studios.com> writes:
> >I think I'll go home and write out "I will NOT use commas in qw lists"
> >1000 times, or something.  Sheesh.
> 
> You'll just end up doing it with a loop. Admit it! :)

No, I'll do it the hard way-- cut and pase. ;-)

-=Eric


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

Date: Fri, 07 May 1999 23:06:16 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Why my?
Message-Id: <IlKY2.336$vP2.231@news.rdc1.tn.home.com>

>No, I'll do it the hard way-- cut and pase. ;-)


That will be hard without the t. ;P




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

Date: Fri, 07 May 1999 23:11:27 GMT
From: alien@netspace.net.au (Diego Barros)
Subject: Win32 Shell SHxxx functions for Perl?
Message-Id: <373372e1.7399630@news.netspace.net.au>

Are the Win32 Shell commands such as those that begin with SHxxxx
available in a module for Perl?

Regards,
Diego Barros


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

Date: Fri, 7 May 1999 15:21:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Writing to directory
Message-Id: <MPG.119d072bc9c30da5989a04@nntp.hpl.hp.com>

[A courtesy copy NOT mailed because of a munged address.]

In article <7gvi80$73t@dfw-ixnews8.ix.netcom.com> on Fri, 7 May 1999 
16:31:11 -0400, YDS <rmthisyegor@andthisgrn.com> says...
> What would be the way to write a file into directory tree under "nobody"
> environment.
> 
> As I see, there are two alternative (equally poor in some sense):
> 
> 1) make the directory tree nobody writable

I would make the directory to be written into writable by a group of 
which 'nobody' is a member (perhaps the only member), and make that 
group be the group of the directory, with 775 permissions.  Then it 
doesn't matter who the owner of the directory is, presumably 'root'.

The files should be written with 664 permissions (umask 002).

I don't see why this is a poor alternative.

> 2) have SUID script executed

NEVER!

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


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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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