[12264] in Perl-Users-Digest
Perl-Users Digest, Issue: 5864 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 2 18:07:19 1999
Date: Wed, 2 Jun 99 15:00:25 -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 Wed, 2 Jun 1999 Volume: 8 Number: 5864
Today's topics:
[ANNOUNCE] Source Code Project <bill@fccj.org>
Re: A new module: Naming, etc ?? <cassell@mail.cor.epa.gov>
Re: bareface ratio <mtimmerm@microstar.nospam-remove.com>
Broken Pipe - nit picking <cantrela@agcs.com>
Can not display inputted data on form (Brian Browning)
Dup STDERR and locking (Bill Moseley)
Re: Geting lost in $@% jungle <aqumsieh@matrox.com>
Re: How to list all installed modules <gellyfish@gellyfish.com>
Re: I pass an array to a subroutine, but that array is <upsetter@ziplink.net>
Re: I pass an array to a subroutine, but that array is (Greg Bacon)
Re: Loading modules at run time <rootbeer@redcat.com>
Re: micros~1 perl <gellyfish@gellyfish.com>
multi-dimensional arrays <dana@nowhere.com>
Re: multi-dimensional arrays (Greg Bacon)
NEED SCRIPTS (HUY4HUY)
Re: open FILE,$path || open FILE,$altpath; (brian d foy)
PERL FOR NT (sam@cheapnet.co.uk)
Perl module for saving/clearing WinNT Event Log? <chris_reichert@hp.com>
Re: Perl module for saving/clearing WinNT Event Log? <cassell@mail.cor.epa.gov>
Re: Post Method <rootbeer@redcat.com>
Question about $. variable <bdoyle@objectivity.com>
Re: Question about $. variable <rootbeer@redcat.com>
Re: Removing blank lines... <rootbeer@redcat.com>
Re: Running a Background Process from CGI <rootbeer@redcat.com>
Re: scalar question: how can you tell the difference be <aqumsieh@matrox.com>
Re: searching HTML files <rootbeer@redcat.com>
Sockets: perl and C <caa@strata-group.com>
Re: String extraction problem - please help? <cassell@mail.cor.epa.gov>
Re: Testing for cgi-bin weakness <rootbeer@redcat.com>
Re: Testing for cgi-bin weakness <gellyfish@gellyfish.com>
Re: unix newbie <aqumsieh@matrox.com>
Re: userid/password authentication on UNIX <rootbeer@redcat.com>
Re: Using DLL functions in Perl <perin@panix7.panix.com>
Using modules (or not) <kristina@greatbasin.net>
Re: Using modules (or not) (I R A Aggie)
Re: Webpage Spell Checker in Perl <rootbeer@redcat.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Jun 1999 15:58:59 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: [ANNOUNCE] Source Code Project
Message-Id: <37558cbc.0@usenet.fccj.cc.fl.us>
[Announce]
http://jacksonville.pm.org
A Perl Source Code Repository Project.
- The Jacksonville Perl Monger's
OpSys/SysAdmin/CGI/General Scripting
Project: Source Code Repository; a place
where you 'might' be able to find a script
generic enough to modify to your own ends...
This months featured script: 'List Home Pages' -
see http://jacksonville.pm.org/homepages.cgi
And no, this isn't another attempt at
documenting Perl, perl is well covered
in the standard distribution - so I
strongly suggest you read it before
posting to this group or e-mailing me.
Also, please NOTE, I am not a perl
expert, just another soul searching
for 'reasonably priced' solutions.
Notice I didn't say free. If you
want something for free, build it
yourself and give it away.
While requests for script writing are welcome,
only scripts which serve a useful purpose
will be considered and, as always, what I
write will by default, belong to me, unless
it is a work modified from someone else's
efforts - in which case, they are welcome to
whatever changes/enhancements the
Jacksonville Perl Mongers may make. :]
Also, there is mainly NO SUPPORT, except where
indicated. Support is given to those whose
efforts are going toward worth-while non-profit
pursuits - like ShadowMac, the mod_perl project,
the Apache project, perl itself, etc.
If you are working on a development project
for something like http://www.sourcexchange.com,
or another commercial venture then I expect
to be compensated as well.
I have donated some scripts I have personally
written and hope to have more available as
time permits. Credit for others work is
always given, so if you see something
in the archive you may have written and
I did not credit you for it, or if you
would prefer I didn't include it, please
e-mail me.
Thank you for your time in reading this,
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Jacksonville Perl Mongers
http://jacksonville.pm.org
jax@jacksonville.pm.org
Running LinuxPPC RedHat 5.0 (Hurricane)
__ _ http://www.linuxppc.org
/ /(_)_ __ _ ___ __ http://www.apache.org
/ / | | '_ \| | | \ \/ / http://www.redhat.com
/ /__| | | | | |_| |> < http://www.perl.com
\____/_|_| |_|\__,_/_/\_\ http://www.gimp.org
------------------------------
Date: Wed, 02 Jun 1999 14:14:40 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: A new module: Naming, etc ??
Message-Id: <37559EC0.94AE0D1C@mail.cor.epa.gov>
Trevor Phillips wrote:
>
> Hi! I'm taking my first steps into writing a Perl Module with the intent
> of publically distributing it via CPAN. As such, I'm after some tips on
> some issues, the biggie being what to call the smegger, and to see if
> anything similar has been done.
You might want to check in perlmodlib if you haven't already.
It has some helpful text on this subject. And CPAN itself has
plenty of helpful suggestions if you haven't found them yet.
But you probably already have, since you're writing a module.
Right?
> The module involves creating of form/record fields. Each field is an
> object, and contains a number of properties, including name, type,
> value, plus type-specific properties. There are then a number of methods
> for changing and accessing the field content, depending on what is
> required.
>
> The intent is to get a level of abstraction in CGI's for form elements,
> recognising that a field is different depending on whether you are
> concerned with the raw value, a text-readable value, a HTML-readable
> value, a HTML Form editable element, etc ...
>
> [snip]
>
> The main issue currently is what do I call it? I'm fairly certain I want
> to keep it as "Fields", but the directory to place it in I'm not sure
> yet. My first thought was HTML/Fields, as it is primarily for making
> HTML forms easier. However, it is concievable to be used in a context
> where HTML is not required at all, as there are a number of non-HTML
> ways of representing the fields.
Since you seem to be focusing on CGI applications, perhaps
you could call it CGI::Fields. Have you asked about this in
comp.lang.perl.modules ?
> So something fairly generic would be good, so maybe Data/Fields ?? What
> do people think??
Is there a general "Data::" category? I haven't found one on
CPAN.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 2 Jun 1999 17:31:33 -0400
From: "Matt Timmermans" <mtimmerm@microstar.nospam-remove.com>
Subject: Re: bareface ratio
Message-Id: <7j47rn$31j$1@news.igs.net>
Greg Bartels wrote in message <37543D13.109FD1C8@xli.com>...
>so, if you have a question, and no one
>is responding, you can still get the
>answer, all you have to do is make something
>up first (bareface it), and the
>corrections will flood in.
But this is blackmail.
I assume we're talking about corrections from those who know what they're
talking about, rather than people who just like to flame -- otherwise your
suggestion is pointless, yes?
These people often don't answer questions, for a variety of good reasons
(see 160 line dissertation posted previously).
The same people _will_ correct errors, however, because allowing the mass of
usenet readers to be misinformed is a far greater negligence (3 times
worse?) than allowing an original poster to go unanswered. Someone
following your suggestion essentially says "someone better correct me, or
the rest of these readers will suffer too!" [waves gun, jumps up and down,
stares at you eyebrow twitching, etc.].
I would also suggest that if you actually can phrase your question in the
form of an incorrect assertion, then you can probably phrase it the form of
a question that will get answered.
------------------------------
Date: Wed, 02 Jun 1999 14:15:06 -0700
From: Andy Cantrell <cantrela@agcs.com>
Subject: Broken Pipe - nit picking
Message-Id: <37559EDA.79932AC9@agcs.com>
Reading in data from a program that produces more output
than I need. I'm short cutting the output by the following:
open(FH, "alongprog |") or die "Can't run alongprog" ;
while (<FH>) {
last if /last line of output I need/o;
};
$rc = close(FH) ;
Most of the time FH closes with no problem. Every so often
I'm getting the message "Broken Pipe" and $rc returns with a
null. I tried adding the line:
@dont_care = <FH> ;
just prior to the close to suck up the remaining data. That
seems to quell the message, but should 'alongprog' run much
longer than what I need, I'll start wasting time. Is there a
better way to do this?
I'm partially nit-picking due to the program gets the information
it needs and runs ok. I'm looking to soothe the users and help
eliminate at least one finger print from their terminal screens.
Looked though the FAQ pages and did not find what I thought
I was looking for.
--
Andy Cantrell - cantrela@agcs.com
AG Communication Systems
Office (AZ) (602) 582-7495 (Voice mail)
Office (WI) (414) 249-0215
Modem (WI) (414) 249-0239
------------------------------
Date: Wed, 02 Jun 1999 21:51:32 GMT
From: bbrowning@northpolemedia.com (Brian Browning)
Subject: Can not display inputted data on form
Message-Id: <EHh53.42831$75.30121@news.rdc1.ab.wave.home.com>
If my subject line doesn't confuse everyone, my question certainly will.
I have a script comprising of 3 major parts:
1)A form to input data
2)A form to retrieve data, using user picked criteria
3)A form to display and allow modification of inputted data.
My problem is this:
a) I am using drop down menus and text fields on my data input form. This
part works fine.
b) I am using the same drop down menus on my search form. This also seems to
work great.
c)The problem is, when I go to my modify form, none of my data from the drop
down menus is appearing on my form.
Here is the code I am using: (and that I am having problems with) The original
input drop down menu gave the choice of Male or Female.
print "<TR><TD><strong>TYPE:</strong></TD><TD><SELECT NAME=\"type\"><OPTION
value=\"Female\">Female</OPTION><OPTION
value=\"Male\">Male</OPTION></SELECT></TD></TR>\n";
The following is the code I use for the text fields. This information is
appearing as it should be.
print "<TR><TD><strong>Product Name:</strong></TD><TD><INPUT
TYPE=\"text\" NAME=\"address\" value=\"$address\" size=40></TD></TR>\n";
I know that for the text fields, I needed to add: value=\$field name\"
Am I missing something on the drop down menus?
Thanks for any help you can throw my way.
Brian Browning
bbrowning@home.com
passme
------------------------------
Date: Wed, 2 Jun 1999 14:08:18 -0700
From: moseley@best.com (Bill Moseley)
Subject: Dup STDERR and locking
Message-Id: <MPG.11bf3d1e2484e00298973d@206.184.139.132>
[reposted]
I have a program that opens a log file. This file is also used as a lock
file. Say its filehandle is 'LOG'.
Want STDERR to go to this log file, too, so I dup STDERR
open( STDERR, ">&LOG" ) or doesomethingugly();
This is done right after I sucessfully open() and right before I flock()
LOG.
My Question:
Is there any reason why I shouldn't just open my log file with STDERR as
the filehandle (and then make all my writes to the logfile write to
STDERR)?
The only problem I can think of is what if the something happens during
the flock() that writes to STDERR (and thus to my log file) when I don't
know that I have exclusive use of the log file yet.
BTW - it's running as a CGI script, so STDERR to begin with is written to
the server log file.
Any comments?
Thanks,
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Wed, 2 Jun 1999 15:31:59 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Geting lost in $@% jungle
Message-Id: <x3y7lpm4cwg.fsf@tigre.matrox.com>
Pavel Hlavnicka <pavel@asei.cz> writes:
> my script works fine, but I'd like to omit the $arrayref variable:
>
> $result{$hoo} = [100, []];
> #some code here
> $arrayref = $result{$hoo}[1];
> @$arrayref = @path;
>
> Could you help me?
Ummm .. is it too hard to come up with:
@{$result{$hoo}[1]} = @path;
??
Ala
------------------------------
Date: 2 Jun 1999 21:53:55 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to list all installed modules
Message-Id: <7j495j$rv$1@gellyfish.btinternet.com>
On Tue, 1 Jun 1999 21:56:10 -0500 Jasmine wrote:
> Hello,
>
> Is there a way to determine all of the modules that are installed on my
> hosts installation of perl?
>
Just in case you had in mind trying to determine what modules where
installed on a server to which you have no telnet acccess - here is
one I prepared earlier -
#!/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";
}
Yeah its crap but it worked last time I checked ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 02 Jun 1999 21:24:00 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <Qhh53.1674$nn.498301@news.shore.net>
Larry Rosler <lr@hpl.hp.com> wrote:
: foo(\@di);
: Then inside the function,
: my @bar = @{+shift};
: +shift could be written shift() if you prefer. Just the bareword shift
: won't work.
I usually write this as my @bar = @{ shift @_ };
It's less ambiguous that way if someone who only knows a little perl has
to maintain my code.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 2 Jun 1999 21:48:02 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <7j48qi$nim$1@info2.uah.edu>
In article <Qhh53.1674$nn.498301@news.shore.net>,
Scratchie <upsetter@ziplink.net> writes:
: It's less ambiguous that way if someone who only knows a little perl has
: to maintain my code.
Down this path lies madness.
Greg
--
Democracy: Two wolves and a sheep voting on what's for dinner.
------------------------------
Date: Wed, 2 Jun 1999 12:13:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Loading modules at run time
Message-Id: <Pine.GSO.4.02A.9906021212330.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Jan van Rensburg wrote:
> is there any way to load modules at run time?
Sure; just "roll your own" use directive. See the entry on use in
perlfunc. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 2 Jun 1999 20:05:59 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: micros~1 perl
Message-Id: <7j42r7$qg$1@gellyfish.btinternet.com>
On 02 Jun 1999 11:54:23 -0600 Daniel Grisinger wrote:
> lr@hpl.hp.com (Larry Rosler) writes:
>
>> In article <3755548a@cs.colorado.edu> on 2 Jun 1999 09:58:02 -0700, Tom
>> Christiansen <tchrist@mox.perl.com> says...
>>
>> In article <m3lne2hcmx.fsf@moiraine.dimensional.com> on 02 Jun 1999
>> 08:59:18 -0600, Daniel Grisinger <dgris@moiraine.dimensional.com>
>> says...
>>
>> > :[subject line intentionally munged to avoid my killfile :-)]
>> >
>> > And mine. :-)
>>
>> Keep your heads buried, guys! The problems will go away if you ignore
>> them.
>
> It's nice to know that my strategy will work. :-)
>
>> Now I know how to slip stuff past you into this newsgroup. :-)
>
> Nope, it won't work. Here's the relevant excerpt from
> my killfile-
>
> (("subject"
> ("\\b[Nn][Tt]\\b" -10000 nil R)
> ("^.*[wW][iI][nN]\\s-*\\(32\\|9[58x]?\\|[nN][tT]\\)" -10000 nil R)
> ("\\s-+m\\(icrosoft\\|s\\)\\s-+" -10000 nil r)
> ("from"
> ("lr@hpl" 15000 nil s))
>
> Anything from you gets marked up far enough that it cancels
> out the effect of any undesired terms in the subject. :-)
>
He he, Anyone who wants can have an alias @gellyfish.com - if they gotta
discuss this stuff openly ;-}
Not really I dont think I could afford the phone bill.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Thu, 03 Jun 1999 04:38:10 -0400
From: dana <dana@nowhere.com>
Subject: multi-dimensional arrays
Message-Id: <37563EF2.DD6B2E17@nowhere.com>
Okay, so how do we do this with perl? I haven't quite gotten the hang
of KEYS so I am hoping that this isn't the direction that I have to go.
My problem is basically that I have an undetermined number of text
variables with a number associated with each text variable. For
example,
text0 = 22
text1 = 34
text2 = 38
text3 = 21
text4 = 98
text5 = 42
.
.
and so on . . .
How do I store this info in an array (or something similar)? I will
never know what "textX" will be and I will never know how many I will
have. Any help on this topic would be greatly appreciated.
Thanks!
Diana
------------------------------
Date: 2 Jun 1999 21:53:31 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: multi-dimensional arrays
Message-Id: <7j494r$nim$2@info2.uah.edu>
In article <37563EF2.DD6B2E17@nowhere.com>,
dana <dana@nowhere.com> writes:
: Okay, so how do we do this with perl? I haven't quite gotten the hang
: of KEYS so I am hoping that this isn't the direction that I have to go.
: My problem is basically that I have an undetermined number of text
: variables with a number associated with each text variable. For
: example,
:
: text0 = 22
: text1 = 34
: text2 = 38
: text3 = 21
: text4 = 98
: text5 = 42
: .
: .
: and so on . . .
Here's a simple version:
my @text;
while (<>) {
chomp;
next unless /^text(\d+)\s*=\s*(\d+)/;
$text[$1] = $2;
}
I say simple because if you have a repeated item (say, two text0 items),
you'll lose the previous.
: How do I store this info in an array (or something similar)? I will
: never know what "textX" will be and I will never know how many I will
: have. Any help on this topic would be greatly appreciated.
Here's a slightly more advanced version:
my @text;
while (<>) {
chomp;
next unless /^text(\d+)\s*=\s*(\d+)/;
push @{ $text[$1] }, $2;
}
If you had input like
text0 = 22
text0 = 42
then $text[0] would be a reference to an array containing 22 and 42.
I'm just glad you don't want to use text0 et alia as variable names. :-)
Hope this helps,
Greg
--
Be warned that being an expert is more than understanding how a system is
supposed to work. Expertise is gained by investigating why a system doesn't
work.
-- Brian Redman
------------------------------
Date: 2 Jun 1999 19:11:30 GMT
From: huy4huy@cs.com (HUY4HUY)
Subject: NEED SCRIPTS
Message-Id: <19990602151130.17883.00000125@ng-cf1.news.cs.com>
I need a program that would automate an age verification system, I need the
script to handle all aspects.
It should have easy sign up for webmasters and surfers, anti cheater devices as
well as the real time monitoring of all system activities, email notification
to the webmaster joining to the admin, logs all traffic trough the system and
gathers email addresses, built in password protection for admin area, no SSL's,
no htaccess...this is an example of the format I need. I will appreciate it,
if anyone can help me out......thanks
------------------------------------------------------------------------
Mark Davidson inert28@hotmail.com
please inform with the information to the email address above, thanks.
------------------------------
Date: Wed, 02 Jun 1999 17:15:13 -0400
From: brian@pm.org (brian d foy)
Subject: Re: open FILE,$path || open FILE,$altpath;
Message-Id: <brian-ya02408000R0206991715130001@news.panix.com>
In article <2.07b3.YVVZ.FCPIVD@eximb.kiev.ua>, bakulin@eximb.kiev.ua posted:
> In <37539A39.F90800DA@siemens.at> Wolfgang Gtzinger (wolfgang.goetzinger@siemens.at) wrote:
> i tried the following code:
> open FILE,$path || open FILE,$altpath;
there is a problem with operator precedence. you want
open(FILE, $path) || open(FILE, $altpath) || die "$!";
==OR==
open FILE, $path or open FILE, $altpath or die "$!";
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Wed, 02 Jun 1999 21:18:55 GMT
From: sam@cheapnet.co.uk (sam@cheapnet.co.uk)
Subject: PERL FOR NT
Message-Id: <37559f9e.15174988@news.cheapnet.co.uk>
I need some sample scripts for Perl with NT
I want to create user accounts etc
------------------------------
Date: Wed, 2 Jun 1999 12:47:06 -0600
From: "Chris Reichert" <chris_reichert@hp.com>
Subject: Perl module for saving/clearing WinNT Event Log?
Message-Id: <7j3u7l$5ma2@hpbs1500.boi.hp.com>
Hello all,
Does anyone know of a module that provides NT Event Log functionality beyond
that in the stock Win32::EventLog module? I am looking for the functions to
save and clear a log.
Regards,
Chris Reichert
Hewlett - Packard Company
chris_reichert@hp.com
------------------------------
Date: Wed, 02 Jun 1999 14:44:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Chris Reichert <chris_reichert@hp.com>
Subject: Re: Perl module for saving/clearing WinNT Event Log?
Message-Id: <3755A5D5.57665465@mail.cor.epa.gov>
[courtesy cc to poster]
Chris Reichert wrote:
>
> Hello all,
>
> Does anyone know of a module that provides NT Event Log functionality beyond
> that in the stock Win32::EventLog module? I am looking for the functions to
> save and clear a log.
I don't know of one, but that doesn't mean there isn't a
good one out there. Have you checked Dave Roth's webpage?
Or Jenda Krynicky's? They both have Perl module that you
can download using ppm, but I don't know if either has
specifically what you seek. And if you don't get a better
answer than this one, you may want to check out the
win32-perl-users listserv, to which you can subscribe by
going to
http://www.activestate.com/support/mailing_lists.htm
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 2 Jun 1999 12:07:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Post Method
Message-Id: <Pine.GSO.4.02A.9906021205110.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Alex wrote:
[ Long description snipped ]
> As you saw above that system is good enought for Mozilla browsers but
> not for Geos.
It sounds as if you're having trouble with the protocol you're using. The
docs, FAQs, and newsgroups about the protocol should be able to help you.
If (on the other hand) you find that you know what to do but you can't
find it the docs how to accomplish it in Perl, please check back here.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 02 Jun 1999 12:18:14 -0700
From: Blade Doyle <bdoyle@objectivity.com>
Subject: Question about $. variable
Message-Id: <37558376.282CED5E@objectivity.com>
Hello Perl Gurus,
Running perl, version 5.003 with EMBED
under IRIX 6.4 (64bit on origin200) with fairly recent patch set.
Question:
is $. a read-only variable? I have a program that dumps core when it
tries to
set $. = 0;
Strange thing is that when run on a Solaris, AIX, HPUX, and even IRIX
6.5.3
system it does not dump core when the program attempts to set $. = 0;
Looking at the documentation for $. my guess is that $. can not be
explicitly
assigned a value. Is that correct? What is the correct way to reset $.
to
the beginning of the file?
Thanks.
-=BladE
--------
From: ftp://ftp.spu.edu/pub/CPAN/doc/manual/html/pod/perlvar.html
$.
The current input line number for the last file handle from which
you read (or performed a seek or tell on). An explicit close on a
filehandle resets the line number. Because ``<>'' never does an explicit
close, line numbers increase across ARGV files (but see examples under
eof()). Localizing $. has the effect of also localizing Perl's notion of
``the last read filehandle''. (Mnemonic: many programs use ``.'' to mean
the current line number.)
--
/*********************************************************************
Blade Doyle - Objectivity, Inc. | Ash nazg durbatul{k,
| ash nazg gimbatul,
E-Mail: bdoyle@objectivity.com | ash nazg thrakatul{k
Phone: 650.254.7100 | agh burzum-ishi krimpatul.
Fax: 650.254.7171 | --J.R.R. Tolkien
*********************************************************************/
------------------------------
Date: Wed, 2 Jun 1999 13:39:13 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Question about $. variable
Message-Id: <Pine.GSO.4.02A.9906021335241.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Blade Doyle wrote:
> Running perl, version 5.003
That's a version older than the Spice Girls. It's probably time to
replace it.
> is $. a read-only variable? I have a program that dumps core when it
> tries to set $. = 0;
It shouldn't dump core. If that still happens once you're using a recent
version, make a small test case and file a bug report with the perlbug
program.
> Looking at the documentation for $. my guess is that $. can not be
> explicitly assigned a value.
I'd say that the docs are a touch ambiguous. If it's not permitted, the
docs should be fixed to explicitly say so. If it is permitted, the docs
should be fixed to explicitly say so. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 2 Jun 1999 12:26:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Removing blank lines...
Message-Id: <Pine.GSO.4.02A.9906021222350.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Bill Moseley wrote:
> > print unless /^\s*$/;
> ^
> Why zero or more? __|
>
> isn't that the same as:
>
> print unless /^$/;
Not the same at all. Consider this line:
...which, invisibly to the naked eye, contains some whitespace characters.
With code such as the quoted, the computer can call that "blank" just as I
do.
> Wouldn't that be more work for the regexp engine than:
>
> print if /\S/;
use Benchmark; # :-)
> Seems like ^\s*$ would require it to think about every char of each
> string.
What does it seem that /\S/ would do? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 2 Jun 1999 12:38:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Running a Background Process from CGI
Message-Id: <Pine.GSO.4.02A.9906021229080.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Mark R. wrote:
> # fork process into child and parent.
> $pid = fork();
Be sure to check that the fork succeeded - they don't always!
> if ($pid == 0 ) {
> # child process -- run RS/1
> close STDIN;
> close STDOUT;
> #exec ("$rs1CallPre $rs1CallPost >> /tmp/.h.log &");
> system ("$rs1CallPre $rs1CallPost >> /tmp/.h.log &");
You probably want exec, without the ampersand, and checking for failure.
Maybe something like this:
unless (open STDERR, ">>/tmp/.h.log") {
# This is probably going to the server log or Tumbolia...
die "Couldn't redirect STDERR: $!";
}
exec $rs1CallPre, $rs1CallPost
or die "Couldn't exec: $!";
BTW, if you redirect STDERR from the start of your program (or even a
BEGIN block!), you may catch error messages that would otherwise become
lost in the server log or wherever. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 2 Jun 1999 15:34:13 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: scalar question: how can you tell the difference between numbers and strings?
Message-Id: <x3y67564csr.fsf@tigre.matrox.com>
"John Hilgedick" <jhilgedi@indiana.edu> writes:
> I can't find the answer to this question anywhere. Can you help?
You mean you looked in perlfaq2, and somehow managed to miss the
following FAQ:
How do I determine whether a scalar is a
number/whole/integer/float?
??
Ala
------------------------------
Date: Wed, 2 Jun 1999 12:21:27 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: searching HTML files
Message-Id: <Pine.GSO.4.02A.9906021220530.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Joe Laffey wrote:
> I'd like to be able to search for text in HTML files (ignoring tags).
So you'll want to parse the HTML. You'll find HTML::Parser on CPAN. Hope
this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 2 Jun 1999 15:16:58 -0500
From: "Charlene Abrams" <caa@strata-group.com>
Subject: Sockets: perl and C
Message-Id: <7j432k$6j4$1@newsin-1.starnet.net>
I've browsed the FAQs and all the linked sites, and I can't find what I
need, so I'm hoping someone here can help me.
I have an application written in C, a message server and a bunch of clients,
which work well. The trouble I'm having is with a perl client.
I'm using tcp sockets to communicate, and my perl code more or less mimics
the C code, inasmuch as the slightly different perl functions will permit
this. The C server is quite happy with the interface, but the perl client
isn't receiving quite correctly.
This is what is supposed to happen:
- server starts itself up, waits for a client
- client starts up, sends a connect
- server accepts the connection, sends back the string "ok"
- client reads "ok"
- client sends its message to the server
- server reads and processes the message
- server sends back "ok"
- client reads "ok"
- client sends "bye"
- server reads "bye"
- server sends back "ok"
- server closes the channel and goes back into waiting mode
- client reads "ok"
- client closes the stream and exits
The beginning connect/"ok" sequence is fine, and then the client sends its
message which the server reads and processes, and sends back an "ok". This
is where the problem is. If I use select() and recv() for the client read,
the select() succeeds, but the recv() times out. If I use select() and
read(), it doesn't time out, but the input string is a bit off: it's " o"
blank plus lower case o). Then after the "bye", the string the client reads
is "k " (lower case k plus blank), again instead of "ok".
The C client doesn't do this at all!
If anyone has any insight as to what I may have missed, what I should have
changed from C to perl (besides the obvious - this program is working, if
not correctly), what special considerations I haven't considered - anything,
in short, that would help me solve my problem, I'd be very grateful. It
feels as though I have a conceptual gap, which is causing this problem.
Charlene Abrams
Strata Group
Earth City, Missouri
mailto:caa@strata-group.com
------------------------------
Date: Wed, 02 Jun 1999 14:28:24 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: String extraction problem - please help?
Message-Id: <3755A1F8.49F71ABB@mail.cor.epa.gov>
Larry Rosler wrote:
>
> In article <u96756wp0e.fsf@wcl-l.bham.ac.uk> on 02 Jun 1999 17:22:57
> +0100, Brian McCauley <B.A.McCauley@bham.ac.uk> says...
> > Andrew Collington <webmaster@avert.org> writes:
> ...
> > > I know it would be something like 'if ($line =~
> > > /(something)archive(something)/)' to extract the require strings, but I
> > > just don't know regular expression enough (at all!) to do that. Though
> > > I know you would use $1, $2, etc as the strings matched, but.. well, you
> > > get my problem... :)
> >
> > Your problem is inability to read man pages.
>
> I doubt that anyone could readily learn about regular expressions from
> the perlre man page. There are several expressly tutorial man pages,
> but none on regular expressions and their use.
>
> Does anyone know of a good on-line tutorial on regular expressions to
> which we can refer people in the future?
You might recommend this:
http://www.netcat.co.uk/rob/perl/win32perltut.html
which, despite its name, is not really win32-centric. There
is a regex section, which despite the author's claim that it
is not complete, has more in it than I expected to find.
It starts out with total newbieness and leads the reader through
the basics, at least to the point after which someone ought
to be able to read perlre. He gets as far as issues such as
the difference between s/// and s///e and s///ee with a
working example, and covers some of the key points where
beginning regexers often fall and scrape their knees.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 2 Jun 1999 13:11:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Testing for cgi-bin weakness
Message-Id: <Pine.GSO.4.02A.9906021258470.3912-100000@user2.teleport.com>
On 2 Jun 1999, Danny Aldham wrote:
> I have been contracted to find possible security problems in a server
> running Perl cgi scripts. I would like to use LWP to toggle thru all
> of their links, but am not sure how to test the scripts. If I just add
> say a semicolon and then an ls command, will this give me enough to
> tell if my customer is vulerable. Are there other escapes beside shell
> escapes I should or can test for.
There is no way to be 100% certain that programs don't have security
holes. But the best way (by far) to search out such holes is to examine
the source code closely. You'd be at a big disadvantage merely poking at
the behavior of the programs without seeing the source - and you might
accidentally cause some harm to the system, if you found a vulnerability
that caused, say, an infinite fork or some such.
Of course, there are an infinite number of possible bugs which can cause
security problems, but if I were checking programs written in Perl, I'd be
looking especially for these "big three" kinds of mistakes.
1. Failing to use Perl's wonderful taint checking, or failing
to use it properly.
2. Failing to use 'use strict' and warnings.
3. Failing to write clear, standard, well-commented code that
is easy to maintain and debug. (This includes failing to use
standard, well-debugged modules.)
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 2 Jun 1999 21:33:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Testing for cgi-bin weakness
Message-Id: <7j47vh$re$1@gellyfish.btinternet.com>
On 2 Jun 1999 18:30:56 GMT Danny Aldham wrote:
> X-Newsreader: TIN [version 1.2 PL2]
>
> I have been contracted to find possible security problems in a server
> running Perl cgi scripts. I would like to use LWP to toggle thru all
> of their links, but am not sure how to test the scripts. If I just add
> say a semicolon and then an ls command, will this give me enough to
> tell if my customer is vulerable. Are there other escapes beside shell
> escapes I should or can test for.
I would look at the CGI security FAQ which is referenced in the second
item of perlfaq9.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 2 Jun 1999 15:36:51 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: unix newbie
Message-Id: <x3y4skq4coc.fsf@tigre.matrox.com>
"Holger Kasten" <hkasten@abm-soft.de> writes:
> ist there a special way to see hidden files (i dont see all .ht... files,
> but i know they exist)
1) man ls
2) go look for a good book on unix programming before you venture any
further.
------------------------------
Date: Wed, 2 Jun 1999 12:56:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: userid/password authentication on UNIX
Message-Id: <Pine.GSO.4.02A.9906021252340.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Yi Wang wrote:
> 1. how to pass parameters to a perl program from the
> command line, like this?
> perl myProgram.perl par1 par2
See the entry on @ARGV in the perlvar manpage, and possibly also the
perlrun manpage.
> 2. how to directly capture a return value of a program within the perl
> script (etc. keep it in a variable), I know by using system function,
> we can run a system program.
>
> @args = ("myProgram", "arg1", "arg2");
> system(@args)
>
> But how to assign its return value to a variable, can we use "$?"
Yes, but see also the description of $? in the perlvar manpage, and the
entry on system in perlfunc. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 02 Jun 1999 15:12:24 -0400
From: Lewis Perin <perin@panix7.panix.com>
Subject: Re: Using DLL functions in Perl
Message-Id: <pc77lpm2z8n.fsf@panix7.panix.com>
"Vincent Vanbiervliet" <vincent_vanbiervliet@be.ibm.com> writes:
> How can I call a DLL function in Perl?
> I don't have any source code from the dll (it's an encryption/decryption
> algorithm that has to stay secret, even from me :-( ), but
> I know the arguments to pass to the function.
> I'm using a Win32 platform.
>
> Any suggestions?
Aldo Calpini's Win32:API will do this. Be sure you read the
documentation extremely carefully and don't even think of using it if
you aren't comfortable with pack/unpack. Another caveat which I hope
is no longer true is that the release I use comes with a finite number
of DLLs built from C each of which requires a specific release of
Perl; there's no source for the DLLs, so you're cooked if you need the
wrong Perl release.
Cheers, Lew
------------------------------
Date: Wed, 2 Jun 1999 12:24:38 -0700
From: Kristina <kristina@greatbasin.net>
Subject: Using modules (or not)
Message-Id: <Pine.BSI.4.05L.9906021201290.19106-100000@web0.greatbasin.net>
On Wed, 2 Jun 1999, I.J. Garlick wrote:
[snip]
> that, it's much easier. Even if you don't want to use it (there are
> strange people who wont use modules !!!!)
[snip]
Actually, there are several reasons why people would not want to
use modules. One, the person wants to learn to do it himself from
scratch. Heck, hasn't anyone taken a C course where the prof made
you write things *without* using string.h or made you write your own
string.h or other such so that you would learn how to do it? Some of us
actually enjoy reinventing the wheel for fun. :)
Two, sometimes the modules are not available on the system, the system
administrator will not install them, and the user does not have sufficient
disk space to install the modules they need or she has *only* ftp access
to her account. Very difficult to run the module install without
telnet/ssh access. In situations like these, you can sometimes just write
the function you need with 10 - 20 lines of Perl code, and the script can
then run whether you have modules or not. (And yes, I've read about how to
install your own modules using PREFIX when generating the Makefile, and
then setting the PERLLIB and PERL5LIB env variables. I've even done it.
There are just times when using modules is not feasible, no matter how
desirable it may be.)
Three, there are a ton of Perl 4 installations out there and many broken
Perl 5 installations. These especially exist on university systems and
are difficult to get fixed, upgraded, etc. Some people are still writing
for Perl 4 because of this, or at least, writing for portability to
systems that won't have the modules necessary for one reason or another.
While we all know that Perl 4 installations should be upgraded, and broken
Perl 5 installations should be fixed the sad truth is that they just won't
be in a lot of places.
Just my 2 cents on the modules thing...
Kristina
------------------------------
Date: 2 Jun 1999 20:13:26 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Using modules (or not)
Message-Id: <slrn7lb49g.1f0.fl_aggie@thepentagon.com>
On Wed, 2 Jun 1999 12:24:38 -0700, Kristina <kristina@greatbasin.net>, in
<Pine.BSI.4.05L.9906021201290.19106-100000@web0.greatbasin.net> wrote:
+ While we all know that Perl 4 installations should be upgraded, and broken
+ Perl 5 installations should be fixed the sad truth is that they just won't
+ be in a lot of places.
A Perl 4 installation can be upgraded quite quickly...just let it be
known that there are no plans to certify Perl 4 as Y2K complaint...if
that doesn't get the PHB hoping, he's dead.
James
------------------------------
Date: Wed, 2 Jun 1999 12:19:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Webpage Spell Checker in Perl
Message-Id: <Pine.GSO.4.02A.9906021219120.3912-100000@user2.teleport.com>
On Wed, 2 Jun 1999, Matt Turner wrote:
> Does anyone know of a spell check cgi script written in Perl that
> would allow a person to enter a url and get the webpage spell checked?
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 5864
**************************************