[25019] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 7269 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 06:07:18 2004

Date: Tue, 19 Oct 2004 03:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 19 Oct 2004     Volume: 10 Number: 7269

Today's topics:
    Re: Calling a perl script from an html doc <MrReallyVeryNice.REMOVE.NO.SPAM@Yahoo.REMOVE.NO.SPAM.com>
    Re: Calling a perl script from an html doc <ebohlman@omsdev.com>
    Re: Calling a perl script from an html doc lesley_b_linux@yahoo.co.yuk
    Re: Editable webpage code - security loopholes? <tadmc@augustmail.com>
    Re: How do I print http 404 not found header? lesley_b_linux@yahoo.co.uk
    Re: How do I print http 404 not found header? <flavell@ph.gla.ac.uk>
    Re: Lowest array value given index <ebohlman@omsdev.com>
    Re: Lowest array value given index <dha@panix.com>
    Re: Lowest array value given index <ebohlman@omsdev.com>
    Re: Lowest array value given index <abigail@abigail.nl>
    Re: Lowest array value given index (Anno Siegel)
    Re: Lowest array value given index <dha@panix.com>
    Re: options to shrink-wrap a perl script <tadmc@augustmail.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: References to an array in a foreach <ebohlman@omsdev.com>
    Re: regex to clean path (Anno Siegel)
        Regular Expression for HTML Tags and Special Characters (Marc Bogaard)
    Re: Regular Expression for HTML Tags and Special Charac <josef.moellers@fujitsu-siemens.com>
    Re: Top posting <flavell@ph.gla.ac.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 18 Oct 2004 21:12:44 -0700
From: MrReallyVeryNice <MrReallyVeryNice.REMOVE.NO.SPAM@Yahoo.REMOVE.NO.SPAM.com>
Subject: Re: Calling a perl script from an html doc
Message-Id: <u7WdnR5J-4SSCencRVn-hg@comcast.com>

Spin wrote:
> Sorry, my fault for not being explicit enough.
> 
> There is no web server. There is a file server (samba) on which the html doc
> is located. The file server has perl installed, but no web server. And
> installing a web server is not an option.

Guessing that you cannot install a web server on the samba server 
because you are not authorized to do so, you might consider installing 
the web server on your own personal machine running W2K.  Again, that 
would assume that:
  - this installation is possible ( you have administrator access to 
your own machine, right?, you have enough disk space and CPU power, right?)
  - this installation is authorized (your IT department or other 
Management would not get you in trouble if they found out that you have 
a web server).

If the above scenario is a possibility, then you could have the 'HTML 
templates/docs' saved on the samba server but the perl script processing 
done by your web server CGI.

This scenario would only be interesting if you are dealing with a small 
group of users because you might run into a load/performance issues. 
Without information about your configuration, about what 
my_perl_script_gets_my_dynamic_image.pl is supposed to do, it is 
difficult to say what other issues you would run into.

MrReallyVeryNice

> 
> Caleb
> 
> 


------------------------------

Date: 19 Oct 2004 05:46:41 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Calling a perl script from an html doc
Message-Id: <Xns95878E2A109ebohlmanomsdevcom@130.133.1.4>

"Spin" <spam@spamhotmail.com> wrote in
news:10n81aujp20bq23@corp.supernews.com: 

> There is no web server. There is a file server (samba) on which the
> html doc is located. The file server has perl installed, but no web
> server. And installing a web server is not an option.

Why, specifically, is it not an option?  Are you and whoever is in charge 
of the server both aware that it's possible (and easy) to configure a Web 
server so that it will respond *only* to requests that originate on your 
LAN, or even specific segments of your LAN, *without* making any data at 
all available over the Internet?

I have an Apache server set up on my machine.  No process running on any 
other machine is even capable of telling that it's there.


------------------------------

Date: 19 Oct 2004 09:08:48 +0100
From: lesley_b_linux@yahoo.co.yuk
Subject: Re: Calling a perl script from an html doc
Message-Id: <m3d5zft9in.fsf@helmholtz.local>

