[10601] in Perl-Users-Digest
Perl-Users Digest, Issue: 4193 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 10 19:07:21 1998
Date: Tue, 10 Nov 98 16:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 10 Nov 1998 Volume: 8 Number: 4193
Today's topics:
arranging form input in ascending order <gss2@roogna.eng.wayne.edu>
Can A Perl/CGI Script prevent robots? (Vikram Pant)
Re: Can A Perl/CGI Script prevent robots? (brian d foy)
Re: concurrently writing to a file without doing flock <bill@fccj.org>
Re: Converting HTML tag and attribute case - Regular Ex <gellyfish@btinternet.com>
CPAN "r" command is confused? (John G Dobnick)
Re: deleting spaces between fields <quartz@nonspam.idiom.com>
Re: Difficulty with PERL <rootbeer@teleport.com>
Re: History Lesson... <uri@fastengines.com>
Re: How can I find out... <gellyfish@btinternet.com>
how to define global variables across files with the "u <heng00@pop.uky.edu>
installing ParseLex on NT <sgordon@kenan.com>
Linked perl source files <john.wood@diamond.co.uk>
Re: Newbie question, uppercase a string.. (Tad McClellan)
percentages <dixonmat@pouch.com>
Re: percentages (Larry Rosler)
Re: Perl "Newbie" Needs Help Debugging Code <altenbur@ncsa.uiuc.edu>
Re: PERL is TOO flexible <bill@fccj.org>
Re: perl5 and oracle (brian d foy)
Re: Problems With a CGI Script <rootbeer@teleport.com>
Re: pwd without backticks? (Ilya Zakharevich)
Re: pwd without backticks? <uri@fastengines.com>
Re: select case? <bill@fccj.org>
Strange permission behaviuor - what's wrong? <hjbraendle@gmx.net>
Re: Strange permission behaviuor - what's wrong? (brian d foy)
Re: Strange permission behaviuor - what's wrong? (Erik)
Win32::Process -- Inheriting IO::Socket Handles <george.kuetemeyer@mail.tju.edu>
Win32::Shell dimard@my-dejanews.com
Re: Win32::Shell <george.kuetemeyer@mail.tju.edu>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 10 Nov 1998 18:04:27 -0500
From: shienh gurpreet <gss2@roogna.eng.wayne.edu>
Subject: arranging form input in ascending order
Message-Id: <3648C67B.9BD99A28@roogna.eng.wayne.edu>
I'm trying to take in some data from the user through a form field and,
depending on the choices he/she makes, I'll have this info appended to
an existing web page or a new one if it doesn't exist. Here's the
problem. Say, I have 4 name=value pairs coming from the form.
e.g. name=john&url=http://test&age=25&sex=male
When I add this info to the web page, I want to arrange it in ascending
or decending order using age so that if I already have
age=18
age=39
age=47
on the web page, this new info should go in at no. 2 in the list.
Thanks
------------------------------
Date: Tue, 10 Nov 1998 17:51:51 -0500
From: nospam@wam.umd.edu (Vikram Pant)
Subject: Can A Perl/CGI Script prevent robots?
Message-Id: <MPG.10b28d9366d47a0a9896a5@news.wam.umd.edu>
I have a simple script which is passed a wav file and returns the sound
to be played by the browser.
My question is can a web robot get this file?
<a href="sounds.cgi?Heat+deniro.wav">Deniro</a>
I implemented this small script thinking it would stop robots, only to
realize that it is still a link and can be grabbed.
Thanks,
Vikram Pant
------------------------------
Date: Tue, 10 Nov 1998 18:05:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Can A Perl/CGI Script prevent robots?
Message-Id: <comdog-ya02408000R1011981805260001@news.panix.com>
In article <MPG.10b28d9366d47a0a9896a5@news.wam.umd.edu>, usenet@vikrampant.com posted:
> My question is can a web robot get this file?
> <a href="sounds.cgi?Heat+deniro.wav">Deniro</a>
yes.
> I implemented this small script thinking it would stop robots, only to
> realize that it is still a link and can be grabbed.
you can't stop robots. you can only advise robots where they cannot
go, although they don't have to listen to that advise.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 10 Nov 1998 18:17:35 -0500
From: Bill Jones <bill@fccj.org>
Subject: Re: concurrently writing to a file without doing flock
Message-Id: <3648C98F.83D09948@fccj.org>
ronald_f@my-dejanews.com wrote:
>
> What is the worst thing that can happen when several processes print to the
> same file, without using flock, every print writes exactly one line, and the
> file handles are set to unbuffered? In particular: Could it be that some lines
> arrive split into pieces or get lost?
>
> From the FAQ I conclude that, using autoflush, the buffer is flushed at the
> end of each print statement, so I think that no lines should be lost, and
> every line is written to the file in one piece. Can someone confirm this?
>
> Ronald
> --
> Ronald Fischer <ronald_f@my-dejanews.com>
> http://ourworld.compuserve.com/homepages/ronald_fischer/
You can confirm it yourself.
While confirming it you should notice that you get non-portable
and inconsistent results varying from platform to platform.
Not using file locking while concurrently writing basically
sets up a 'round robin' write queue - who ever finishes
last gets their data safely written - all others who finished
first loses. But your mileage may vary from system to system.
HTH,
-Sneex- :]
______________________________________________________________________
Bill Jones | 904/632-3089 | http://www.fccj.org/cgi/mail?webmaster
(Contrary to the general lack of support within 'Open Source' coding -
I support what I write... Others haven't, can't, or won't...)
------------------------------
Date: 10 Nov 1998 21:52:21 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Converting HTML tag and attribute case - Regular Expression help
Message-Id: <72acil$uj$1@gellyfish.btinternet.com>
On Tue, 10 Nov 1998 00:34:21 GMT Lee Borkman <borkman@usa.net> wrote:
> Hi all,
>
> I am trying to make an RE to convert all HTML tag names and tag
> attribute names to upper case. The attribute values must be
> unchanged. For example, I want to convert:
>
As Tom has already pointed out you really dont want to be be using a
Regular Expression to do this - but as luck would have it I already have
made a script that will do what you want (and a little more).
<URL:http://www.btinternet.com/~gellyfish/resources/htbeauty.htm>
It probably could do with a little work but hey !
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Nov 1998 23:31:27 GMT
From: jgd@alpha3.csd.uwm.edu (John G Dobnick)
Subject: CPAN "r" command is confused?
Message-Id: <72aicf$j18$1@uwm.edu>
[I sent this to c.l.p.modules, but after a week there were exactly _zero_
respponses. This must _not_ be a module problem, I guess.]
We are running Perl 5.005_02 on an "alpha-dec_osf" system.
(Complete prtl -V config listed below, if it's needed.)
I installed the TK::Pod module, and when I then issue a CPAN "r"
command (to obtain its idea of "reinstallation recommendations")
it tells me the following:
Package namespace installed latest in CPAN file
Tk::Pod 3.14 3.14 ACH/Tk-Pod-0.10.tar.gz
129 installed modules have no parseable version number
But.... I just _installed_ version 3.14. So, what's going on here?
o Is this a Perl problem?
o Is this a CPAN problem?
o Is this a module problem?
o Where is the best place to ask about this?
Complete perl -V output:
---- Start ---------
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
uname='osf1 alpha1.csd.uwm.edu v4.0 878 alpha '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O4', gccversion=
cppflags='-std -ieee -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
ccflags ='-std -fprm d -ieee -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=8, ptrsize=8, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /var/shlib
libs=-lgdbm -ldbm -ldb -lm
libc=/usr/shlib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym -s -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under dec_osf
Compiled at Oct 26 1998 12:34:10
@INC:
/usr/local/test/lib/perl5/5.00502/alpha-dec_osf
/usr/local/test/lib/perl5/5.00502
/usr/local/test/lib/perl5/site_perl/5.005/alpha-dec_osf
/usr/local/test/lib/perl5/site_perl/5.005
.
-------- End ----------
Thanks,
--
John G Dobnick "Knowing how things work is the basis
Information & Media Technologies for appreciation, and is thus a
University of Wisconsin - Milwaukee source of civilized delight."
jgd@csd.uwm.edu ATTnet: (414) 229-5727 -- William Safire
------------------------------
Date: Tue, 10 Nov 1998 15:32:09 -0800
From: "Larry Quantz" <quartz@nonspam.idiom.com>
Subject: Re: deleting spaces between fields
Message-Id: <72aii4$pvp$1@ramona.sfo.com>
There's no hope. Give it up and pack it in.
Marcus J. Foody wrote in message <36472471.26B4@idiom.com>...
>I have a text file that has leading and trailing spaces. The whitespaces
>are between fields. The fields are tilde delimited
>for example:
>
>REC ITEMS~0001~EA ~00000000200.00~TEST DESCRIPTION1
>XXXXXXXXXXXXXXXYZ DESCRIPTION2 XXXXXXXXXXXXXXXYZ
>~
>I need to get rid of leading and trailing spaces between fields. What I
>would like the text file to look liks is.
>REC ITEMS|0001|EA|00000000200.00|TEST DESCRIPTION1 XXXXXXXXXXXXXXXYZ
>DESCRIPTION2 XXXXXXXXXXXXXXXYZ|
------------------------------
Date: Tue, 10 Nov 1998 22:22:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Difficulty with PERL
Message-Id: <Pine.GSO.4.02A.9811101420340.7469-100000@user2.teleport.com>
On Tue, 10 Nov 1998 ashish_nina@my-dejanews.com wrote:
> Subject: Difficulty with PERL
Aren't they all? :-)
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I do not have access to any web server where I can test my scripts
Fortunately, you don't need one. Use the CGI module to make your CGI
programs, and you should be able to do most testing from the command line.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Nov 1998 18:27:46 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: History Lesson...
Message-Id: <sar3e7r9lhp.fsf@camel.fastserv.com>
>>>>> "GS" == Geoff Simmons <g.simmons@elmshorn.netsurf.de> writes:
GS> In article <3647BD5C.F4CB73D3@cgo.wave.ca>, Toni-Lynn Hamilton
GS> <tonilynn@cgo.wave.ca> wrote:
>> I'm doing a group presentation at school on Perl and I have been elected
>> to find the history of Perl. I checked out the one FAQ and it has
>> Perl's physical history, release dates and updates but it is not exactly
>> what I'm looking for.
the actual posting from larry about perl is at:
ftp://ftp.leo.org/pub/comp/programming/languages/script/perl/oasis/src/perl1/example
some folks were talking about doing an article on the history of perl
for TPJ. this should be one of the sources.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 10 Nov 1998 21:28:36 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How can I find out...
Message-Id: <72ab64$u3$1@gellyfish.btinternet.com>
On Tue, 10 Nov 1998 16:55:35 GMT dave@mag-sol.com wrote:
> In article <364849cd.6031833@193.74.210.130>,
> Frook@mail.dma.be (Orlando Frooninckx) wrote:
>> Hi,
>>
>> does anyone know how I can find out which PERL modules my ISP has
>> installed? I asked him a week ago, but still no reply, that is why I
>> wanna try to find out myself...
>
> Orlando,
>
> I have a script that does just that. You can see it in action at:
>
> <http://www.mag-sol.com/cgi/perl_env.pl>
>
Just for fun here is a little thing that not only displays the available
modules but also lets you read the POD !!
OK it's crap and it'll give 'document contains no data' if there is no
POD in the module and it relies on some modules being there in the first place
but I was driven mad by "Carol Vorderman's Mysteries" (the chief amongst which
is how come she is on the telly every five minutes :) -
#!/usr/bin/perl
use File::Find;
use CGI;
use Pod::Html;
my $query = new CGI;
print $query->header;
if ( $podfile = $query->param('podfile') )
{
open(STDERR,'>/dev/null') || die "really cant cope with that -$!\n";
if(chdir("/tmp")) # my system prefers that
{
pod2html("--infile=$podfile","--noindex");
}
}
else
{
$query->start_html("Perl Installation Details"),"\n";
print <<EOX;
<H1>
Perl Installation details
</H1>
Perl version : $] <BR>
\@INC is :
EOX
print join("<BR>\n",@INC);
print "Installed modules: <BR>\n";
find(\&wanted,@INC);
sub wanted
{
if ($File::Find::name =~ /\.pm$/)
{
open(MODFILE,$File::Find::name) || return;
while(<MODFILE>)
{
if (/^ *package +(\S+);/)
{
print qq|<A HREF="findlibs.pl?podfile=$File::Find::name">|,
$1,"</A><BR>\n";
last;
}
}
}
}
print "</BODY></HTML>\n";
}
__END__
What more can I say ;-P
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Tue, 10 Nov 1998 18:47:29 -0500
From: Huar En Ng <heng00@pop.uky.edu>
Subject: how to define global variables across files with the "use strict" on?
Message-Id: <3648D091.B74704F4@cs.engr.uky.edu>
I am working on a multiple files perl program. I would like to have a
file to store all the global variables and be able to be "included" in
other files. However, I would also like to turn on the "use strict"
flag.
Seems like the "use strict" would now let me use a variable declared in
another file. So I tried to created a package "global.pm" and "use
Global" as a work around. To my surprise, none of the exported
variables are visible in files that "use global".
I know in C, we can use things like extern int x, but in Perl ???
Here is how my global.pm look like:
*****************************************
package Global;
use strict;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT = qw($DEBUG
$MENU_CGI
%MENU_ITEMS
);
@EXPORT_OK = qw();
%EXPORT_TAGS = ( );
}
$MENU_CGI = "./cgi-bin/menu.pl";
%MENU_ITEMS = ("c" => "Continue",
"q" => "Quit");
*************************************************************
Have I use the export correctly ? Any help would be greatly appreciated
Desmond
------------------------------
Date: Tue, 10 Nov 1998 18:08:29 -0500
From: Seth Gordon <sgordon@kenan.com>
Subject: installing ParseLex on NT
Message-Id: <3648C76C.360E078@kenan.com>
I am working on an NT (4.0, build 1381) machine[*] with the
ActiveState binary of Perl (5.005_02, ActiveState build 506) and the
Cygwin (beta 20) package of Unix-like tools. Both Perl and Cygwin
were installed in the default directories.
I'm trying to install the ParseLex module. This is what I get:
======================
bash.exe-2.02$ pwd
/c/Perl/bin/ParseLex-2.04
bash.exe-2.02$ perl Makefile.pl
Unable to find a perl 5 (by these names: c:\Perl\bin\perl.exe miniperl
perl
perl5 perl5.00502, in these dirs:
c:\cygnus\cygwin-b20\H-i586-cygwin32\bin
C:\Perl\bin C:\Perl\bin C:\orant\bin C:\WINNT\system32 C:\WINNT
c:\sybase\DLL c:\sybase\BIN C:\Perl\bin)
Writing Makefile for Parse::Lex
bash.exe-2.02$ ls /c/perl/bin
Cmd32.exe lwp-mirror perlw32-install.bat
GET lwp-mirror.bat perlw32-install.txt
HEAD lwp-request perlw32-uninstall.bat
POST lwp-request.bat pl2bat.bat
ParseLex-2.04 lwp-rget pl2pm.bat
ParseLex-2_04_tar.gz lwp-rget.bat pod2html.bat
Perl300.dll p_uninst.dat pod2latex.bat
PerlMsg.dll perl.exe pod2man.bat
PerlSE.dll perl.lnk pod2text.bat
PerlSE.pl perl5.00502.exe ppm.bat
a2p.exe perlbug.bat ppm.pl
c2ph.bat perlcc.bat pstruct.bat
find2perl.bat perlcore.dll runperl.bat
h2ph.bat perldoc.bat s2p.bat
h2xs.bat perlez.dll search.bat
install.log perlglob.bat splain.bat
lwp-download perlglob.exe uninstall.pl
lwp-download.bat perlis.dll www.bat
bash.exe-2.02$ printenv PATH
/c/cygnus/cygwin-b20/H-i586-cygwin32/bin:/c/Perl/bin:/c/Perl/bin:
/c/orant/bin:/c/WINNT/system32:/c/WINNT:/c/sybase/DLL:/c/sybase/BIN:.
bash.exe-2.02$ make
Makefile:657: *** missing separator. Stop.
======================
[To prevent lines in this message from getting too long, I inserted
carriage
returns into the outputs of Makefile.pl and printenv.]
Am I doing something wrong, or do the makefiles simply not work on
Win32 systems? If there's no workaround for this, where, if anywhere,
can I download ParseLex with PPM?
[*]Yeah, I wish I could be doing this project on Unix, too. Before I
started this job I had a prejudice against Windows; now I have
justified disdain for it.
--
perl -le'$m="r 0rJaa.u0cksthe";$c=967150;s/$/substr$m,($i\
+=$c%2?4:1)%=16,1or$i-2?"no":"Perl h"/e while$c>>=1;print'
== seth gordon == sgordon@kenan.com == standard disclaimer ==
== documentation group, kenan systems corp., cambridge, ma ==
------------------------------
Date: Tue, 10 Nov 1998 23:57:48 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Linked perl source files
Message-Id: <72ajp1$gr2$1@nclient3-gui.server.ntli.net>
Is it possible for a Perl script to take it's main body from another linked
file? Similar to .js files for JavaScript?
Sorry if it's a bit of a newbie question...
Thanks,
-Paul.
------------------------------
Date: Tue, 10 Nov 1998 16:54:16 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie question, uppercase a string..
Message-Id: <o6ga27.a1e.ln@flash.net>
Erik (eln@cyberhighway.net) wrote:
: [Posted and mailed]
: In article <3648B7EB.93E57D00@sprintmail.com>,
: Chris Duerr <cdduerr@sprintmail.com> writes:
: > require a variable to be changed to uppercase. Can anyone please help?
: Well, if you wanted to use a regular expression, i guess you could use
: something like:
: $test =~ s/[a-z]/[A-Z]/g;
: or something.
Huh?
---------------
#!/usr/bin/perl -w
$test = 'abc';
$test =~ s/[a-z]/[A-Z]/g;
print "$test\n";
---------------
outputs:
[A-Z][A-Z][A-Z]
Please don't "help" by posting guesses.
It will only confuse folks further.
maybe you meant: $test =~ tr/a-z/A-Z/; # ignores locale...
or: $test =~ s/([a-z])/\U$1/g; # inefficient
???
: But then, using
: $test = uc($test);
: is probably a little easier.
It is a *whole lot* better.
1) it actually works ;-)
2) it respects locale
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Nov 1998 22:07:04 GMT
From: "News" <dixonmat@pouch.com>
Subject: percentages
Message-Id: <cO222.34$5v3.217390@news.optonline.net>
here is what I have I know the formula is correct but in my shopping cart
what am I missing?
if ($gtot < 1000) { $gtot * .025; }
$gtot = &Monify ($gtot);
print "<Td bgColor=\"#$tdBg1\" Align=left><b><Font Color=Red>Discount
Rate</font></b><Td bgColor=\"#$tdBg1\" Align=right><b><Font
Color=Red>$currency $gtot</Font></b><Tr>\n";
if you need more info please e-mail me back
------------------------------
Date: Tue, 10 Nov 1998 14:37:44 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: percentages
Message-Id: <MPG.10b260128c8194a898986a@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <cO222.34$5v3.217390@news.optonline.net> on Tue, 10 Nov 1998
22:07:04 GMT, News <dixonmat@pouch.com> says...
> here is what I have I know the formula is correct but in my shopping cart
> what am I missing?
>
> if ($gtot < 1000) { $gtot * .025; }
You are missing two things: an equals sign (the expression in braces has
no effects) and the '-w' flag (which would have warned you about this).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 10 Nov 1998 16:16:53 -0600
From: david lee altenburg <altenbur@ncsa.uiuc.edu>
Subject: Re: Perl "Newbie" Needs Help Debugging Code
Message-Id: <3648BB54.8AE9156B@ncsa.uiuc.edu>
Hi!
I know I'm a bit late, but I thought I'd offer a bit of advice.
One of the best things you could do for yourself at this point is learn
how to use the perl debugger. Once you get the hang of it, it will
cut hours off of the time you spend debugging. It probably would
have helped you to catch the error you were describing really quickly.
You mentioned that you printed the variable in questino to STDOUT, and
you had the right idea by doing that. However, the debugger would have
let you see the value of the variable at any point in the program ( to see if
it changes when it should, etc. ) It also eliminates the need for lots of print
statements ( which seem to get exponentially more numerous as the size of
your programs grow ).
At any rate, good luck as you continue to learn Perl! =)
David Altenburg
------------------------------
Date: Tue, 10 Nov 1998 18:20:55 -0500
From: Bill Jones <bill@fccj.org>
Subject: Re: PERL is TOO flexible
Message-Id: <3648CA57.9AA94006@fccj.org>
Anita M Wilcox wrote:
>
> In article <82k91b1dlp.fsf@shell2.shore.net>, Jay Rogers <jay@rgrs.com> wrote:
> >Brent Michalski <perlguy@technologist.com> writes:
> >
> >> In article <3638676E.F980FC4A@harris.com>,
> >> PERL ROCKS! <emills@harris.com> wrote:
> >> > "Although the Perl Slogan is There's More Than One Way to Do It, I
> >> > hesitate to make 10 ways to do something. :-) "
> >> > --Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>
> >> >
> >> >is along these lines- why make more than ONE? What did it add, Larry?
> >>
> >> Wow, I *HAD* to comment on this "ONE" (pun intended)
> >>
> >> Why on earth would you want only ONE way to do something in a
> >> language?!??!
> >
> >Maintainability.
> >
> >Unfortunately, because of Perl's expressive power, code that may seem
> >elegant to an implementor, can look like serial line noise to you the
> >maintainer. This is why one Unix luminary has called Perl a
> >write-only language.
> >
>
> This isn't a language problem, it is a programmer problem. You can
> write ugly, unmaintainable code in *any* language. Sure regular
> expressions are hard to follow sometimes, but the same functionality
> in other languages would take more code and wouldn't be much easier to
> read.
>
> >We as programmers don't tend to think about maintainability, perhaps
> >because it's boring and we'd prefer someone else did it. But it's not
> >unusual for a project to require more effort for maintenance than was
> >necessary for implementation.
> >
> Exactly! Too many programmers don't think about maintainability
> when they write their code. Lack of comments, too, is a problem.
>
> >In what ways can we as Perl programmers make our code more
> >maintainable? Always 'use strict' and follow 'man perlstyle'.
> >
> Basic things from Programming 101: use meaningful variable names,
> don't cram everything onto one line, indent properly, use whitespace,
> give your functions/modules meaningful comment headers.
>
> I have found that if I don't follow these guidelines that I even
> have trouble figuring out my own code if I haven't looked at it
> for several months. :-)
>
> Anita
Hear Hear!
-Sneex- :]
______________________________________________________________________
Bill Jones | 904/632-3089 | http://www.fccj.org/cgi/mail?webmaster
(Contrary to the general lack of support within 'Open Source' coding -
I support what I write... Others haven't, can't, or won't...)
------------------------------
Date: Tue, 10 Nov 1998 18:06:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: perl5 and oracle
Message-Id: <comdog-ya02408000R1011981806240001@news.panix.com>
In article <36484E59.B849F87C@home.net>, Alan Melton <arm@home.net> posted:
> Is there any program update to oraperl
> or other upgrade to perl to have access
> to an oracle database, either WinNT or Unix.
see the DBI module at CPAN <URL:http://www.perl.com/CPAN/>.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 10 Nov 1998 22:30:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Problems With a CGI Script
Message-Id: <Pine.GSO.4.02A.9811101429460.7469-100000@user2.teleport.com>
On 10 Nov 1998, Slidespy wrote:
> I still get that annoying 500 error.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Nov 1998 23:06:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: pwd without backticks?
Message-Id: <72agtt$adl$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@fastengines.com>],
who wrote in article <sarlnlj9qqw.fsf@camel.fastserv.com>:
> IZ> AFAIU, on many systems you cannot find cwd without being a superuser
> IZ> :-(. Thus on many systems pwd() *will* fork and do `cwd`, which is
^^^
pwd
> IZ> suid. Same with Cwd::cwd().
>
> which systems are those? on most/all unix flavors getwd is a plain
> library call that any user can run.
Right. This is why 'pwd' must be suid.
> Cwd::cwd just calls that
Nope, since it is not XSUB. But indeed in the latest Perl Cwd::cwd
does not call `pwd` any more. Do not know when this had changed.
> in most cases so you save the fork. if a system does restrict pwd to
> root (why?)
Since some directories up above can be unreadable (as you wrote in
your message yourself).
Ilya
------------------------------
Date: 10 Nov 1998 18:22:28 -0500
From: Uri Guttman <uri@fastengines.com>
To: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: pwd without backticks?
Message-Id: <sar7lx39lqj.fsf@camel.fastserv.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
IZ> [A complimentary Cc of this posting was sent to Uri Guttman
IZ> <uri@fastengines.com>],
IZ> who wrote in article <sarlnlj9qqw.fsf@camel.fastserv.com>:
IZ> Right. This is why 'pwd' must be suid.
wrong. if you got into below strange dir which has only execute perms,
you should know where you are. as i said on solaris, pwd is not suid.
IZ> Nope, since it is not XSUB. But indeed in the latest Perl Cwd::cwd
IZ> does not call `pwd` any more. Do not know when this had changed.
using my algorithm it does not need to be xsub. it would be easy to do
it in perl. xsub may be faster but you have to manage buffers, etc. the
library call getwd requires a buffer of MAXPATHLEN. getcwd requires a
buffer longer than the path you will get back. perl is easier than
those 2 in handling strings of unknown length. the stat and opendir
calls are mostly what you need.
>> in most cases so you save the fork. if a system does restrict pwd to
>> root (why?)
IZ> Since some directories up above can be unreadable (as you wrote in
IZ> your message yourself).
that is the program's fault. how did you get there to begin with unless
some parent with permission cd'd there and forked you off. or someone
changed perms on a parent dir after you got there. if you need a pwd
with suid, you can hack one yourself (in perl!). so the Cwd:: stuff is
fine as it is. if you need more, then you have to fork and you should
know how to do that on your own. the module is for basic use and should
work fine in most real world situations.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 10 Nov 1998 17:59:43 -0500
From: Bill Jones <bill@fccj.org>
Subject: Re: select case?
Message-Id: <3648C55F.E013290C@fccj.org>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, Hendrik Woerdehoff <hendrik.woerdehoff@sdm.de> writes:
> :You mustn't use "must" in your statement. The blue camel shows seven (7)
> :different ways to solve this problem. You _can_ use "if ()", but then
> :there is always more than one way to do it...
>
> Here are twenty-two or so:
>
> http://language.perl.com/misc/fmswitch
>
> --tom
> --
> If I don't document something, it's usually either for a good reason,
> or a bad reason. In this case it's a good reason. :-)
> --Larry Wall in <1992Jan17.005405.16806@netlabs.com>
Hmmmm, 22/7 = pi ?
-Sneex- :]
______________________________________________________________________
Bill Jones | 904/632-3089 | http://www.fccj.org/cgi/mail?webmaster
(Contrary to the general lack of support within 'Open Source' coding -
I support what I write... Others haven't, can't, or won't...)
------------------------------
Date: Tue, 10 Nov 1998 23:58:29 +0100
From: "HJB" <hjbraendle@gmx.net>
Subject: Strange permission behaviuor - what's wrong?
Message-Id: <dA322.199$q46.2228293@news.randori.com>
Hi all,
I have a littel problem with one of my perl scripts and maybe someone here
can help me.
I run the name1.cgi from my cgi-bin directory (permission is 755).
This script creates a new file in a other directory. This directory has
permission 777.
So what I expect is, that the new file also has 777 permission.
But instead it has now 644 and is now only accessable by the owner, which is
in this case "nobody" and it works to modify this file by the next user
called also "nobody" by my server. But although it works I cannot understand
why I get no fileoutput with the permission of the directory I created it
in.
Hope someone can help a stupid me :-)
regards
--
Hans-Juergen
------------------------------
Date: Tue, 10 Nov 1998 18:16:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Strange permission behaviuor - what's wrong?
Message-Id: <comdog-ya02408000R1011981816370001@news.panix.com>
In article <dA322.199$q46.2228293@news.randori.com>, "HJB" <hjbraendle@gmx.net> posted:
> I run the name1.cgi from my cgi-bin directory (permission is 755).
> This script creates a new file in a other directory. This directory has
> permission 777.
danger will robinson!
> So what I expect is, that the new file also has 777 permission.
> But instead it has now 644 and is now only accessable by the owner, which is
> in this case "nobody" and it works to modify this file by the next user
> called also "nobody" by my server. But although it works I cannot understand
> why I get no fileoutput with the permission of the directory I created it
> in.
it's not the directory permissions that determine the permissions of
new files, it's the umask setting.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
umask tells you what you *don't* get
------------------------------
Date: 10 Nov 1998 23:11:37 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: Strange permission behaviuor - what's wrong?
Message-Id: <72ah79$lff$1@news.cyberhighway.net>
[Posted and mailed]
In article <dA322.199$q46.2228293@news.randori.com>,
"HJB" <hjbraendle@gmx.net> writes:
> I run the name1.cgi from my cgi-bin directory (permission is 755).
> This script creates a new file in a other directory. This directory has
> permission 777.
> So what I expect is, that the new file also has 777 permission.
> But instead it has now 644 and is now only accessable by the owner, which is
> in this case "nobody" and it works to modify this file by the next user
> called also "nobody" by my server. But although it works I cannot understand
> why I get no fileoutput with the permission of the directory I created it
> in.
Default permissions are determined by the umask of the user running
the script. They have nothing to do with the permissions of any underlying
directories.
The first thing you need to do is think about who actually needs write
access to this directory. If the directory's permissions are 0777, then
anyone can do anything to it, including deleting it. Consider changing them
to something a little more secure. Perhaps chown'ing that directory to
the userid of your web server? Then, decide why you need the files to
be mode 0777. If they are only to be accessed by one specific user, then
mode 0600 would probably be sufficient.
After you've figured out what permissions the files really need,
perldoc -f chmod will help you with getting them that way.
--
Erik Nielsen, Cyberhighway Internet Services NOC
That's a valid argument. I just don't think it's valid enough. :-)
-- Larry Wall in <199804150050.RAA08093@wall.org>
------------------------------
Date: Tue, 10 Nov 1998 18:14:40 -0500
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Win32::Process -- Inheriting IO::Socket Handles
Message-Id: <3648C8DF.FCD02A2F@mail.tju.edu>
I've created a TCP server using the IO::Socket documentation in the
Perl IPC faq. It works like a charm, but is currently single-threaded.
I want to try using Win32::Process to kick off a separate process for
each connection (kind of like the Unix fork). Here's an outline of what
I'm doing:
1. Wait in while loop for client connections. Works fine.
2. Accept a $client_handle connection handle. Works fine.
3. Use 'select $client_handle' to select that handle as my default. No
error returned, so assuming that's OK.
4. Go to a subroutine that kicks off a Win32::Process object,
specifying that the handles of calling process are inherited (see below
for a sample). The process runs, but I/O continues to happen in the
server window only, via printing to the console screen.The called
process is actually a one-line Perl script that prints "Hello World". I
want that I/O to be sent to the calling client instead. Any thoughts
would be appreciated.
#--------------------------------------------------------------------------------------------------------------------------------------------------------
# Code for creating process object
Win32::Process::Create(
$ProcessObj, # object
to hold process
'D:\\perl\\bin\\perl.exe', #
executable
'perl.exe D:\\perl\\site\\scripts\\hello.pl', # command
line
1, # inherit
handles = true
NORMAL_PRIORITY_CLASS,
".") || die "Couldn't create process!!\n"; # working
directory
#--------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------
Date: Tue, 10 Nov 1998 21:45:13 GMT
From: dimard@my-dejanews.com
Subject: Win32::Shell
Message-Id: <72ac59$6m2$1@nnrp1.dejanews.com>
Does anybody know where the Win32::Shell module can be downloaded from?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 18:17:54 -0500
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Re: Win32::Shell
Message-Id: <3648C9A2.35B26DD1@mail.tju.edu>
dimard@my-dejanews.com wrote:
> Does anybody know where the Win32::Shell module can be downloaded from?
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
If you are using the latest Activestate release, just run
d:\perl\bin\ppm.pl.
------------------------------
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 4193
**************************************