[18220] in Perl-Users-Digest
Perl-Users Digest, Issue: 388 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 1 14:06:36 2001
Date: Thu, 1 Mar 2001 11:05:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983473519-v10-i388@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Mar 2001 Volume: 10 Number: 388
Today's topics:
Re: Aliasing refs while using strict <dan@tuatha.sidhe.org>
Re: Date formatting (Mihai N.)
Re: File locking problem? <billk@cts.com>
Re: File locking problem? (Randal L. Schwartz)
Re: File locking problem? (Afkamm)
Re: File locking problem? nobull@mail.com
Re: File locking problem? <billk@cts.com>
Re: File locking problem? <flavell@mail.cern.ch>
Re: File locking problem? (Randal L. Schwartz)
Re: File locking problem? <wells@cedarnet.org>
Re: File locking problem? <billk@cts.com>
Guidance on printed output <klessa@airmail.net>
Re: Help with consolidating a regex <mjcarman@home.com>
Here is the script i'm working on = internal server err <fabian@markisspecialisten.com>
Re: Here is the script i'm working on = internal server <billk@cts.com>
Re: How are SOL_SOCKET and SO_REUSEADDR defined in vari (Michael Wojcik)
Re: How are SOL_SOCKET and SO_REUSEADDR defined in vari <barmar@genuity.net>
Re: How are SOL_SOCKET and SO_REUSEADDR defined in vari (Kenny McCormack)
How do I DROP a table using XBase module <don@lclcan.com>
Re: Perl Mongers Required in Chicago! <comdog@panix.com>
Re: Perl Mongers Required in Chicago! <tom@power.net.uk>
Re: perl thread woes.. <dan@tuatha.sidhe.org>
Re: Perl, Cookies, and Apache. nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 01 Mar 2001 18:42:36 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Aliasing refs while using strict
Message-Id: <wKwn6.4845$Ok4.700887@news1.rdc1.ct.home.com>
Micah Cowan <micah@cowanbox.com> wrote:
> my @foo = ( "Hello", "cheez", 10 );
> local *foo = shift;
The local is acting on a different variable than the one you
created with my. That's why perl complains. It also means, with
code that looks like the above, that references to @foo or one
of its elements will reference the lexical variable, not
the package variable you've aliased.
> The problem is, I also love to use strict. I can't use the above
> construct unless I disable strict vars /AND/ refs, because we're
> screwing with the namespace (which is only globals and local()ized
> globals).
That has nothing to do with your problem. You can do what you
want to with strict in effect. And, of course, you can always
disable it for a particular block if you're sure you want to
do what perl complains about.
> Now, of course, I could do:
> sub bar (\@) {
> my @foo = @{$_[0]};
> ...
> }
> But if the argument is a /huge/ array, I don't /want/ to copy it into
> another array.
> Is there a better way of performing aliases such as this?
Don't. There's nothing wrong with taking the reference and dealing
with it that way. This:
sub bar {
my $arr_ref = shift;
print $arr_ref->[12];
foreach (0..$#{$arr_ref}) {
print $arr_ref->[$_];
}
}
and stuff like it work just fine. Granted, a bit messy with
the arrows in there, but quite functional.
Dan
------------------------------
Date: Thu, 01 Mar 2001 18:30:15 GMT
From: nmihai_2000@yahoo.com (Mihai N.)
Subject: Re: Date formatting
Message-Id: <90576DD01MihaiN@24.1.64.32>
Hi,
Yes, I have read the original posting. I don't want to argue,
but the limited view gives you trouble on the long run.
You develop something today, is a great success, and 2 months from
now the marketing comes and says "I want this for Europe".
You are right, if no language support is requested, it does not matter.
Regards,
Mihai
------------------------------
Date: Thu, 01 Mar 2001 17:17:25 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: File locking problem?
Message-Id: <Fuvn6.99781$GV2.22675014@typhoon.san.rr.com>
"Gil Vautour" <vautourNO@SPAMunb.ca> wrote:
> Hello,
>
> I have a CGI script in Perl that uses a performs a simple counter
> operation, when a user submits a Form, a file is opened, the value is
> read and incremented by one and written back to file. Occasionally the
> counter gets reset back to 1 for some reason. Below is a snippet of the
> code I use, could this be some sort of file locking problem?
> Perhaps there is a better way to do this?
If it's a locking problem, take a look at flock() in perlfunc.
In your case where you're reading, then re-writing, and would
want the operation to be atomic, you could either: use a second
file as the lock (i.e. "./counter/$counter.lock"); or, change
your read/write to do its job without re-opening the file.
The latter would be something like:
open for append "./counter/$counter"
flock exclusive (FLOCK_EX)
read the num
seek to zero
truncate to zero
write ++num
flock unlock
close
. . . I believe that ought to work, but so far I've only used
flock() on a separate file, not the ones I'm actually reading
and writing (because my "database.lock" file controls access
to a whole tree of files.) But if I were controlling access
to a single file, I believe locking that very same file (as
above) ought to work.
Hope this helps,
Bill
> open(LASTNUM, "./counter/$counter") || die "ERROR! can't open file:
> $!\n";
> $num = <LASTNUM>;
> chop($num);
> close(LASTNUM) || die "ERROR! can't close file: $!\n";
> $num++;
> open(STUDFILE, ">./counter/$counter") || die "ERROR! can't open
> file: $!\n";
> print STUDFILE "$num\n";
> close(STUDFILE) || die "ERROR! can't close file: $!\n";
>
------------------------------
Date: 01 Mar 2001 09:43:13 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: File locking problem?
Message-Id: <m1wva9z8pa.fsf@halfdome.holdit.com>
>>>>> "Bill" == Bill Kelly <billk@cts.com> writes:
Bill> The latter would be something like:
Bill> open for append "./counter/$counter"
Bill> flock exclusive (FLOCK_EX)
Bill> read the num
Bill> seek to zero
Bill> truncate to zero
Bill> write ++num
Bill> flock unlock
Bill> close
All wrapped up for you in:
File::CounterFile
Don't type more than you have to! Ever!
use File::CounterFile;
my $new_number = File::CounterFile->new("COUNTER", "0000")->inc;
There. New number every time, starting at 0000.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 01 Mar 2001 17:49:13 GMT
From: afkamm@bigfoot.com (Afkamm)
Subject: Re: File locking problem?
Message-Id: <Xns9057B54F0166Aafkfoot@194.117.133.134>
On the 01 Mar 2001 in comp.lang.perl.misc, Gil Vautour wrote the
following in a hurry.
>open(LASTNUM, "./counter/$counter") || die "ERROR! can't open file:
>$!\n";
> $num = <LASTNUM>;
> chop($num);
> close(LASTNUM) || die "ERROR! can't close file: $!\n";
> $num++;
> open(STUDFILE, ">./counter/$counter") || die "ERROR! can't open
>file: $!\n";
> print STUDFILE "$num\n";
> close(STUDFILE) || die "ERROR! can't close file: $!\n";
>
>
It could be and probably is a problem due to the file not being locked.
If it's supported, try using the file lock command "FLOCK".
open(LASTNUM, "./counter/$counter") || die "ERROR! can't open file:
$!\n";
flock(LASTNUM,2);
$num = <LASTNUM>;
chop($num);
flock(LASTNUM,8);
close(LASTNUM) || die "ERROR! can't close file: $!\n";
$num++;
open(STUDFILE, ">./counter/$counter") || die "ERROR! can't open file:
$!\n";
flock(STUDFILE,2);
print STUDFILE "$num\n";
flock(STUDFILE,8);
close(STUDFILE) || die "ERROR! can't close file: $!\n";
Hope this helps.
Marc :-)
------------------------------
Date: 01 Mar 2001 17:45:49 +0000
From: nobull@mail.com
Subject: Re: File locking problem?
Message-Id: <u9lmqpo01e.fsf@wcl-l.bham.ac.uk>
Those, such as Gil Vautour <vautourNO@SPAMunb.ca>, who do not learn
from the FAQ are condemned to repeat it:
[ snip FAQ: "I still don't get locking. I just want to increment the number
in the file. How can I do this?" ]
What part of "always check to see if your question is listed in the
FAQ _before_ you post it" did you fail to understand?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 01 Mar 2001 17:58:35 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: File locking problem?
Message-Id: <f5wn6.99834$GV2.22681610@typhoon.san.rr.com>
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote:
> >>>>> "Bill" == Bill Kelly <billk@cts.com> writes:
>
> Bill> The latter would be something like:
>
> Bill> open for append "./counter/$counter"
> Bill> flock exclusive (FLOCK_EX)
> Bill> read the num
> Bill> seek to zero
> Bill> truncate to zero
> Bill> write ++num
> Bill> flock unlock
> Bill> close
>
> All wrapped up for you in:
>
> File::CounterFile
Man, that Gisle Aas - he's thought of everything! =)
Thanks for the tip.
> Don't type more than you have to! Ever!
^^ I believe there's an
extra space there. :-P
Bill
> use File::CounterFile;
> my $new_number = File::CounterFile->new("COUNTER", "0000")->inc;
>
> There. New number every time, starting at 0000.
>
> print "Just another Perl hacker,"
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 1 Mar 2001 18:43:13 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: File locking problem?
Message-Id: <Pine.LNX.4.30.0103011836510.4620-100000@lxplus003.cern.ch>
On Thu, 1 Mar 2001, Bill Kelly wrote:
> The latter would be something like:
>
> open for append "./counter/$counter"
> flock exclusive (FLOCK_EX)
> read the num
You opened for append, so you're positioned at the end of the file.
You can't read the contents until you've repositioned.
> seek to zero
> truncate to zero
> write ++num
> flock unlock
Wrong! Don't unlock - just close. (Recent versions of Perl may
protect you from the consequences of this error, but it's the
principle of the thing)
> close
> . . . I believe that ought to work,
Aside from the two points above, I reckon so too. It also has the
benefit that it's self-starting i.e if the file didn't previously
exist then the open-for-append can create it (of course your code then
has to deal with the possibility of it being empty).
Error checking is essential of course, but you've left it as an
exercise for the student.
> but so far I've only used
> flock() on a separate file, not the ones I'm actually reading
> and writing (because my "database.lock" file controls access
> to a whole tree of files.)
A useful technique, but still needs to be handled with care.
--
This .sig only acknowledges that the message was displayed on
the recipient's machine. There is no guarantee that the
content has been read or understood.
------------------------------
Date: 01 Mar 2001 10:22:50 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: File locking problem?
Message-Id: <m1k869z6v9.fsf@halfdome.holdit.com>
>>>>> "Afkamm" == Afkamm <afkamm@bigfoot.com> writes:
Afkamm> It could be and probably is a problem due to the file not being locked.
Afkamm> If it's supported, try using the file lock command "FLOCK".
Afkamm> flock(LASTNUM,8);
Afkamm> close(LASTNUM) || die "ERROR! can't close file: $!\n";
No. no no no. No.
Afkamm> flock(STUDFILE,8);
Afkamm> close(STUDFILE) || die "ERROR! can't close file: $!\n";
No, No no no. No no no, no no, no.
Afkamm> Hope this helps.
Hurts. Donut?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 01 Mar 2001 11:39:18 -0600
From: Steve Wells <wells@cedarnet.org>
Subject: Re: File locking problem?
Message-Id: <3A9E8946.E5C86CC5@cedarnet.org>
You need to look into using flock. It requires different values on various
platforms however you can get around that using the Fcntl module which
comes with perl.
Here's a quick example of it's use that should be easily expandable for your
needs:
---------
#!/usr/bin/perl -w
use strict;
use constant COUNTER_FILE => "count.txt";
use Fcntl qw(:DEFAULT :flock);
count();
exit 1;
sub count {
sysopen (C, COUNTER_FILE, O_RDWR|O_CREAT) or
die ("Can't open: ". COUNTER_FILE ." $!");
flock(C, LOCK_EX); # lock the file
my $c = <C> || 0;
seek (C, 0, 0);
truncate (C, 0);
print C ++$c, "\n";
flock(C, LOCK_UN);
close(C);
}
1;
---------
HTH,
STEVE
Gil Vautour wrote:
> Hello,
>
> I have a CGI script in Perl that uses a performs a simple counter
> operation, when a user submits a Form, a file is opened, the value is
> read and incremented by one and written back to file. Occasionally the
> counter gets reset back to 1 for some reason. Below is a snippet of the
> code I use, could this be some sort of file locking problem?
> Perhaps there is a better way to do this?
>
> open(LASTNUM, "./counter/$counter") || die "ERROR! can't open file:
> $!\n";
> $num = <LASTNUM>;
> chop($num);
> close(LASTNUM) || die "ERROR! can't close file: $!\n";
> $num++;
> open(STUDFILE, ">./counter/$counter") || die "ERROR! can't open
> file: $!\n";
> print STUDFILE "$num\n";
> close(STUDFILE) || die "ERROR! can't close file: $!\n";
------------------------------
Date: Thu, 01 Mar 2001 18:55:31 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: File locking problem?
Message-Id: <DWwn6.100036$GV2.22688392@typhoon.san.rr.com>
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Thu, 1 Mar 2001, Bill Kelly wrote:
>
> > The latter would be something like:
> >
> > open for append "./counter/$counter"
> > flock exclusive (FLOCK_EX)
> > read the num
>
> You opened for append, so you're positioned at the end of the file.
> You can't read the contents until you've repositioned.
My humblest apologies.
>
> > seek to zero
> > truncate to zero
> > write ++num
> > flock unlock
>
> Wrong! Don't unlock - just close. (Recent versions of Perl may
> protect you from the consequences of this error, but it's the
> principle of the thing)
Whoa! I had no idea such a thing was an issue. (I just re-read
perlfunc on flock(), didn't see anything about it. Now checking
the Unix man pages for flock . . . no mention of it there either.)
Okay. . . since I couldn't find any warnings about this usage in
the obvious places (no, I didn't try a Google search :), I'm
going to have to ask:
- Help, why is this considered an error? It would seem natural,
with flock() following open(), to have the flock(LOCK_UN)
precede the close(). I mean, I could understand if it were
considered 'optional', but the idea that it's viewed as an
'error' surprises me.
- Or, I just had a thought: . . . This relates to the flushing
of the writes to the file? . . . So, if one were presented
with a flock() that did not flush the file for you, one
would have to flush explicitly before unlocking, OR forego
the explicit unlock and pick it up implicitly with the
close, as you suggest?
Thing is, I learned how to use flock() by reading the
perlfunc docs. . . . Which explicitly state that flock()
handles the flush. . . . And to me - especially since the
examples in perldoc include unlocking, explicitly - the
open/lock . . . unlock/close seems the obvious, or at
least intuitive way to code the thing. I myself wouldn't
have presumed it was OK to expect an implicit unlock on
close(!) . . . . So, just the perspective of someone who
learned to use the locking function from the perlfunc docs.
- How did you find out about this? =)
- Guess: you grew up with versions of flock() that don't handle
flushing the file?
Thanks,
Bill
------------------------------
Date: Thu, 1 Mar 2001 12:50:17 -0600
From: "Kathy" <klessa@airmail.net>
Subject: Guidance on printed output
Message-Id: <3CFA47718C5EB4B8.C7A3BBC1B9993810.5D3FC56561BF33E6@lp.airnews.net>
I wrote a little directory search program for someone, allowing people to
selectively query by parameters and display basically a professional
directory listing on the web site.
Now this person wants to have a printed directory. I had two thoughts on
how to accomplish this.
1) I've seen some documentation on how to force page breaks in a web page,
to for example count lines and when you reach them do a forced pagebreak by
using a style command of
<P STYLE="page-break-after: always">
So I wrote a perl script to format the directory as a web page output with
this style command in there, and I haven't seen this do anything at all,
doesn't page break at all
2) Use perl format. However, I don't see any way you can make
double-columned format lines for output. Am I missing something?
I also just read someone suggesting HTML::Format for a sort-of similar
situation. I've read the documentation and don't really understand how
that's going to help me out.
Can anyone point me to some examples of how to accomplish something like
this? Or have some suggestions? Or can point me to better explanation of
the HTML::Format module if that's really what I should be using?
Thanks a bunch.
Kathy D. Lessa
------------------------------
Date: Thu, 01 Mar 2001 09:41:49 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Help with consolidating a regex
Message-Id: <3A9E6DBD.2C997082@home.com>
Brian Rankin wrote:
>
> I have:
>
> $line=~s/- (.*?)<\/dt>//i;
> $title=$1;
> $title =~ s/^\s+//; ## strip leading spaces
> $title =~ s/\s+$//; ## strip trailing spaces
>
> Can these be combined more efficiently?
Sometimes two (simple) regex's are better than one. You could combine
the last two into
$title =~ s/^\s+|\s+$//g;
but that's actually *less* effecient, so I'd leave it alone. Likewise,
you could try to grab $title out of $line without permitting
leading/trailing whitespace, but that would probably just slow it down.
You do have one problem, though -- you assign $1 to $title without
knowing whether or not the match was sucessful. $1 contains a
backreference from the last *successful* match, which means that if your
match fails, it will still hold whatever was there before. Also, do you
really need to strip the pattern out of $line or do you just want to
match it? Based on what you've told us, I'd write it this way:
($title) = $line =~ /- (.*?)<\/dt>/i;
$title =~ s/^\s+//; ## strip leading spaces
$title =~ s/\s+$//; ## strip trailing spaces
-mjc
------------------------------
Date: Thu, 01 Mar 2001 16:38:44 GMT
From: "Fabian Thorbjörnsson" <fabian@markisspecialisten.com>
Subject: Here is the script i'm working on = internal server error
Message-Id: <oWun6.16152$Qb7.2633880@newsb.telia.net>
This is the script:
#!/usr/bin/perl
my $file = "/home/kalas/www/mail.htm";
open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
flock (FILE, 2) or die "cannot lock file exclusively: $!";
my @emailfile = <FILE>;
seek FILE, 0, 0;
truncate FILE, 0;
foreach $line (@emailfile)
{
if ($line !~ /^\Q$email/o)
{
print FILE $line; # we don't need a newline, since the file had them
when we read it into memory.
}
}
close (FILE) or die "cannot close message file: $!";
This is the form:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Email Address:</title>
</head>
<body>
<form action="../cgi-kalas/remove.pl" method="POST">
<p>Email Address: <input type="text" size="20" name="address">
</p>
<input type="submit" value="Skicka">
</form>
</body>
</html>
------------------------------
Date: Thu, 01 Mar 2001 16:58:29 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: Here is the script i'm working on = internal server error
Message-Id: <Vcvn6.99778$GV2.22670225@typhoon.san.rr.com>
"Fabian Thorbjörnsson" <fabian@markisspecialisten.com> wrote
>
> This is the script:
> #!/usr/bin/perl
>
Try running with -w and use strict. =-) (Where does $email come
from?)
One tactic I find useful for debugging CGI scripts is to:
BEGIN { open (STDERR, ">>myprog-log") }
. . . so the 'internal server errors' aren't so mysterious.
Hope this helps,
Bill
> my $file = "/home/kalas/www/mail.htm";
> open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
> flock (FILE, 2) or die "cannot lock file exclusively: $!";
> my @emailfile = <FILE>;
> seek FILE, 0, 0;
> truncate FILE, 0;
>
> foreach $line (@emailfile)
> {
> if ($line !~ /^\Q$email/o)
> {
> print FILE $line; # we don't need a newline, since the file had them
> when we read it into memory.
> }
> }
>
> close (FILE) or die "cannot close message file: $!";
>
>
>
> This is the form:
>
> <html>
>
> <head>
> <meta http-equiv="Content-Type"
> content="text/html; charset=iso-8859-1">
> <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
> <title>Email Address:</title>
> </head>
>
> <body>
>
> <form action="../cgi-kalas/remove.pl" method="POST">
> <p>Email Address: <input type="text" size="20" name="address">
> </p>
> <input type="submit" value="Skicka">
> </form>
> </body>
> </html>
>
>
------------------------------
Date: 1 Mar 2001 17:34:54 GMT
From: michael.wojcik@merant.com (Michael Wojcik)
Subject: Re: How are SOL_SOCKET and SO_REUSEADDR defined in various flavors of Unix?
Message-Id: <97m17u098d@news2.newsguy.com>
[Followups restricted to comp.unix.programmer.]
In article <97j9qs$leh$1@yin.interaccess.com>, gazelle@yin.interaccess.com (Kenny McCormack) writes:
> This is my thread. Of course I get to define the problem. And
> of course, I get to flame people who decide to solve some other problem in
> my thread.
Perhaps you would have received more answers of the sort you wanted if
you weren't behaving like a perfect ass.
That said, I enjoy contributing to some future maintainer's misery as
much as the next guy, so in the spirit of comradely Schadenfreude:
SOL_SOCKET SO_REUSEADDR SOCK_STREAM
Solaris 0xffff 4 2
Unixware 0xffff 4 2
WinNT 0xffff 4 1
AIX 0xffff 4 1
HP-UX 0xffff 4 1
OS/2 0xffff 4 1
MVS 0xffff 4 1
Linux 1 2 1
(My AS/400s are down at the moment, or I'd check those too. Since
they're IBM stacks they probably use the same values as AIX, OS/2,
and MVS.)
I haven't bothered specifying OS versions and platforms because these
values tend not to change across releases, and this whole thing is an
exercise in unpredictable non-portability anyway.
In short, it would appear that SysV-derived stacks use 2 for
SOCK_STREAM, probably due to their XTI/TLI legacy, and Linux is
different from everyone else for the hell of it. Special-casing Linux,
Solaris, and Unixware and using the BSD-derived defaults for other
platforms should make your code work in most places, producing maximum
entertainment when it does fail.
--
Michael Wojcik michael.wojcik@merant.com
Comms Development, MERANT (block capitals are a company mandate)
Department of English, Miami University
What is it with this warm, quiet, nauseating bond between them?
-- Rumiko Takahashi, _Maison Ikkoku_, trans. Mari Morimoto, adapt. Gerard
Jones
------------------------------
Date: Thu, 01 Mar 2001 16:52:06 GMT
From: Barry Margolin <barmar@genuity.net>
Subject: Re: How are SOL_SOCKET and SO_REUSEADDR defined in various flavors of Unix?
Message-Id: <W6vn6.12$_47.4788@burlma1-snr2>
In article <97lps9$5ih$1@yin.interaccess.com>,
Kenny McCormack <gazelle@interaccess.com> wrote:
>This is a reasonable suggestion, and I have considered it. My original
>point in posting was to find out if there was sufficient variation among the
>various Unixes (specifically, those beyond Linux and Solaris) to justify the
>effort.
It sounds like there are basically two varieties, Bsd-style (SOCK_STREAM=1)
and SVR4-style (SOCK_STREAM=2). Perhaps your script could check for the
existence of some file that would only exist in one dialect.
--
Barry Margolin, barmar@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
------------------------------
Date: 1 Mar 2001 12:02:23 -0600
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: How are SOL_SOCKET and SO_REUSEADDR defined in various flavors of Unix?
Message-Id: <97m2rf$7gd$1@yin.interaccess.com>
In article <W6vn6.12$_47.4788@burlma1-snr2>,
Barry Margolin <barmar@genuity.net> wrote:
>In article <97lps9$5ih$1@yin.interaccess.com>,
>Kenny McCormack <gazelle@interaccess.com> wrote:
>>This is a reasonable suggestion, and I have considered it. My original
>>point in posting was to find out if there was sufficient variation among the
>>various Unixes (specifically, those beyond Linux and Solaris) to justify the
>>effort.
>
>It sounds like there are basically two varieties, Bsd-style (SOCK_STREAM=1)
>and SVR4-style (SOCK_STREAM=2). Perhaps your script could check for the
>existence of some file that would only exist in one dialect.
Right - I had pretty much convinced myself that such was the case for
SOCK_STREAM (and can live with hard-coding it to be one or the other).
However, the main point of *this* thread was in regards to SOL_SOCKET and
SO_REUSEADDR - I've been trying to determine if those two follow the same
basic model as does SOCK_STREAM - i.e., that there is a BSD way and an SVR4
way and most, if not all, Unixes will fall into one of these two camps.
So far, the evidence seems to support that assumption.
------------------------------
Date: Thu, 01 Mar 2001 13:04:31 -0500
From: Don <don@lclcan.com>
Subject: How do I DROP a table using XBase module
Message-Id: <3A9E8F2F.8065A723@lclcan.com>
Hi,
I am using the XBase module. I need to create a table each time my
script is run. If the table exists, it should be overwritten. My code
for creating is:
my $newtable = XBase->create("name" => "copy.dbf",
"field_names" => [ "ID", "MSG" ],
"field_types" => [ "N", "C" ],
"field_lengths" => [ 6, 40 ],
"field_decimals" => [ 0, undef ]);
However, the docs state that the above statement will NOT overwrite if
it already exists. It then states that the table must be DROPPED first
via the "drop" method. Unfortunately, the docs don't state how to use
it nor is there an example.
I've tried various ways but have gotten errors. Does anyone know the
syntax?
Thanks,
Don
------------------------------
Date: Thu, 01 Mar 2001 11:38:06 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Perl Mongers Required in Chicago!
Message-Id: <comdog-FE07C7.11380601032001@news.panix.com>
In article <97lnib$3162$1@newssvr05-en0.news.prodigy.com>, "Natasha
Manning" <RTASHA@prodigy.net> wrote:
> Dear Consultant
> Our client in Downtown Chicago has an
> immediate need for
> several Perl Developers (GURU Level).
please don't use the Perl Mongers name in connection with a
commercial venture without permission.
--
brian d foy <comdog@panix.com>
------------------------------
Date: Thu, 01 Mar 2001 16:51:27 +0000
From: Tom Scheper <tom@power.net.uk>
Subject: Re: Perl Mongers Required in Chicago!
Message-Id: <3fvs9t0ot62h4bim5r55dhf25bgtlvqrlr@4ax.com>
>Getting I.T Done Right
>The First Time
My goodness, with a clever pun line like that, they *must* be leading
IT developers.
-=Cornelis
------------------------------
Date: Thu, 01 Mar 2001 18:34:50 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: perl thread woes..
Message-Id: <eDwn6.4843$Ok4.700431@news1.rdc1.ct.home.com>
Morgan Freeman <mjf@efortress.com> wrote:
> I am having some difficulty making perl threads work right for me.
> I have a list of websites that I want to retrieve information from
> in parallel, so that no matter the order called, the fastest
> website would return its data first.
I hope you have the permission of the folks running the websites. Doing
thigns this way is, besides being wasteful, likely to make your own
results run slower.
> So I wrote a test program, trying to create a new thread for each
> site, where I use LWP to retrieve the website, when I get the
> response object back, I want to return it so it can be passed
> on to another sub for parsing and processing. So In theory, I thought
> that the fastest sites would return first if they finished, but
> in practice, all the sites were accessed seriallly, the first site in the
> list returned first, and the last site in the list returned last.
Then you're likely doing something wrong. Without code there's no way
to tell what.
Dan
------------------------------
Date: 01 Mar 2001 17:44:47 +0000
From: nobull@mail.com
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <u9n1b5o034.fsf@wcl-l.bham.ac.uk>
"Parrot" <parrot0123@yahoo.ca> writes jeopary-style. I do not know if
this is due to ignorance, lazyness, stupidity or a positive desire to
cause offence. Perhaps he'd like to enlighten us.
> > > Is there something I have to do so that I'll be able to use cookies? Is
> > > there something that says that cookies can't be set from your local
> > >server?
> >
> > That kind of questions are usually better answered in one of the
> > comp.infosystems.www.servers.* groups. They're not perl-related.
> >
> > You mean, your browser doesn't accept cookies. That's because the
> > hostname of your local machine doesn't match the hostname given in the
> > code that sets cookies.
> Okay, but I don't have a domain name. I'm using the server mostly for
> testing purposes right now, there's no reason to go to the expense of
> getting one. What should I use as a host name? I've tried localhost, as
> well as the IP address. Neither of them work.
Use anything you like so long as it's got at least 2 dots in it. Just
make sure that the web server is configured to belive this is its
server name and that the resolver on the client is configured to
believe this name corresponds to the IP address of the server.
As has been pointed out this has nothing whatever to do with Perl so
please stop asking about it here.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
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 V10 Issue 388
**************************************