"Jürgen Exner" <jurgenex@hotmail.com> writes:

> lesley_b_linux@yahoo.co.yuk wrote:
> > While we're on the subject of CGI, I've always understood it to stand
> > for Common Gateway Interface.  From my experience the end result is
> > that some perl scripts are executed.
> 
> That is a very limited point of view. Or a very limited experience.

As I said, from my experience.  

Having read http://hoohoo.ncsa.uiuc.edu/cgi/overview.html I have improved
my knowledge.

Having shared the URL, I have given others the opportunity to understand more
about CGI and perhaps helped improve some people's expectations of what CGI.pm
can and cannot do.

> 
> > Has there ever been any other
> > language used with CGI or was CGI specifically designed to work with
> > Perl and nothing else?
> 
> OHMYGOD. You are kidding, aren't you?

Now, is that really the best you can offer this newsgroup?

Lesley






------------------------------

Date: Tue, 19 Oct 2004 00:20:46 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Editable webpage code - security loopholes?
Message-Id: <slrncn991e.3io.tadmc@magna.augustmail.com>

Duke of Hazard <squash@peoriadesignweb.com> wrote:

> It works, but what security checks do I need to perform on it? I
> realize I need to sanitize the password field, how about the textarea
> field?


If you need to "sanitize" them when using Perl, then you would
need to sanitize them when using Visual Basic or C or Java.

ie. That question is not a Perl question.

Please ask web questions in a newsgroup about the web.


>    open(F, "$file_path") ;


You should always, yes *always*, check the return value from open:

   open(F, $file_path) or die "could not open '$file_path'  $!";


See also:

   perldoc -q vars

       What's wrong with always quoting "$vars"?

Then don't use useless uses of quotes anymore.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 19 Oct 2004 09:02:53 +0100
From: lesley_b_linux@yahoo.co.uk
Subject: Re: How do I print http 404 not found header?
Message-Id: <m3hdort9si.fsf@helmholtz.local>

"Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:

> On Mon, 18 Oct 2004 lesley_b_linux@yahoo.co.yuk wrote:
> 
> > In a totally OT way : 
> > 
> > From RFC2616
> 
> RFC2616 is *not* a CGI specification.


Correct, 10 out 10, go to the top of the class :)

It does however happen to specify HTTP responses in Section 6 

However if you want a CGI specification the nearest I can offer was a URL
posted in another thread --> http://hoohoo.ncsa.uiuc.edu/cgi/overview.html

HTH

Lesley



------------------------------

Date: Tue, 19 Oct 2004 10:59:28 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: How do I print http 404 not found header?
Message-Id: <Pine.LNX.4.61.0410191047140.556@ppepc56.ph.gla.ac.uk>

On Tue, 19 Oct 2004 lesley_b_linux@yahoo.co.uk wrote:

> "Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:
> 
> > On Mon, 18 Oct 2004 lesley_b_linux@yahoo.co.yuk wrote:
> > 
> > > From RFC2616
> > 
> > RFC2616 is *not* a CGI specification.
> 
> Correct, 10 out 10, go to the top of the class :)

-Ž

> It does however happen to specify HTTP responses in Section 6 

That's not surprising, since it's the HTTP/1.1 specification.

As the relevant Perl FAQ says, at e.g
http://www.perldoc.com/perl5.8.4/pod/perlfaq9.html#What-is-the-correct-form-of-response-from-a-CGI-script-

 The similarity between CGI response headers (defined in the CGI 
 specification) and HTTP response headers (defined in the HTTP 
 specification, RFC2616) is intentional, but can sometimes be 
 confusing.

> However if you want a CGI specification the nearest I can offer was 
> a URL posted in another thread --> 
> http://hoohoo.ncsa.uiuc.edu/cgi/overview.html

Actually, I prefer the one referenced in the Perl FAQ part 9:

 Current best-practice RFC draft at: http://CGI-Spec.Golux.Com/

