[18880] in Perl-Users-Digest
Perl-Users Digest, Issue: 1048 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 3 18:05:52 2001
Date: Sun, 3 Jun 2001 15:05:11 -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: <991605911-v10-i1048@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 3 Jun 2001 Volume: 10 Number: 1048
Today's topics:
Re: FAQ 5.5: How can I manipulate fixed-record-length <goldbb2@earthlink.net>
Re: FAQ 5.6: How can I make a filehandle local to a s <goldbb2@earthlink.net>
Re: Flame Target <todd@designsouth.net>
Re: Flame Target <comdog@panix.com>
Re: Flame Target <todd@designsouth.net>
Re: Flame Target <bart.lateur@skynet.be>
Re: Flame Target <comdog@panix.com>
Re: Flame Target <godzilla@stomp.stomp.tokyo>
Re: Flame Target <comdog@panix.com>
Re: Flame Target <godzilla@stomp.stomp.tokyo>
Re: Flame Target <comdog@panix.com>
Re: Flame Target <godzilla@stomp.stomp.tokyo>
Re: Halting a program? <muddycat@hotmail.com>
Re: How to filter out swearwords? Link to your site rew <james@NOSPAMPLEASEthesinner.co.uk>
Re: How to filter out swearwords? Link to your site rew <godzilla@stomp.stomp.tokyo>
Re: How to filter out swearwords? Link to your site rew <der.prinz@gmx.net>
How to force CPAN installation configuration <timster@worldnet.att.net>
Re: IPC:Shareable vs mod_perl ipcs not dying (Konstantinos Agouros)
Re: Learning perl - llama book (Randal L. Schwartz)
Re: Learning perl - llama book <temp1@williamc.com>
Re: Learning perl - llama book <comdog@panix.com>
Re: Learning perl - llama book <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 03 Jun 2001 15:05:22 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: FAQ 5.5: How can I manipulate fixed-record-length files?
Message-Id: <3B1A8A72.8CD869E6@earthlink.net>
PerlFAQ Server wrote:
>
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
>
> +
> How can I manipulate fixed-record-length files?
>
> The most efficient way is using pack() and unpack(). This is faster than
> using substr() when taking many, many strings. It is slower for just a
> few.
>
> Here is a sample chunk of code to break up and put back together again
> some fixed-format input lines, in this case from the output of a normal,
> Berkeley-style ps:
>
> # sample input line:
> # 15158 p5 T 0:00 perl /home/tchrist/scripts/now-what
> $PS_T = 'A6 A4 A7 A5 A*';
> open(PS, "ps|");
> print scalar <PS>;
> while (<PS>) {
> ($pid, $tt, $stat, $time, $command) = unpack($PS_T, $_);
> for $var (qw!pid tt stat time command!) {
> print "$var: <$$var>\n";
> }
> print 'line=', pack($PS_T, $pid, $tt, $stat, $time, $command),
> "\n";
> }
>
> We've used "$$var" in a way that forbidden by "use strict 'refs'". That
> is, we've promoted a string to a scalar variable reference using
> symbolic references. This is ok in small programs, but doesn't scale
> well. It also only works on global variables, not lexicals.
Not only doesn't it scale well, but it's a bad habit to get into -- you
should almost never use symbolic references, when there are other ways
to do what you want.
our ($PS_T) = 'A6 A4 A7 A5 A*';
our (@PS_N) = qw!pid tt stat time command!;
{
open(my $ps, "ps|");
print scalar <$ps>;
while (<$ps>) {
my @ps = unpack $PS_T, $_;
for my $i (0 .. $#PS_N) {
print "$PS_N[$i]: <$ps[i]>\n";
}
print 'line=', pack($PS_T, @ps), "\n";
}
}
Here I've eliminated the variables ($pid, $tt, $stat, $time, $command)
which were never really needed in the first place, and changed
everything which was global, but didn't need to be, into a lexical.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 03 Jun 2001 17:22:08 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: FAQ 5.6: How can I make a filehandle local to a subroutine? How do I pass filehandles between subroutines? How do I make an array of filehandles?
Message-Id: <3B1AAA7F.7CD3C728@earthlink.net>
PerlFAQ Server wrote:
>
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
>
> +
> How can I make a filehandle local to a subroutine? How do I pass filehandles between subroutines? How do I make an array of filehandles?
>
> The fastest, simplest, and most direct way is to localize the typeglob
> of the filehandle in question:
>
> local *TmpHandle;
>
> Typeglobs are fast (especially compared with the alternatives) and
> reasonably easy to use, but they also have one subtle drawback. If you
> had, for example, a function named TmpHandle(), or a variable named
> %TmpHandle, you just hid it from yourself.
>
> sub findme {
> local *HostFile;
> open(HostFile, "</etc/hosts") or die "no /etc/hosts: $!";
> local $_; # <- VERY IMPORTANT
> while (<HostFile>) {
> print if /\b127\.(0\.0\.)?1\b/;
> }
> # *HostFile automatically closes/disappears here
> }
>
> Here's how to use typeglobs in a loop to open and store a bunch of
> filehandles. We'll use as values of the hash an ordered pair to make it
> easy to sort the hash in insertion order.
>
> @names = qw(motd termcap passwd hosts);
> my $i = 0;
> foreach $filename (@names) {
> local *FH;
> open(FH, "/etc/$filename") || die "$filename: $!";
> $file{$filename} = [ $i++, *FH ];
> }
>
> # Using the filehandles in the array
> foreach $name (sort { $file{$a}[0] <=> $file{$b}[0] } keys %file) {
> my $fh = $file{$name}[1];
> my $line = <$fh>;
> print "$name $. $line";
> }
>
> For passing filehandles to functions, the easiest way is to preface them
> with a star, as in func(*STDIN). See the section on "Passing
> Filehandles" in the perlfaq7 manpage for details.
>
> If you want to create many anonymous handles, you should check out the
> Symbol, FileHandle, or IO::Handle (etc.) modules. Here's the equivalent
> code with Symbol::gensym, which is reasonably light-weight:
>
> foreach $filename (@names) {
> use Symbol;
> my $fh = gensym();
> open($fh, "/etc/$filename") || die "open /etc/$filename: $!";
> $file{$filename} = [ $i++, $fh ];
> }
There should be a mention that we can get something very similar to the
above behaviour without loading the Symbol module, using the following
syntax:
foreach $filename (@names) {
my $fh = do { local *FH };
open($fh, "/etc/$filename") or die "open /etc/$filename: $!";
$file{$filename} = [ $i++, $fh ];
}
There should also be a mention that open will perform autovivification
when necessary.
foreach $filename (@names) {
open(my $fh, "/etc/$filename") or die "open /etc/$filename: $!";
$file{$filename} = [ $i++, $fh ];
}
> Here's using the semi-object-oriented FileHandle module, which certainly
> isn't light-weight:
>
> use FileHandle;
>
> foreach $filename (@names) {
> my $fh = FileHandle->new("/etc/$filename") or die "$filename: $!";
> $file{$filename} = [ $i++, $fh ];
> }
There should also be a mention of extracting just the IO portion of the
glob. This may sound a bit odd, so here's an example:
foreach $filename (@names) {
open(my $fh, "/etc/$filename") or die "open /etc/$filename: $!";
$file{$filename} = [ $i++, *{$fh}{IO} ];
}
Now we're storing in our array not a glob, but an IO reference which has
been blessed to the IO::Handle package. Note that new instances of
IO::Handle or IO::File return glob references, not io references. Huh?
$ perl -e 'open $x,"/"; $x=*{$x}{IO}; print $x,"\n";'
IO::Handle=IO(0x80ea550)
$ perl -mIO::Handle -e 'print IO::Handle->new(),"\n";'
IO::Handle=GLOB(0x80ea640)
This may have a minor advantage in terms of amount of space used.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Sun, 03 Jun 2001 17:31:30 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Flame Target
Message-Id: <SvuS6.105592$I5.24731398@news1.rdc1.tn.home.com>
"John R Ramsden" <jr@redmink.demon.co.uk> wrote in message
news:3b1a13bb.16532864@news.demon.co.uk...
> brian d foy <comdog@panix.com> wrote:
> >
> > "Joseph André" <msoftmonkeySPAM@crosswinds.net> wrote:
> > >
> > > print <<END;
> > >
> > > Content-Type: text/html\n\n
> >
> > what's that extra line doing there?
>
> I think it has to be there. I can't check, as my O'Reilly Perl books
> are at work. But I'm sure one of them mentions that most browsers
> (in fact the HTML standard) demand a blank line near the start of
> an HTML script, after the Content-type line if I'm not mistaken.
>
Headers need a newline to separate them from the other headers. If you send
2 newlines, that tells the browser that the headers have stopped.
print "Location: $url\n\n"; or
print "Content-type: text/html\n\n";
-todd
------------------------------
Date: Sun, 03 Jun 2001 14:29:45 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Flame Target
Message-Id: <comdog-E4F081.14294503062001@news.panix.com>
In article <SvuS6.105592$I5.24731398@news1.rdc1.tn.home.com>, "Todd
Smith" <todd@designsouth.net> wrote:
> "John R Ramsden" <jr@redmink.demon.co.uk> wrote in message
> news:3b1a13bb.16532864@news.demon.co.uk...
> > brian d foy <comdog@panix.com> wrote:
> > > "Joseph André" <msoftmonkeySPAM@crosswinds.net> wrote:
> > > > print <<END;
> > > >
> > > > Content-Type: text/html\n\n
> > > what's that extra line doing there?
> > I think it has to be there. I can't check, as my O'Reilly Perl books
> > are at work. But I'm sure one of them mentions that most browsers
> > (in fact the HTML standard) demand a blank line near the start of
> > an HTML script, after the Content-type line if I'm not mistaken.
> Headers need a newline to separate them from the other headers. If you send
> 2 newlines, that tells the browser that the headers have stopped.
or, in this case, if you send a blank line at the beginning you
get the same effect.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sun, 03 Jun 2001 18:45:00 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Flame Target
Message-Id: <MAvS6.105747$I5.24815031@news1.rdc1.tn.home.com>
"brian d foy" <comdog@panix.com> wrote :
> or, in this case, if you send a blank line at the beginning you
> get the same effect.
>
I was wondering, in what situation would you want to end the headers early?
I can't think of a time where you _could_ print headers, but aren't
_required_ to.
-todd
------------------------------
Date: Sun, 03 Jun 2001 19:05:05 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Flame Target
Message-Id: <jg2lhtkhjcfl90of20feq0oi15033vjqkn@4ax.com>
John R Ramsden wrote:
>> > print <<END;
>> >
>> > Content-Type: text/html\n\n
>>
>> what's that extra line doing there?
>
>I think it has to be there. I can't check, as my O'Reilly Perl books
>are at work. But I'm sure one of them mentions that most browsers
>(in fact the HTML standard) demand a blank line near the start of
>an HTML script, after the Content-type line if I'm not mistaken.
AFTER the header(s). In fact, that blank line indicates "end of headers"
and "start of content".
(Actually It's the CGI standard, based on the HTTP standard, in itself
baid on the e-mail format.)
--
Bart.
------------------------------
Date: Sun, 03 Jun 2001 15:23:55 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Flame Target
Message-Id: <comdog-9B0633.15235503062001@news.panix.com>
In article <MAvS6.105747$I5.24815031@news1.rdc1.tn.home.com>, "Todd
Smith" <todd@designsouth.net> wrote:
> "brian d foy" <comdog@panix.com> wrote :
> > or, in this case, if you send a blank line at the beginning you
> > get the same effect.
> >
> I was wondering, in what situation would you want to end the headers early?
> I can't think of a time where you _could_ print headers, but aren't
> _required_ to.
there isn't any situation. :)
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sun, 03 Jun 2001 12:44:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Flame Target
Message-Id: <3B1A93B6.2390B3EC@stomp.stomp.tokyo>
brian d foy wrote:
> Todd Smith wrote:
> > brian d boy wrote :
> > > or, in this case, if you send a blank line at the beginning you
> > > get the same effect.
> > I was wondering, in what situation would you want to end the headers early?
> > I can't think of a time where you _could_ print headers, but aren't
> > _required_ to.
> there isn't any situation. :)
A script called by Server Side Includes does not require
header prints although you can if you wish to conform to
standard operating procedures. Without at least a print
of content-type, a SSI called script will generate a typical
premature end of headers error log entry but yet returns
data correctly to a page employing a SSI call.
Godzilla!
------------------------------
Date: Sun, 03 Jun 2001 15:48:35 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Flame Target
Message-Id: <comdog-D0E378.15483503062001@news.panix.com>
In article <3B1A93B6.2390B3EC@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
> brian d foy wrote:
>
> > Todd Smith wrote:
>
> > > brian d boy wrote :
>
> > > > or, in this case, if you send a blank line at the beginning you
> > > > get the same effect.
>
> > > I was wondering, in what situation would you want to end the headers early?
> > > I can't think of a time where you _could_ print headers, but aren't
> > > _required_ to.
>
> > there isn't any situation. :)
> A script called by Server Side Includes does not require
> header prints although you can if you wish to conform to
> standard operating procedures.
SSIs are not necessarily CGI scripts, but the ones that are
expect headers. see the SSI documentation for your server
for more details.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sun, 03 Jun 2001 13:41:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Flame Target
Message-Id: <3B1AA0E6.67088C71@stomp.stomp.tokyo>
brian d foy wrote:
> Godzilla! wrote:
> > brian d boy wrote:
> > > Todd Smith wrote:
> > > > brian d boy wrote :
> > > > > or, in this case, if you send a blank line at the beginning you
> > > > > get the same effect.
> > > > I was wondering, in what situation would you want to end the headers early?
> > > > I can't think of a time where you _could_ print headers, but aren't
> > > > _required_ to.
> > > there isn't any situation. :)
> > A script called by Server Side Includes does not require
> > header prints although you can if you wish to conform to
> > standard operating procedures.
( unnoted snippage by d foy - context changed )
> SSIs are not necessarily CGI scripts, but the ones that are
> expect headers. see the SSI documentation for your server
> for more details.
Doesn't matter if a SSI called script is a typical .cgi script.
Without at least a partial header print, an error log entry will
be generated, at least under an Apache server. Nonetheless,
data is returned correctly. For these circumstances, all
header prints can be excluded without effecting operation.
Test this if you wish to observe this behavior.
Godzilla!
------------------------------
Date: Sun, 03 Jun 2001 16:51:06 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Flame Target
Message-Id: <comdog-65C8E8.16510603062001@news.panix.com>
In article <3B1AA0E6.67088C71@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
> Doesn't matter if a SSI called script is a typical .cgi script.
> Without at least a partial header print, an error log entry will
> be generated, at least under an Apache server. Nonetheless,
> data is returned correctly. For these circumstances, all
> header prints can be excluded without effecting operation.
please seee the documentation. you are obviously mistaken.
http://www.apache.org/docs-2.0/mod/mod_include.html
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sun, 03 Jun 2001 14:55:58 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Flame Target
Message-Id: <3B1AB26E.2DF9AA0E@stomp.stomp.tokyo>
brian d foy wrote:
> Godzilla! wrote:
(significant unnoted snippage by d foy - attributes missing - context changed)
> > Doesn't matter if a SSI called script is a typical .cgi script.
> > Without at least a partial header print, an error log entry will
> > be generated, at least under an Apache server. Nonetheless,
> > data is returned correctly. For these circumstances, all
> > header prints can be excluded without effecting operation.
> please seee the documentation. you are obviously mistaken.
> http://www.apache.org/docs-2.0/mod/mod_include.html
Ahh... casting blame on another! I don't need to "seee"
this document. I know its essentials by heart and, it is
not related to using or not using header content for a
SSI called cgi script.
Is there a problem you cannot test what I have said
under an Apache server? You know I have! My habit is
to deal with reality rather than regurgitate RTFM
documentation garbage.
Po' boy. Did big bad ass ignorant Kira catch you with
your technological pants down? You can dish it out
but you sure can't take it.
I can, with grace even under fire.
Godzilla!
------------------------------
Date: Sun, 3 Jun 2001 19:32:41 +0100
From: "Muddy Cat" <muddycat@hotmail.com>
Subject: Re: Halting a program?
Message-Id: <thl0k99egr2d63@corp.supernews.co.uk>
"AlyM" <alastairmurray@hotmail.com> wrote in message
news:0FNR6.20514$zb7.2652184@news1.cableinet.net...
> In article <thf7ie76cucc96@corp.supernews.co.uk>, "Muddy Cat"
> <muddycat@hotmail.com> said:
> <snip>
> > Apologies if this is a lame question!
>
> There are no lame questions, just lame people. Did you learn "PERL" from
> a nice big book with "BECOME AN EXPERT PERL PROGRAMMER IN 23 SECONDS!!!"
> on the front by any chance?
As I said in the original message, I've been picking up what I've had to to
get by. I have no intention of "learning" PERL, perl or Perl, I was simply
trying to get something to work. Thanks for your *really* constructive input
though, that helped a lot and was well worth you contributing.
------------------------------
Date: Sun, 3 Jun 2001 17:19:11 +0100
From: "James" <james@NOSPAMPLEASEthesinner.co.uk>
Subject: Re: How to filter out swearwords? Link to your site reward!
Message-Id: <9fdo8f$nok$1@phys-ma.sol.co.uk>
Hmmmm, theres always a way around this kind of thing and always swear words
out there you haven't heard off. And you don't have to swear to shock
someone.
I guess that from you filtering out swear words that you sight is meant to
be suitable for kids? Hmmmm, I think if that is the case the only way
forward is for you to check every submittion before it is posted. (And if it
is adults, why you worried about swear words? Come to think of it, what are
you doing teaching kids pick up lines? :-)
For the last year, I have run a student website for my university where
comments and messages where posted straight to the web. You would not belive
what gets posted. I have had to censor sick Nazi jokes, people have
threatened to sue me twice and many more have complained. The amount of
homophobic crap especially that gets posted is staggering. This summer I am
totally rewriting my website to only allow registered users comments to
appear immeditly, and everyone elses will have to be checked by me first.
Registered users will have to confirm there ID throught univerity email
accounts; my plan is if they know that I know who they are, they will
hopefully be less insulting.
Anyway, if you want email me and I'll tell you more about my experiences.
(But I'm off on holiday, so don't expect a fast reply)
James.
"Shabooza" <robocool69@aol.com> wrote in message
news:e635ee7.0106022304.5923a59f@posting.google.com...
> I am going to have a "submit a pick up line" section on my website,
> and i was wondering how i can make a swear word filterizer? I want
> them to enter their pick up line idea into the text box, and they need
> to submit it, and lets say the word "ASS" is in there, well when the
> filterized version comes out, i want it to say "Butt" or "rear", and
> then they can submit the new filtered copy of it? So...i really need
> to get this, and i would be happy to advertise a link to your site
> from my site, if you have one.
>
> Thanks,
> Shabooza
------------------------------
Date: Sun, 03 Jun 2001 09:55:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to filter out swearwords? Link to your site reward!
Message-Id: <3B1A6C18.2B78EF8F@stomp.stomp.tokyo>
Shabooza wrote:
(snippage)
> I am going to have a "submit a pick up line" section on my website,
> and i was wondering how i can make a swear word filterizer? I want
> them to enter their pick up line idea into the text box, and they need
> to submit it, and lets say the word "ASS" is in there, well when the
> filterized version comes out, i want it to say "Butt" or "rear", and
> then they can submit the new filtered copy of it?
This issue has been addressed at length within the past
thirty to forty-five days in this newsgroup. It would be
prudent of you to review those articles.
"At the risk of making an ass of myself, would you
mind if I introduce myself?"
"Unlike many men, I did not arrive at my position in
life riding an ass."
There are two quick examples for you. Substitute in
your word "butt" or your word "rear" and, think.
Godzilla!
------------------------------
Date: Sun, 3 Jun 2001 22:17:15 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Re: How to filter out swearwords? Link to your site reward!
Message-Id: <3b1a9b1e$1@e-post.inode.at>
Shabooza <robocool69@aol.com> wrote:
> I am going to have a "submit a pick up line" section on my website,
> and i was wondering how i can make a swear word filterizer? I want
> them to enter their pick up line idea into the text box, and they need
> to submit it, and lets say the word "ASS" is in there, well when the
> filterized version comes out, i want it to say "Butt" or "rear", and
> then they can submit the new filtered copy of it?
Automatically censoring a text based on single words is not work very
well. If I really wanted to submit a dirty word, and I found that my
submission has been cleaned, I'd just keep changing the spelling and
resubmitting until my line gets through. Tricking your filter is actually
more fun than just submitting some swear words. Why don't you just
moderate the submissions, so only the approved ones get through?
Besides, if I wrote "and the ass saw the angel", it would be transformed
to "and the butt saw the angel", which is probably not what you wanted,
right? ;-)
cheers,
stefan
------------------------------
Date: Sun, 03 Jun 2001 17:41:59 GMT
From: Tim <timster@worldnet.att.net>
Subject: How to force CPAN installation configuration
Message-Id: <3B1B1EE4.5B747B7C@worldnet.att.net>
I ran "perl -MCPAN -e shell" once and it asked me a whole bunch of
questions which I just casually hit Return to accept the defaults. Now
I want to do it again with specific answers, but it doesn't ask me the
questions again. How do I force it to go through the configuration ALL
over again? On a Linux box, it created ~/.cpan/CPAN/MyConfig.....or
some such, but I couldn't figure out where it keeps that info in
Windows98. [I'd rather not use the 'o conf' command at the cpan>
prompt.]
------------------------------
Date: 3 Jun 2001 17:11:09 +0200
From: elwood@news.agouros.de (Konstantinos Agouros)
Subject: Re: IPC:Shareable vs mod_perl ipcs not dying
Message-Id: <elwood.991581035@news.agouros.de>
In <KJbS6.41168$V6.2094645@typhoon.mn.mediaone.net> "Daniel Berger" <djberg96@hotmail.com> writes:
>> >Sorry if this is a re-post. Doesn't look like my first post showed up.
>>
>> >Anyway, at the end of your program (probably within an END block), do
>> >IPC::Shareable->clean_up().
>> Would that destroy all or just the possibly temporary assigned additional
>> space? The server should keep running and should keep the rest of the
>array.
>>
>> Konstantin
>From the IPC::Shareable docs---
>"This is a class method that provokes IPC::Shareable to remove all shared
>memory segments created by the process. Segments not created by the calling
>process are not removed."
>I'm not sure if that answers your question or not. For more info, see
>http://search.cpan.org/doc/BSUGARS/IPC-Shareable-0.60/lib/IPC/Shareable.pm.
>Also note that the "clean_up()" method occasionally fails for me - about 1
>in 20 times. I realized this when I stored a sql query result in shared
>memory, changed the query completely, and got the old result back when I ran
>the new query. That was partly my fault - I should have used "$$" as the
>key to keep it unique each time I ran the program, just to make sure (ok -
>it's *possible* that I could end up using the same pid again, but at least
>I'm significantly reducing the odds).
>"clean_up_all()" has never worked for me and is broken as far as I can tell.
>If you use the same key for each shared memory segment in your array, then I
>think "clean_up" will wipe out everything. You'll have to make each key
>unique somehow, perhaps with $$.
>I've only tinkered with this a little myself so I can't be of much more use.
>Sorry.
As it seems to me it leaves me with less memory consumed... but the sql-stuff
isn't working anymore... but that's next...
Konstantin
>Regards,
>Dan
--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres
------------------------------
Date: 03 Jun 2001 09:49:22 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Learning perl - llama book
Message-Id: <m1bso5v78t.fsf@halfdome.holdit.com>
>>>>> "PropART" == PropART <temp1@williamc.com> writes:
PropART> From a non-expert... When I read the Llama several years ago I
PropART> remember taking at least 2 or 3 times as long on the regexp chapter
PropART> than the other intro chapters. But I pushed through and now feel
PropART> comfortable with basic regexps. When I re-read the chapter recently
PropART> looking for a good introduction to help someone learning JavaScript, I
PropART> found it clear and well-written - as long as the Unix examples don't
PropART> throw the newbie.
Well, you'll probably be happy to note that in the upcoming (now
announced!) 3rd edition, Tom Phoenix and I spent a lot of time
removing 90% of the previous Unix-isms, and the regular expression
section has now doubled in size, with much more accessible exercises.
print "Just another Perl [book] 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: Sun, 03 Jun 2001 17:48:14 GMT
From: PropART <temp1@williamc.com>
Subject: Re: Learning perl - llama book
Message-Id: <3B1A7831.B4711ACD@williamc.com>
"Randal L. Schwartz" wrote:
> Well, you'll probably be happy to note that in the upcoming (now
> announced!) 3rd edition, Tom Phoenix and I spent a lot of time
> removing 90% of the previous Unix-isms, and the regular expression
> section has now doubled in size, with much more accessible exercises.
I think that's good decision because learning the language is
disorienting enough for the novice, but I should also point out to
that for me the stuff in the back of the Llama (cut and pasted from
notes -> Misc. Control Structures | File Handles and File Tests |
Formats (well, maybe not formats :) ) | Directory Access | File and
Dir Manipulation | Process Management | Other Data Transformation |
System DB Access | User DB Management | Other built-in functions )
turned out to be useful too... I could have read the win32 version but
I wanted to get more exposure to Unix, and it's helped me a lot in my
current job.
Thanx Randall!
------------------------------
Date: Sun, 03 Jun 2001 14:34:59 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Learning perl - llama book
Message-Id: <comdog-942B81.14345903062001@news.panix.com>
In article <3B1A314F.D0EB6BBC@williamc.com>, PropART
<temp1@williamc.com> wrote:
> From a non-expert... When I read the Llama several years ago I
> remember taking at least 2 or 3 times as long on the regexp chapter
> than the other intro chapters. But I pushed through and now feel
> comfortable with basic regexps. When I re-read the chapter recently
> looking for a good introduction to help someone learning JavaScript, I
> found it clear and well-written - as long as the Unix examples don't
> throw the newbie.
the regex section in the next edition of the Llama, which is
about ready to be released (i have laid hands on the galleys),
has been totally reworked and tested in many classroom training
sessions over the past two years. the students that i have
taught with the new regex stuff have less questions and pick
it up easier. the unix stuff has mostly disappeared. :)
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Sun, 03 Jun 2001 19:11:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Learning perl - llama book
Message-Id: <0t2lht4rul4s3f04r8mbb5kedell6atm2l@4ax.com>
Chuck wrote:
>I am just starting into Perl and have the Llama book and the Camel
>book... I am totally stuck on "regular expressions" and just want to
>know if I should
>
>a- re-read over and over and suddenly get it
No. Try a different source. To me, Tom Christiansen's article was very
valuable.
<http://language.perl.com/all_about/regexps.html>
--
Bart.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 1048
***************************************