[15859] in Perl-Users-Digest
Perl-Users Digest, Issue: 3272 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 7 00:05:27 2000
Date: Tue, 6 Jun 2000 21:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960350709-v9-i3272@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Jun 2000 Volume: 9 Number: 3272
Today's topics:
AnyDBM_File w/ GDBM and dbmopen nkaiser@my-deja.com
Re: AnyDBM_File w/ GDBM and dbmopen nkaiser@my-deja.com
Aol coockie: date error <thetrader@worldnet.att.net>
Re: Detecting multiple instances under Win32 (Clinton A. Pierce)
Dynamic IP <eg344@nyu.edu>
Re: each not looping on a hash <bwalton@rochester.rr.com>
Re: each not looping on a hash <you.will.always.find.him.in.the.kitchen@parties>
Re: each not looping on a hash <you.will.always.find.him.in.the.kitchen@parties>
Re: each not looping on a hash <tina@streetmail.com>
Re: Fill In With Spaces Command purl_gurl@my-deja.com
Re: Fill In With Spaces Command (Eric Bohlman)
Re: good perl coding style (Tad McClellan)
Help with OO needed. (James Kufrovich)
Re: how to write on a file? (Tad McClellan)
Re: IO::Socket devices (Clinton A. Pierce)
IPC: capturing fd from c httpd, direct to socket cgi? advonet@my-deja.com
Need help with error msg pornpira@beta.tricity.wsu.edu
needs help w system interaction <toa@home.com>
Re: Perl 5.6 stable?? <dan@tuatha.sidhe.org>
PERL DBI module to connect to MS-Access databases? <EJuke@worldnet.att.net>
PERL DBI module to connect to MS-Access databases? <EJuke@worldnet.att.net>
Pseudo-hashes/OOP <danielf@unc.edu>
Re: Simple regexp question - Bug in Perl? (Eric Bohlman)
Win32 Perl read weirdness <jamesm@ee.adfa.edu.au>
Re: Win32 Perl read weirdness (Clinton A. Pierce)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Jun 2000 01:49:39 GMT
From: nkaiser@my-deja.com
Subject: AnyDBM_File w/ GDBM and dbmopen
Message-Id: <8hk9ne$15b$1@nnrp1.deja.com>
I have been using the following code which successfully uses NDBM:
use AnyDBM_File;
@AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File ODBM_File SDBM_File);
dbmopen(%TEST,"test",0700);
dbmclose %TEST;
Due to file size limits, I need to use GDBM. I know GDMB is installed,
because a "use GDBM_File" does not fail and I can use that library, but
rather than rewriting all my code, I'd just like to do:
use AnyDBM_File;
@AnyDBM_File::ISA = qw(GDBM_File);
dbmopen(%TEST,"test",0700);
dbmclose %TEST;
When I do this, I get the following error:
"No dbm on this machine at test.pl..."
Any ideas what I'm missing?
Thanks....
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 02:58:25 GMT
From: nkaiser@my-deja.com
Subject: Re: AnyDBM_File w/ GDBM and dbmopen
Message-Id: <8hkdo9$41k$1@nnrp1.deja.com>
I hate doing this, but I have a partial answer to my question, and
another question:
I realized that dbmopen only lets you use the DBM library Perl was
built with. Now, I guess I woudl have to convert my dbmopen statements
to tie statements. My concern is that I don't know what hash files
will be available at deployment, so it must be "generic".
If the system is, say, DB_File:
tie %TEST,AnyDBM_File,"testhash",0700;
will work.
But if my hash is GDBM, it will give me an incorrect usage error.
How can I make it generic so it will work either way?
And also, how can you determine what hash type was actually used
(assuming you know nothing about the system you are on)
Thanks!
> I have been using the following code which successfully uses NDBM:
>
> use AnyDBM_File;
> @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File ODBM_File
SDBM_File);
> dbmopen(%TEST,"test",0700);
> dbmclose %TEST;
>
> Due to file size limits, I need to use GDBM. I know GDMB is
installed,
> because a "use GDBM_File" does not fail and I can use that library,
but
> rather than rewriting all my code, I'd just like to do:
>
> use AnyDBM_File;
> @AnyDBM_File::ISA = qw(GDBM_File);
> dbmopen(%TEST,"test",0700);
> dbmclose %TEST;
>
> When I do this, I get the following error:
>
> "No dbm on this machine at test.pl..."
>
> Any ideas what I'm missing?
>
> Thanks....
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 02:37:36 GMT
From: "Free Lance" <thetrader@worldnet.att.net>
Subject: Aol coockie: date error
Message-Id: <Qzi%4.646$ee3.31206@bgtnsc04-news.ops.worldnet.att.net>
Does anyone know about this issue?
My script successfully writes cookies with a one year expiration date
with AOL i get an error like :
date error: today's date + one year
Thank you for your help
------------------------------
Date: Wed, 07 Jun 2000 02:32:29 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Detecting multiple instances under Win32
Message-Id: <1vi%4.101420$h01.798852@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <27dce54a.258f01b5@usw-ex0103-086.remarq.com>,
menolly <menollyNOmeSPAM@spy.net.invalid> writes:
> Using ActiveState on NT, I need to detect if an instance of a
> particular script is already running. Is this even possible?
Sure. There's lots of ways. Lemme give you a couple from the top
of my head:
* Take out a non-blocking flock() on a known file. If the flock()
fails, then another process has the file locked.
* Bind to a local unused network port. Only one process can bind
to a particular port number at a time.
And I'm sure followups will suggest more.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Tue, 6 Jun 2000 21:33:58 -0400
From: "Edward Grinvald" <eg344@nyu.edu>
Subject: Dynamic IP
Message-Id: <iFh%4.21$FW5.657@typhoon.nyu.edu>
Hello all!!
I have a dial up connection, and therefore a dynamic ip. I was wondering if
there is a way to get that new ip into a var in a perl script without
parsing output from something like ifconfig.
Thank you
edward
------------------------------
Date: Wed, 07 Jun 2000 01:24:48 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: each not looping on a hash
Message-Id: <393DA35F.DEAC659@rochester.rr.com>
Tintin wrote:
>
> This one is driving me nuts.
>
> I have a simple hash that maps a URL path to a directory, ie:
>
> %URLMappings= (
> '~fred', '/home/fred/public_html',
> );
>
> In one of my subroutines, it does not even run through the while loop once.:
>
> while (($key,$value) = each %URLMappings) {
> print "$key,$value\n";
> }
>
> I've confirmed that there is a value in URLMappings, by adding the line:
>
> print "$URLMappings{'fred'}\n";
>
> before the while loop.
>
> Any ideas? I'm using Perl 5.005_02
Well, your code works fine verbatim for me (ActiveState build 613,
Windoze 98 SE) (for your print statement to work, I assume the ~ in
front of fred in the hash key is a typo?). You don't seem to be doing
anything wrong. Are you using the hash in your sub as a global, or are
you passing it to the sub in some fashion? If you are passing it, you
might check that code carefully. Also, try
perl -d programname.pl
to run the Perl debugger. That usually lends great insight into what is
happening.
--
Bob Walton
------------------------------
Date: Wed, 7 Jun 2000 13:27:43 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: each not looping on a hash
Message-Id: <960341158.649933@shelley.paradise.net.nz>
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:BOg%4.6$vR3.1612@vic.nntp.telstra.net...
> Tintin <you.will.always.find.him.in.the.kitchen@parties> wrote in
> message news:960337929.25694@shelley.paradise.net.nz...
> > This one is driving me nuts.
> >
> > I have a simple hash that maps a URL path to a directory, ie:
> >
> > %URLMappings= (
> > '~fred', '/home/fred/public_html',
> > );
> >
> > In one of my subroutines, it does not even run through the while loop
> once.:
> >
> > while (($key,$value) = each %URLMappings) {
> > print "$key,$value\n";
> > }
> >
> > I've confirmed that there is a value in URLMappings, by adding the
> line:
> >
> > print "$URLMappings{'fred'}\n";
> >
> > before the while loop.
> >
> > Any ideas? I'm using Perl 5.005_02
> >
>
> from perldoc:
>
> each HASH
> When called in list context, returns a 2-element list
> consisting of the key and value for the next element of
> a hash, so that you can iterate over it. When called in
> scalar context, returns the key for only the "next"
> element in the hash. (Note: Keys may be `"0"' or `""',
> which are logically false; you may wish to avoid
> constructs like `while ($k = each %foo) {}' for this
> reason.)
>
> Maybe its not $URLMappings{fred} thats empty or zero and thus returning
> false?
Well the strange thing is that I use the same loop in another subroutine
(which gets called first) and it does loop through the hash.
%URLMappings is global, so maybe something is happening the first time it is
processed.
------------------------------
Date: Wed, 7 Jun 2000 13:35:51 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: each not looping on a hash
Message-Id: <960341646.681384@shelley.paradise.net.nz>
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:BOg%4.6$vR3.1612@vic.nntp.telstra.net...
> Tintin <you.will.always.find.him.in.the.kitchen@parties> wrote in
> message news:960337929.25694@shelley.paradise.net.nz...
> > This one is driving me nuts.
> >
> > I have a simple hash that maps a URL path to a directory, ie:
> >
> > %URLMappings= (
> > '~fred', '/home/fred/public_html',
> > );
> >
> > In one of my subroutines, it does not even run through the while loop
> once.:
> >
> > while (($key,$value) = each %URLMappings) {
> > print "$key,$value\n";
> > }
> >
> > I've confirmed that there is a value in URLMappings, by adding the
> line:
> >
> > print "$URLMappings{'fred'}\n";
> >
> > before the while loop.
> >
> > Any ideas? I'm using Perl 5.005_02
> >
>
> from perldoc:
>
> each HASH
> When called in list context, returns a 2-element list
> consisting of the key and value for the next element of
> a hash, so that you can iterate over it. When called in
> scalar context, returns the key for only the "next"
> element in the hash. (Note: Keys may be `"0"' or `""',
> which are logically false; you may wish to avoid
> constructs like `while ($k = each %foo) {}' for this
> reason.)
>
> Maybe its not $URLMappings{fred} thats empty or zero and thus returning
> false?
Ahh. Found the problem. Certainly not helped by my stupidity in not
posting the *actual* code being used.
Anyway, I was using a
last if condition;
in the loop.
After rereading the docs for each, I saw that it says:
"When this hash is entirely read, a null list is returned (which, when used
in a list assignment, produces a false value). The next call to each after
that will start a new iteration."
------------------------------
Date: 7 Jun 2000 01:44:05 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: each not looping on a hash
Message-Id: <8hk9d5$38nee$1@fu-berlin.de>
hi,
Tintin <you.will.always.find.him.in.the.kitchen@parties> wrote:
> %URLMappings= (
> '~fred', '/home/fred/public_html',
> );
> In one of my subroutines, it does not even run through the while loop once.:
> while (($key,$value) = each %URLMappings) {
> print "$key,$value\n";
> }
> I've confirmed that there is a value in URLMappings, by adding the line:
> print "$URLMappings{'fred'}\n";
if i run the same code, it works for me.
(even if i have a key '' or a value '0' or...)
do you run the script with -w?
a little bit more info would be helpful.
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Wed, 07 Jun 2000 02:10:27 GMT
From: purl_gurl@my-deja.com
Subject: Re: Fill In With Spaces Command
Message-Id: <8hkau8$20p$1@nnrp1.deja.com>
"SteveSingletary" <steve@gte.net> asks;
> okay - I feel stupid now - it has been working fine.
> I have been writing to a file and then displaying the
> file out on my browser. This now brings up another
> question. The file is fine - it has the spacing I need,
> but I still need it displayed properly. Here is the code
(snipped)
> This will print out everything perfect - except it removes
> the spaces that I inserted!?!?
> Any ideas??
Yes, some ideas.
While others argue over standard methods of using
sprintf and pack, I have written a rather verbose
test script for you. This script exemplifies how to
do this from a command line or, best for you, from
an html interface, both after some modification. My
code is written in as Plain English as possible to
assist in reading ease and comprehension.
Change the first line Perl locale, load it to
your server, it is ready to go, ready for play.
This code, obviously, will need to be modified to
incorporate into your script, or modified to use
as an html interface. My intent is not to write
for you, copy and paste cargo cult code so often
posted here, but rather to give you help and give
you a bit of a challenge to put you in a position
of having to work at solving your problem, thus
learning as well. If you are willing to put out
work in exchange for knowledge, look over my
script and its results. If not, well.. move on.
For your html problem of spaces vanishing, find
this line:
$pad = "X";
Change this above line to:
$pad = " ";
..and those spaces will magically reappear in
your html document. Same principle holds true
for other standard issue codes posted previously.
This test script exemplifies two basic notions
for you. One is how to add padding to your fields
via an interface. My other notion is how to add
more delimiters, equally on-the-fly from an interface.
In a sense, this code is a very rudimentary beginning
for a data base management script.
Adjustable padding from an interface, will afford you
this "pretty" look you want for your page, with testing
at a glance. Adding delimiters, allows you to create
new fields as needed, later addressed via element numbers
within an array. However, these methods are beyond my scope
and intent of this article.
Padding or additional delimiters may be added, in your
case, via an html form action which opens, manipulates
and prints a new data base for you. I would advise you
to test this type of methodology well before, well before,
ever thinking of applying this to your actual data base.
Even then, _always_ make a safe backup copy.
This code is not cargo cult one liner weenie code for
you to copy and paste learning little in the process.
My code is intended for programmers, such as yourself,
who are capable of reading through a script, then
developing a good understanding of basic principles.
There are some inherent bugs, with this script and
with codes posted by others. You have already discovered
one serious bug with other codes posted, yes? However,
dealing with bugs and glitches effectively, is what
sorts programmers and one line weenie code posters.
As a hint, negative numbers might present a big bug.
You are a programmer, am I correct? Use ideas from
this code or don't use them. Either way, I hope to
have provided some insight to alternative methods
opposing the usual copy and paste code posted here.
Godzilla!
PRINTED RESULTS
_______________
Test One - Variable Padding:
Input field data is: Steve
Padding / Delimiter input character is: X
Padding input count is: 25
String now appears:
SteveXXXXXXXXXXXXXXXXXXXX
Final output is:
SteveXXXXXXXXXXXXXXXXXXXX
There are 25 characters in total for this string:
SteveXXXXXXXXXXXXXXXXXXXX
Test Two - Adding Delimiters:
Input field data is: Billyray
Padding / Delimiter input character is: ¦
Padding input count is: 2
String now appears:
Billyray¦¦¦
Final output is:
Billyray¦¦
There are 10 characters in total for this string:
Billyray¦¦
TEST SCRIPT
___________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
## Test One Pretend Input:
$field_data = "Steve";
$pad = "X";
$pad_count = 25;
$delimiter = "";
## Print confirmation of input:
print "Test One - Variable Padding:\n
Input field data is: $field_data\n
Padding / Delimiter input character is: $pad$delimiter\n
Padding input count is: $pad_count\n\n";
&Pad_Print;
## Test Two Pretend Input:
$field_data = "Billyray";
$pad = "";
$pad_count = 2;
$delimiter = "¦";
## Print confirmation of input:
print "Test Two - Adding Delimiters:\n
Input field data is: $field_data\n
Padding / Delimiter input character is: $pad$delimiter\n
Padding input count is: $pad_count\n\n";
&Pad_Print;
sub Pad_Print
{ # Pad_Print
if (!($delimiter))
{ $pad_count = ("$pad_count" - (length ("$field_data"))); }
if ($delimiter)
{
$pad = $delimiter;
$pad_count++;
}
$pad_out = $pad;
$count = 1;
while ($count < $pad_count)
{
$pad_out = join ("", $pad_out, $pad);
$count++;
}
## Print confirmation of padding:
print "String now appears:\n
$field_data$pad_out\n\n";
## Manipulate Field Data / Padding into one string:
$field_data = join ("", $field_data, $pad_out);
## Check for delimiter input:
if ($delimiter)
{ chop $field_data; }
## Print final output:
print "Final output is:\n
$field_data\n\n";
## Non-destructive character count / various characters:
$count_padding = ($field_data =~ tr/¦ a-zA-Z0-9//);
## Confirm correct padding count for pad
print "There are $count_padding characters in total for this string:\n
$field_data\n\n\n";
} # Pad_Print
exit;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 7 Jun 2000 02:47:23 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Fill In With Spaces Command
Message-Id: <8hkd3r$qig$1@slb0.atl.mindspring.net>
SteveSingletary (steve@gte.net) wrote:
: okay - I feel stupid now - it has been working fine. I have been writing to
: a file and then displaying the file out on my browser. This now brings up
: another question. The file is fine - it has the spacing I need, but I still
: need it displayed properly. Here is the code I use to display the file onto
Your problem is that you're outputting HTML, and in HTML runs of multiple
whitespace are defined as equivalent to single spaces, except in <PRE>
sections. You've basically got three choices:
1) Replace each space with a entity. Though is officially
defined only as a non-*breaking* space, most browsers also treat it as a
non-*collapsing* space.
2) Enclose the output in a <PRE> section.
3) Use a table; this is in fact the most structurally appropriate way of
representing output that's organized into rows and columns.
: the browser:
: open (POFILE, "$podata");
-10 points for not checking the result of your open.
: @PODATA = <POFILE>;
-2 points for reading an entire file in memory and then processing it
line-by-line.
: close (PODATA);
:
: foreach $poline (@PODATA) {
: print "$poline<BR>\n";
:
: This will print out everything perfect - except it removes the spaces that I
: inserted!?!?
The "it" here isn't your program: it's your browser doing what it's
supposed to.
------------------------------
Date: Tue, 6 Jun 2000 21:08:29 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: good perl coding style
Message-Id: <slrn8jrbkt.r6.tadmc@maxim.metronet.com>
On 6 Jun 2000 19:09:29 GMT, Eric Bohlman <ebohlman@netcom.com> wrote:
>Larry actually designed it with natural-language principles in
>mind,
To hear it from Larry, see:
http://www.wall.org/~larry/natural.html
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 07 Jun 2000 01:23:12 GMT
From: eggie@REMOVE_TO_REPLYsunlink.net (James Kufrovich)
Subject: Help with OO needed.
Message-Id: <slrn8jr930.d24.eggie@melody.mephit.com>
Hi.
I'm writing with a question about a recipe in chapter 13 of the
Perl Cookbook, "Getting Attribute Methods Using AUTOLOAD." This is
section 13.11 on the CD Bookshelf. I'd post the code in question here,
but I'm not sure of the legality of doing so. Would it be OK to cut and
paste the code from the CD here when asking for clarification of it?
Anyway, the code in this recipe (and others) uses something like
the following in a constructor:
sub new {
my $temp = shift;
my $class = ref($temp) || $temp;
my $parent = ref($temp) && $temp;
...
}
I understand that ref taken on an object will return ARRAY, HASH,
SCALAR or whatever type it is, and so that would evaluate as true. The
Cookbook says that ref taken on a class will return the class name - a
string. How does that evaluate to false?
And if the constructor was called as an instance method, its first
argument would be the object calling it, correct? If so, $class above
would be assigned 'HASH' (for example). How would this affect the bless
if $class is used as its second argument? Will the new object be blessed
into the same class as the calling object is in? I.e.,
return bless ( {}, $class ) in the constructor show above.
The AUTOLOAD method defined right above this says to return unless
$attr =~ /[^A-Z]/, while the comment following says it will skip DESTROY
and other methods that are in all upper-case. These are contradictory, or
am I confused? And I don't understand the need for changing $attr to
upper case in the last two lines of the AUTOLOAD definition. Anyone?
I'd appreciate any help with this, either posted or emailed.
Thanks.
Jamie Kufrovich, YAPH-wannabe
--
FMSp3a/MS3a A- C D H+ M+ P+++ R+ T W Z+
Sp++/p# RLCT a+ cl++ d? e++ f h* i+ j p+ sm+
------------------------------
Date: Tue, 6 Jun 2000 21:22:43 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to write on a file?
Message-Id: <slrn8jrcfj.r6.tadmc@maxim.metronet.com>
On Tue, 06 Jun 2000 10:30:04 GMT, Arun Mahajan <arun67@yahoo.com> wrote:
>I know it must be sound silly
Reasking a FAQ is pretty much the definition of silly,
so you are correct there.
>but i donot know how to write on a file.
perldoc -f print
take particular note when it mentions FILEHANDLE.
>I have the following html code where I want the moment user select the one
>of the option and submit it will increment the no of respondent, in the
^^^^^^^^^
>text file, by one. Will anybody help me to provide me the logic here.
perldoc -q increment
"I still don't get locking. I just want to increment the
number in the file. How can I do this?"
You are expected to check the Perl FAQs *before* posting
to the Perl newsgroup you know.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 07 Jun 2000 02:35:37 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: IO::Socket devices
Message-Id: <Zxi%4.101421$h01.798852@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <0Qe%4.236814$Tn4.2137712@news1.rdc2.pa.home.com>,
"Ben Kennedy" <bkennedy@hmsonline.com> writes:
> is there a way to select which interface I use for an IO::Socket object
> (/dev/eth0 vs /dev/ppp0 for example) or am I stuck with whatever the system
> routes are based on the IP address? Thanks in advance -
The route to send a TCP packet (for your socket) is a packet-by-packet
decision. Routes can change on the system even while your program is
running.
In fact, this is considered a feature and a Good Thing.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 07 Jun 2000 02:43:32 GMT
From: advonet@my-deja.com
Subject: IPC: capturing fd from c httpd, direct to socket cgi?
Message-Id: <8hkcsg$3ac$1@nnrp1.deja.com>
I'm sure this question has been addressed before, but I couldn't find
anything newer than a 1996 discussion.
I want to hack up a web server (BOA specifically -- totally cool single
threaded multiplexing httpd -- extremely fast and small -- find it on
sourceforge.net) to talk my persistent PERL cgi via FIFO. Not to hard.
Now I know I can write back through a FIFO and boa can copy that out to
the http socket, but it'd be better if perl could write to the socket
directly.
How do I get the socket's fd open in PERL and then make sure that
everything gets cleaned up when it's complete.
Boa's in C. CGI's all perl (thread-enabled?). I'm running FreeBSD, but
a portable solution would be good.
I'll publish this opensource @ http://wob.sourceforge.net
John
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 02:01:10 GMT
From: pornpira@beta.tricity.wsu.edu
Subject: Need help with error msg
Message-Id: <8hkacu$1ka$1@nnrp1.deja.com>
Hi,
I've got a question about this error message.
"Odd number of elements in hash list at /opt/perl5.004/lib/CGI.pm line
617."
I don't understand what this means and how to fix this. Can anyone
help?
Thank you in advance,
Mimi
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 07 Jun 2000 02:05:27 GMT
From: "news" <toa@home.com>
Subject: needs help w system interaction
Message-Id: <H5i%4.4555$uj6.209009@news1.rdc1.on.wave.home.com>
gang,
Is there anyway to run a unix program from within a perl script??
I am trying to set some views in Clearcase from a perl script.
as soon as the perl script execution gets to the setview line
it stops and does not go further.
even if I try to start a unix "rsh" from a perl script
it stops again, I think both problems are the same.
I am using
system "Clearcase setview user_view";
system "rsh ck15";
in both situations.
Any guidence on this is helpful
Thanks a bunch
------------------------------
Date: Wed, 07 Jun 2000 03:10:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl 5.6 stable??
Message-Id: <j2j%4.103371$hT2.421164@news1.rdc1.ct.home.com>
sergei_kucherov <sergei_kucherov@3com.com> wrote:
> In article <8fan0d$s22$2@news.bnhof.de>,
> kraehe@copyleft.de wrote:
> ...
>> I've tested Perl 5.6 as /opt/perl-5.6 on a Debian/Woody, and imho
> Perl 5.6
>> is not so stable as it should be.
> ...
> I've been extremely disappointed with the quality of Perl5.6.
> It is simply not usable (no workaround exists for a core dump bug), and
> I am reverting to perl5.00503.
> 1) My first day of using perl5.6, I found (and reported to
> bugs.activestate.com and this newsgroup) a serious regression in perl5.6
> regexp handling.
Did you use perlbug to report it to the perl5-porters list? Those are the
folks that actually do the fixing. (I don't recall seeing one come
through, but I may have missed it)
> 2) My second day of using it (today), I found (and reported to
> bugs.activestate.com) a simple use of the LWP module that causes an
> internal perl core dump, which _appears_ from the debugger trace to be
> in the Carp module! I have not found any workaround for this easily
> reproducible problem (on Solaris), and no patch exists yet.
Once again, use perlbug to report bugs, with a small test program that
duplicates the problem.
> Am I just lucky, or is perl5.6 a shoddy release?
You were lucky. There are a *lot* of bugs in 5.005_03. 5.6.0 is generally
a cleaner and more stable release. There are, unfortunately, some bugs in
it, but that's the nature of software.
Just out of curiosity, did you test out the betas of 5.6.0?
> Even though a source patch exists for problem 1 above, it is not easily
> available. Why aren't all patches available bundled in with the source
> distribution (eg. under a "develop.tar.gz" name)?
Providing a tarball of patches is reasonably silly--might as well go and
release an updated version of perl. (one of which is likely to be released
soon)
> Then folks like me
> could download and build the latest release plus all known good patches.
The patches hit p5p, and you can snag them from there. If you're not
watching it might be best to not apply individual patches--they may all be
OK individually (or not, since they see significantly less testing) but
it's hard to say how multiple patches interact without the full-scale
abuse they get when a release is coming up.
> Instead, it took me several hours to find and build the patch just for
> problem 1 above. And I didn't get any of the dozens of other important
> patches available through this convoluted method.
Which method would that be, exactly? You've not said.
> I guess perl users are used to this unfriendliness.
Generally windows perl users wait for a new release from ActiveState,
while the other users either grab patches from p5p or wait for a new
point release.
> Contrast this to the Expect language world,
> where a new source tar file is put out every time an important patch
> occurs (averaging once a month -- and only a small handful of developers
> work on it, not an army like with perl).
Small army indeed--there are fewer than a dozen truly active people
working on core perl at any one time.
Perl is also *significantly* larger than Expect. Expect is tiny compared
to perl. It's more on the scale of Apache or Mozilla than Expect. Scale
makes a big difference.
> So when I report a bug, I know
> for certain whether any patches have the fix (I reported half a dozen
> regressions in Expect5.31.*, and all but one (which I have a workaround
> for) have been fixed -- I have all the patches just by downloading and
> building one tar source tree which is on the web site).
You can do the same by searching the perl5-porters mailing list archives
for bug reports. Generally if a bug's fixed, the patch is in a reply to
the message.
> Since the Perl community is so large, what is the problem with making
> easily available all extant patches on a web site as they occur? Answer:
> laziness and no concern about the serious regressions that make perl5.6
> unusable without the patches.
Nonsense. You're just being whiny. Perl is *free*, and most of what
happens is done by volunteers. If you don't like the way things are
handled, then either volunteer to fix them or make do. You're certainly
not obligated to fix any of the problems, but neither do you have license
to whine about the things you don't like.
> Lucky for the perl community that
> perl5.00503 is such a bug-free release.
Check perldelta. 5.005_03 is hardly bug-free, you just may not have
tripped over any of its bugs.
> perl5.6 is not
Perl 5.6.0 got beat up pretty darned well. That some bugs slipped through
is inevitable, but it's as stable a release as 5.005_03, which detonated
with regularity for some people.
> and should only
> have been released if a mechanism existed to make all known patches
> _easily_ available to build from a source tree (CVS doesn't cut it as
> easy for the average user -- one tar file does).
There is a mechanism--we call it a point release. Perl5-porters could be
better archived and indexed, but we do the best as can be done with the
resources and interest that's available.
Dan
------------------------------
Date: Wed, 07 Jun 2000 03:41:54 GMT
From: "Edwin A. Jukniewicz" <EJuke@worldnet.att.net>
Subject: PERL DBI module to connect to MS-Access databases?
Message-Id: <393DC655.CD8558EF@worldnet.att.net>
Hello,
Is anybody aware of any PERL DBI module to connect to MS-Access
databases?
Or any way at all using PERL?
Regards,
- Ed
------------------------------
Date: Wed, 07 Jun 2000 03:44:44 GMT
From: "Edwin A. Jukniewicz" <EJuke@worldnet.att.net>
Subject: PERL DBI module to connect to MS-Access databases?
Message-Id: <393DC700.1D46F145@worldnet.att.net>
BY the way, I should mention, I'm running PERL on a Linux/Intel box.
RH V6.2
THanks...
- Ed
------------------------------
Date: Wed, 07 Jun 2000 03:56:22 GMT
From: Daniel Fisher <danielf@unc.edu>
Subject: Pseudo-hashes/OOP
Message-Id: <danielf-C01DE2.23562206062000@news-server.nc.rr.com>
I'm planning to make an OOP framework with the following features:
- I'm using a pseudo-hash to prevent autovivification.
- AND -
- I will only know the attributes' names in the object by way of a
config file.
My question is:
Is it possible to -
1) parse the config file and get the attribute names into an array,
2) and then put them into the
use fields (@array_of_attribute_names_from_the_just_parsed_config_file)
just before compile time (... say in a BEGIN {} )
?
My next question is:
If this is possible, what kind of speed benefit will I see?
I could write code to test this, but I'm pretty sure that it would work
regardless of whether there's information in the "use fields" statement.
That's why I'm asking the second (performance) question...
I can always parse the config file during the first object's
instantiation, but I don't feel like I'm using pseudo-hashes to their
potential.
Thank you for your time,
Dan
------------------------------
Date: 7 Jun 2000 03:07:44 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Simple regexp question - Bug in Perl?
Message-Id: <8hkea0$qig$2@slb0.atl.mindspring.net>
Some guy (angryflower99@hotSPAMmail.com) wrote:
: I know, not bloody likely there is a bug in perl. But I can't make sense of
: why this working code won;t work in this case.
Yes you can, you just need some practice.
: First off, if anyone is familiar with Snort, I am attempting to write
: something to look at vision.conf and search/replace the $INTERNAL and
: $EXTERNAL variables with real network numbers.
:
: Each line of the attack sig file (vision.conf) looks like this.
:
: alert tcp $INTERNAL any -> $EXTERNAL 80 (msg: xxx yyy)
:
: OK, here is the code
:
: $vbl="\$INTERNAL"; # From previous advice, added the \
That will prevent the $ from causing an interpolation during the
assignment the way your old code did; $vbl will now be the literal string
'$INTERNAL' rather than empty the way it was before. But that's not
enough; see below.
: $newval="192.168.1.0/24";
: while (<>) {
: s/$vbl/$newval/;
Interpolation will expand this to:
s/$INTERNAL/192.168.1.0/24/;
before the regex engine tries to compile the expression. When the regex
engine starts to compile it, it sees a dollar sign and guess what it
tries to do? That's right; it tries to interpolate the value of the
variable $INTERNAL, which evaluates to an empty string.
: print;
: }
As others told you later on in the original thread, you need to block this
interpolation by putting a \Q at the beginning of your regex; this will
prevent the regex engine from seeing characters as anything but literal.
Any regex that needs to match a piece of literal text stored in a variable
should be prefixed with \Q; not only does this avoid false interpolation,
it allows you to literally match characters that would otherwise have a
special meaning, such as '.'.
------------------------------
Date: 7 Jun 2000 11:41:24 +1000
From: James Macnicol <jamesm@ee.adfa.edu.au>
Subject: Win32 Perl read weirdness
Message-Id: <393da844@news.adfa.oz.au>
We are trying to use some Perl scripts on Windows NT that work fine on
Solaris and Linux. The scripts read individual frames from a long video
sequence and then output the components of those frames to three different
files. The source files we are reading from are about 15MB in size but
we are getting short reads after about 2MB (i.e. we call read() and it
returns no bytes or less than we asked for). The portability stuff on
www.perl.com doesn't indicate there are any semantic differences in
read() between Win32 and Unix that I can see. I have tried two versions
of the ActiveState Perl (the ones base on 5.005 and the latest 5.5) and
on two different NT boxen with the same result.
I suspect I should know the answer to this, but can someone please give
me a clue as to what is wrong here?
Thanks.
--
James Macnicol
j-macnicol@adfa.edu.au
------------------------------
Date: Wed, 07 Jun 2000 02:29:31 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Win32 Perl read weirdness
Message-Id: <fsi%4.101419$h01.798852@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <393da844@news.adfa.oz.au>,
James Macnicol <jamesm@ee.adfa.edu.au> writes:
> We are trying to use some Perl scripts on Windows NT that work fine on
> Solaris and Linux. The scripts read individual frames from a long video
> sequence and then output the components of those frames to three different
> files. The source files we are reading from are about 15MB in size but
> we are getting short reads after about 2MB (i.e. we call read() and it
> returns no bytes or less than we asked for).
> [...]
> I suspect I should know the answer to this, but can someone please give
> me a clue as to what is wrong here?
I have to ask, but...did you make the filehandle binary with binmode()?
That can cause premature EOF on Win32 platforms... perldoc -f binmode
If you already did this, sorry. But I had to ask. It's a Windows/DOS
misfeature that some people forget about.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3272
**************************************