although it never does seem to have quite made it to the 
originally-mooted RFC status.  Maybe the IETF don't really consider 
the CGI interface to be in their parish, but Ken did an excellent 
piece of work in collating a best-practice specification, and it seems 
to me that it's the best that we've got (the NCSA spec is rather 
informal, and leaves many questions unanswered).

> HTH

U2.  :-}



------------------------------

Date: 19 Oct 2004 04:43:03 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Lowest array value given index
Message-Id: <Xns9586F23CDE6DEebohlmanomsdevcom@130.133.1.4>

"David H. Adler" <dha@panix.com> wrote in 
news:slrncn0b8v.t1k.dha@panix2.panix.com:

> Something along the lines of 
> 
>     $result = find_lowest_element(@array[$index..$#array])
> 
> should solve part of your problem.
> 
> [benchmarks]
> 
> Holy moley!
> 
>     Benchmark: timing 500000 iterations of slice, splice...
>          slice: 351 wallclock secs (183.32 usr + 1.25 sys = 184.57 CPU)
>          @ 2709.00/s (n=500000)
> 
>          splice: 2 wallclock secs ( 0.37 usr + 0.02 sys = 0.39 CPU) @
>          1282051.28/s (n=500000)
> 
> Ok, *don't* do that.
> 
>         $result = find_lowest_element(splice @array, $index);

Er, I think the reason it's running so fast is that it isn't doing what it 
ought to.  That's the equivalent of:

@array=@array[0..$index-1];
$result=find_lowest_element(@array);

So you're looking only at elements *before* $index, contrary to the OP's 
spec, *and* you're truncating @array to the number of elements given by the 
smallest value of $index, which was probably one of the first ones used (if 
your test code was refreshing @array on each iteration, then ignore my 
second clause).


------------------------------

Date: Tue, 19 Oct 2004 05:20:32 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Lowest array value given index
Message-Id: <slrncn9910.ice.dha@panix2.panix.com>

On 2004-10-19, Eric Bohlman <ebohlman@omsdev.com> wrote:
> "David H. Adler" <dha@panix.com> wrote in 
> news:slrncn0b8v.t1k.dha@panix2.panix.com:
>
>> Something along the lines of 
>> 
>>     $result = find_lowest_element(@array[$index..$#array])
>> 
>> should solve part of your problem.
>> 
>> [benchmarks]
>> 
>> Holy moley!
>> 
>>     Benchmark: timing 500000 iterations of slice, splice...
>>          slice: 351 wallclock secs (183.32 usr + 1.25 sys = 184.57 CPU)
>>          @ 2709.00/s (n=500000)
>> 
>>          splice: 2 wallclock secs ( 0.37 usr + 0.02 sys = 0.39 CPU) @
>>          1282051.28/s (n=500000)
>> 
>> Ok, *don't* do that.
>> 
>>         $result = find_lowest_element(splice @array, $index);
>
> Er, I think the reason it's running so fast is that it isn't doing what it 
> ought to.  That's the equivalent of:
>
> @array=@array[0..$index-1];
> $result=find_lowest_element(@array);
>
> So you're looking only at elements *before* $index, contrary to the OP's 
> spec, *and* you're truncating @array to the number of elements given by the 
> smallest value of $index, which was probably one of the first ones used (if 
> your test code was refreshing @array on each iteration, then ignore my 
> second clause).

Hm.  Perhaps I'm confused, but how do you get that?

My code for those benchmarks was:

	my @init = (1..1000);
	
	timethese( shift || 10000,
	        { slice => sub {my @array = @init[30..1000];},
		  splice => sub {my @array = splice @init, 30;}
		});

So I'm not sure how you're getting a range of [0..$index-1];

In any case, I just noticed a slight oddity.  if I change the slice code
to 

	sub {my @array = @init[30..-1];}

we get this benchmark:

	Benchmark: timing 1000000 iterations of slice, splice...
	     slice:  1 wallclock secs ( 0.64 usr +  0.03 sys =  0.67 CPU)
	    	 @ 1492537.31/s (n=1000000)
	     splice:  0 wallclock secs ( 0.70 usr +  0.01 sys = 0.71 CPU)
	    	 @ 1408450.70/s (n=1000000)

Is it me or is that just odd?

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Perl Porters, Inc. today announced the release of version .006 of
their popular Perl5 compiler suite, codenamed `Rabid Rat'."
	- Nathan Torkington on p5p (this was a *joke*)


------------------------------

Date: 19 Oct 2004 06:07:16 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Lowest array value given index
Message-Id: <Xns9587C5FB918Cebohlmanomsdevcom@130.133.1.4>

"David H. Adler" <dha@panix.com> wrote in
news:slrncn9910.ice.dha@panix2.panix.com: 

> On 2004-10-19, Eric Bohlman <ebohlman@omsdev.com> wrote:
>> So you're looking only at elements *before* $index, contrary to the
>> OP's spec, *and* you're truncating @array to the number of elements
>> given by the smallest value of $index, which was probably one of the
>> first ones used (if your test code was refreshing @array on each
>> iteration, then ignore my second clause).
> 
> Hm.  Perhaps I'm confused, but how do you get that?
> 
> My code for those benchmarks was:
> 
>      my @init = (1..1000);
>      
>      timethese( shift || 10000,
>              { slice => sub {my @array = @init[30..1000];},
>             splice => sub {my @array = splice @init, 30;}
>           });
> 
> So I'm not sure how you're getting a range of [0..$index-1];

I had forgotten that splice() returns the *removed* elements rather than 
the remaining ones (actually *reading*, rather than *skimming*, the docs 
for splice() cleared that up).  However, there's still a problem.  After 
the first iteration, splice() will have truncated @init to 30 elements and 
will return an empty list on subsequent iterations.


------------------------------

Date: 19 Oct 2004 07:28:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Lowest array value given index
Message-Id: <slrncn9ghf.img.abigail@alexandra.abigail.nl>

David H. Adler (dha@panix.com) wrote on MMMMLXVII September MCMXCIII in
<URL:news:slrncn9910.ice.dha@panix2.panix.com>:
##  
##  My code for those benchmarks was:
##  
##  	my @init = (1..1000);
##  	
##  	timethese( shift || 10000,
##  	        { slice => sub {my @array = @init[30..1000];},
##  		  splice => sub {my @array = splice @init, 30;}
##  		});


Ah, I see you missed my talk at YAPC. ;-) After a few iterations, 
you have spliced all elements from @init, making @init an empty
array. So, your benchmark proves that splicing from an empty
array is a lot faster than copying 970 elements.

Which isn't a big surprise to me.

##  
##  So I'm not sure how you're getting a range of [0..$index-1];
##  
##  In any case, I just noticed a slight oddity.  if I change the slice code
##  to 
##  
##  	sub {my @array = @init[30..-1];}

That doesn't do what you want either. 30 .. -1 contains all the integers
that are at least 30, and at most -1. Which is none. So all

    my @array = @init [30 .. -1];

is doing is creating an empty array.

##  we get this benchmark:
##  
##  	Benchmark: timing 1000000 iterations of slice, splice...
##  	     slice:  1 wallclock secs ( 0.64 usr +  0.03 sys =  0.67 CPU)
##  	    	 @ 1492537.31/s (n=1000000)
##  	     splice:  0 wallclock secs ( 0.70 usr +  0.01 sys = 0.71 CPU)
##  	    	 @ 1408450.70/s (n=1000000)
##  
##  Is it me or is that just odd?


It's you ;-)


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


------------------------------

Date: 19 Oct 2004 07:33:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Lowest array value given index
Message-Id: <cl2g0n$rhm$1@mamenchi.zrz.TU-Berlin.DE>

David H. Adler <dha@panix.com> wrote in comp.lang.perl.misc:
> On 2004-10-19, Eric Bohlman <ebohlman@omsdev.com> wrote:
> > "David H. Adler" <dha@panix.com> wrote in 
> > news:slrncn0b8v.t1k.dha@panix2.panix.com:
> >
> >> Something along the lines of 
> >> 
> >>     $result = find_lowest_element(@array[$index..$#array])
> >> 
> >> should solve part of your problem.
> >> 
> >> [benchmarks]
> >> 
> >> Holy moley!
> >> 
> >>     Benchmark: timing 500000 iterations of slice, splice...
> >>          slice: 351 wallclock secs (183.32 usr + 1.25 sys = 184.57 CPU)
> >>          @ 2709.00/s (n=500000)
> >> 
> >>          splice: 2 wallclock secs ( 0.37 usr + 0.02 sys = 0.39 CPU) @
> >>          1282051.28/s (n=500000)
> >> 
> >> Ok, *don't* do that.
> >> 
> >>         $result = find_lowest_element(splice @array, $index);
> >
> > Er, I think the reason it's running so fast is that it isn't doing what it 
> > ought to.  That's the equivalent of:
> >
> > @array=@array[0..$index-1];
> > $result=find_lowest_element(@array);
> >
> > So you're looking only at elements *before* $index, contrary to the OP's 
> > spec, *and* you're truncating @array to the number of elements given by the 
> > smallest value of $index, which was probably one of the first ones used (if 
> > your test code was refreshing @array on each iteration, then ignore my 
> > second clause).
> 
> Hm.  Perhaps I'm confused, but how do you get that?
> 
> My code for those benchmarks was:
> 
> 	my @init = (1..1000);
> 	
> 	timethese( shift || 10000,
> 	        { slice => sub {my @array = @init[30..1000];},
> 		  splice => sub {my @array = splice @init, 30;}
> 		});
> 
> So I'm not sure how you're getting a range of [0..$index-1];

No, but splice will consume @init after a few rounds and do nothing
after that.  Depending on which will run first, slice will see an
empty array or not.

> In any case, I just noticed a slight oddity.  if I change the slice code
> to 
> 
> 	sub {my @array = @init[30..-1];}

Well, that makes sure that slice doesn't do nothing in either case.
I think you want "@init[30 .. $#init]".

For a real benchmark one would have to reset @init before each run
(Results slightly edited):

my @supply = (1..1000);

timethese( shift || -3, {
          slice => sub {my @init = @supply; my @array = @init[30..-1];},
          splice => sub {my @init = @supply; my @array = splice @init, 30;},
          null   => sub { my @init = @supply },
    },
);

Benchmark: running null, slice, splice for at least 3 CPU seconds...
      null:  3 wallclock secs ( 3.19 CPU) @ 181.82/s (n=580)
     slice:  3 wallclock secs ( 3.20 CPU) @ 177.81/s (n=569)
    splice:  4 wallclock secs ( 3.17 CPU) @ 85.80/s (n=272)

That is as expected, but the results for "null" show that most of
the time in slice is spent in the array assignment.

Anno


------------------------------

Date: Tue, 19 Oct 2004 07:50:21 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Lowest array value given index
Message-Id: <slrncn9hpt.51g.dha@panix2.panix.com>

On 2004-10-19, Abigail <abigail@abigail.nl> wrote:
> David H. Adler (dha@panix.com) wrote on MMMMLXVII September MCMXCIII in

[snip lots of benchmarking in odd directions]

> ##  Is it me or is that just odd?
>
>
> It's you ;-)

Yes.  Yes it is.  Time for sleep I think.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
I'd redesign my program to something less absurd.
    - Abigail, in comp.lang.perl.misc


------------------------------

Date: Tue, 19 Oct 2004 00:14:00 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: options to shrink-wrap a perl script
Message-Id: <slrncn98ko.3io.tadmc@magna.augustmail.com>

dan baker <botfood@yahoo.com> wrote:


> wow, what a passive-aggressive bunch! excuse me for not being a mind
> reader. 


Excuse me for never reading any more of your posts.

*plonk*


> doesn't occur to YOU that something like


typing "perl PAR" into the little box at www.google.com finds it
just fine.

Do you want us to hold your hand?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 19 Oct 2004 07:22:20 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <4174c0ab$0$6877$8b463f8a@news.nationwide.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



------------------------------

Date: 19 Oct 2004 04:29:20 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: References to an array in a foreach
Message-Id: <Xns9586EFE9CC8B6ebohlmanomsdevcom@130.133.1.4>

"David H. Adler" <dha@panix.com> wrote in 
news:slrncmu6j3.206.dha@panix2.panix.com:

> On 2004-10-14, A. Sinan Unur <usa1@llenroc.ude.invalid> wrote:
>>
>> What you really want to use is a hash for animals
> 
> Really, this sounds like something the SPCA might come after you for...
>:-)

I could see them objecting to a hash *of* animals, but what would worry 
them about a hash *for* animals? :)


------------------------------

Date: 19 Oct 2004 09:46:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regex to clean path
Message-Id: <cl2nq4$2pq$1@mamenchi.zrz.TU-Berlin.DE>

Jon Ericson  <Jon.Ericson@jpl.nasa.gov> wrote in comp.lang.perl.misc:
> "Yuri Shtil" <yshtil@synopsys.com> writes:
> 
> > I need to clean the PATH variable from redundant entries:
> >
> > a:b:c:c:c:s:a
> > should become a:b:v:s.
> 
> I think you meant a:b:c:s.
> 
> > I have written a few line script that does it using hash.
> >
> > Does anybody know an elegant oneliner using regex?
> 
> $ perl -e '%h = map {$_ => 1} split(/:/, "a:b:c:c:c:s:a");\
>   print join(":", sort keys %h), "\n"'
> 
> Finding the regex is left as an exercise for the reader. ;-)  Sorting
> alphabeticaly might not be what you want.

Indeed.  The sequence of path elements is significant, so they should
appear in the cleaned-up path in the same order they had in the original.

Anno


------------------------------

Date: 18 Oct 2004 23:51:11 -0700
From: marc.bogaard@gmx.de (Marc Bogaard)
Subject: Regular Expression for HTML Tags and Special Characters
Message-Id: <d7f1659a.0410182251.63942d4d@posting.google.com>

Hello together!

How can I allowed some HTML-Tags like <BR>, <B>, <P> but
filter out <, >, when they stand alone? 

Must be something like: "^[A-Za-Z0-9\>\<]+$"
for the < and >, but where do i have to put in my tags?


thank you in advance
marc van den Bogaard


------------------------------

Date: Tue, 19 Oct 2004 10:14:35 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regular Expression for HTML Tags and Special Characters
Message-Id: <cl2i8e$lsj$1@nntp.fujitsu-siemens.com>

Marc Bogaard wrote:
> Hello together!
>=20
> How can I allowed some HTML-Tags like <BR>, <B>, <P> but
> filter out <, >, when they stand alone?=20
>=20
> Must be something like: "^[A-Za-Z0-9\>\<]+$"
> for the < and >, but where do i have to put in my tags?

how about "<[a-zA-Z0-9]{1,2}>"?

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



------------------------------

Date: Tue, 19 Oct 2004 09:07:58 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Top posting
Message-Id: <Pine.LNX.4.61.0410190904410.509@ppepc56.ph.gla.ac.uk>

On Mon, 18 Oct 2004, Jon Ericson wrote:

> "bxb7668" <bxb7668@somewhere.nocom> writes:
> 
> > Most of the Microsoft newsgroups that I trawl have about a 50-50
> > split between top and bottom posters. An example is
> > microsoft.public.windowsxp.basics.
> 
> Somehow I don't think the Microsoft groups are the best examples.  ;-)

I find them an excellent practical demonstration of why usenet has a 
long-standing convention for how to quote from previous posts, and of 
what goes wrong when this convention is flouted.

But not, of course, as an example to be followed!


------------------------------

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 7269
***************************************


home help back first fref pref prev next nref lref last post