[25024] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7274 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 09:07:11 2004

Date: Wed, 20 Oct 2004 06:05:06 -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           Wed, 20 Oct 2004     Volume: 10 Number: 7274

Today's topics:
    Re: Any suggestions? <bik.mido@tiscalinet.it>
    Re: Calling a perl script from an html doc lesley_b_linux@yahoo.co.yuk
    Re: Calling a perl script from an html doc <tadmc@augustmail.com>
    Re: Calling a perl script from an html doc <eighner@io.com>
    Re: is it possible? <do-not-use@invalid.net>
    Re: perl to english <richard@zync.co.uk>
    Re: perl to english <peter@semantico.com>
    Re: perl to english <HelgiBriem_1@hotmail.com>
        RE to extract infos from a logfile (Gerhard M)
    Re: RE to extract infos from a logfile (Anno Siegel)
    Re: Regular Expression for HTML Tags and Special Charac <bart.lateur@pandora.be>
        Suggestion: Use EPIC as a perl editor/debugger <vijai.lists@gmail.com>
        Toronto Perl Mongers - Audio Recordings <fulko.hew@sita.aero>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Oct 2004 09:18:58 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Any suggestions?
Message-Id: <5l2bn05h1r09u7f9rjb7f82p4mffjrgosj@4ax.com>

On Tue, 19 Oct 2004 14:47:44 -0400, David Warren
<davidw_spam@spam_gto.net> wrote:

>Subject: Any suggestions?

Yes: use more informative subjects!


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

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

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

> lesley_b_linux@yahoo.co.yuk wrote:
<snip>
> Ok, then how about this:
> 
> How on earth could you have missed the myriad of postings _in_this_NG_ 
> pointing out that they don't have a Perl problem but a CGI problem, that 
> they should head over to the CGI NGs, and that they would have the same 
> problem no matter which programming language they would have used to 
> implement their CGI program.
> 
> How on earth could you have missed the frequent references _in_this_NG_ to 
> 'perldoc -q 500' with in turn points you to the CGI FAQ which in turn even 
> has an answer to your question:
> 1.11: Do I have to use Perl?
> No - you can use any programming language you please.   Perl is simply
> today's most popular choice for CGI applications.   Some other widely-
> used languages are C, C++, TCL, BASIC and - for simple tasks -
> even shell scripts.
> So, how on earth could you have missed all that?juejue 

I checked comp.lang.perl.misc on google for the string "perldoc \-q 500" and
sorted by date.  

   October   3 replies  (this latest one included)
   September 2 replies
   August    1 reply
   July      0 replies
   June      2 replies
   May       1 reply
   April     1 reply
   March     0 replies
   February  2 replies
   January   1 reply


Considering the volume of postings to this group each day, I don't
actually consider that to be frequent.  Regular, yes, frequent no.

Now I don't sit and read this newsgroup every day.  These last few days being
the exception to the rule rather than the rule.  One of the reasons I don't
read this one is because of the high signal to noise ratio.

Regards

Lesley 

--

P.S. 

From http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.text
'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 '


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

Date: Wed, 20 Oct 2004 07:25:45 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Calling a perl script from an html doc
Message-Id: <slrncncma9.4ga.tadmc@magna.augustmail.com>

lesley_b_linux@yahoo.co.yuk <lesley_b_linux@yahoo.co.yuk> wrote:

> One of the reasons I don't
> read this one is because of the high signal to noise ratio.
                                  ^^^^


Surely you mean *low* S/N ratio?


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


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

Date: Wed, 20 Oct 2004 07:33:50 -0500
From: Lars Eighner <eighner@io.com>
Subject: Re: Calling a perl script from an html doc
Message-Id: <slrncncmgq.1lg.eighner@goodwill.io.com>

In our last episode, 
<slrncncma9.4ga.tadmc@magna.augustmail.com>, 
the lovely and talented Tad McClellan 
broadcast on comp.lang.perl.misc:

> lesley_b_linux@yahoo.co.yuk <lesley_b_linux@yahoo.co.yuk> wrote:

>> One of the reasons I don't
>> read this one is because of the high signal to noise ratio.
>                                   ^^^^


> Surely you mean *low* S/N ratio?

I'm pretty sure this is lost cause, like "lowest common denominator."


-- 
Lars Eighner -finger for geek code-  eighner@io.com http://www.io.com/~eighner/
      If it wasn't for muscle spasms, I wouldn't get any exercise at all.


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

Date: 20 Oct 2004 12:38:15 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: is it possible?
Message-Id: <yzd3c097jzc.fsf@invalid.net>


James Willmore <jwillmore@adelphia.net> writes:
> (from `perldoc -q 'command'`)
> =begin
>        How can I capture STDERR from an external command?
> 
>         There are three basic ways of running external commands:
> 
>             system $cmd;                # using system()
>             $output = ‘$cmd‘;           # using backticks (‘‘)
>             open (PIPE, "cmd │");       # using open()

I don't know about others, but I'm getting some strange binary
sequences above, where according to "perldoc -q command", when I run
it, there should be simple backquotes and vertical bars. Just thought
I'd point it out.


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

Date: Wed, 20 Oct 2004 08:14:03 GMT
From: Octo Mancer <richard@zync.co.uk>
Subject: Re: perl to english
Message-Id: <pan.2004.10.20.08.08.55.135139@zync.co.uk>

On Wed, 20 Oct 2004 04:36:22 +0000, Uri Guttman wrote:
> ever heard of cobol? it was
> never understood by the manager types which was its intended goal.

"Each language has its purpose, however humble. Each language expresses
the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it. "



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

Date: Wed, 20 Oct 2004 09:40:56 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: perl to english
Message-Id: <41762496$0$17802$afc38c87@news.easynet.co.uk>

buildmorelines wrote:
> Is there any script or pragma or something that will translate perl
> code to pure english, like that perl latin module, just in english. I
> want to show a person who cant read perl code or any computer
> language, some perl code, so they have remotly a clue what the code
> does or how it flows. It doesnt need to perfectly make sense or be
> proper english sentences. Just soemthing that will translate perl code
> and/or syntax to english.

Anybody who understands the sentence "dereference and iterate over a list of 
anonymous hashes" is probably not far off being able to read perl anyway. To 
understand that is probably more than most suits are capable of. Stick to good 
documentation and tests.


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

Date: Wed, 20 Oct 2004 10:04:09 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: perl to english
Message-Id: <30ecn0t16ng4lubjod0913veskak8ejjd6@4ax.com>

On 19 Oct 2004 20:23:59 -0700, bulk88@hotmail.com (buildmorelines)
wrote:

>Is there any script or pragma or something that will translate perl
>code to pure english, like that perl latin module, just in english. I
>want to show a person who cant read perl code or any computer
>language, some perl code, so they have remotly a clue what the code
>does or how it flows. It doesnt need to perfectly make sense or be
>proper english sentences. Just soemthing that will translate perl code
>and/or syntax to english.

Well written Perl is already as close to English as code gets.

--
Helgi Briem  hbriem AT simnet DOT is

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


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

Date: 20 Oct 2004 01:03:47 -0700
From: notruf_1102003@yahoo.de (Gerhard M)
Subject: RE to extract infos from a logfile
Message-Id: <942c5b0d.0410200003.44c25b5d@posting.google.com>

hi,

i've to extract some informations from a logfile. The logfile has the
format:
[timestamp].[hostname].[pid]:[type] '[xml]' [some text]

e.g.
131112.dumbo.domain.tld.414:create_customer '<!xml...>..</..>'
additional info

but if the xml is to long the line will be truncated. Now there is:
131112.dumbo.domain.tld.414:create_customer
'<!xml...>.....................
the xml is not enclosured by quotes

what i need are the fields ($time,$process,$info,$xml) where xml is
either the xml enlcosured by the quotes or the line starting at the
first quote if line is truncated.

looking for an RE to match this i've not found the one closing at the
quote or at EOL:


while (<>) {
  ($time,$process,$info,$xml) = /^(\d+).*\.(\d+):(\w+)\s*'(.+)'/;
  # this one will not match to long xml-lines 

  ($time,$process,$info,$xml) = /^(\d+).*\.(\d+):(\w+)\s*'(.+)$/;
  # this one will set $xml="[xml]' [text]" 

  ($time,$process,$info,$xml) =
m#^(\d+).*\.(\d+):(\w+)\s*'([\w<>!&;,\.]+)#;
  # not realy nice, if to include all possible chars to the pattern

  ($time,$process,$info,$xml) = m#^(\d+).*\.(\d+):(\w+)\s*'(.*>)#;
  # does not work, [text] can also contain <>'s

  ($time,$process,$info,$xml) = m#^(\d+).*\.(\d+):(\w+)\s*'(.*)'?#;
  # will ever match to eol
}


does anyone have an RE which will extract the xml correct?

thx
gerhard


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

Date: 20 Oct 2004 09:15:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: RE to extract infos from a logfile
Message-Id: <cl5aam$ocr$1@mamenchi.zrz.TU-Berlin.DE>

Gerhard M <notruf_1102003@yahoo.de> wrote in comp.lang.perl.misc:
> hi,
> 
> i've to extract some informations from a logfile. The logfile has the
> format:
> [timestamp].[hostname].[pid]:[type] '[xml]' [some text]
> 
> e.g.
> 131112.dumbo.domain.tld.414:create_customer '<!xml...>..</..>'
> additional info
> 
> but if the xml is to long the line will be truncated. Now there is:
> 131112.dumbo.domain.tld.414:create_customer
> '<!xml...>.....................
> the xml is not enclosured by quotes
> 
> what i need are the fields ($time,$process,$info,$xml) where xml is
> either the xml enlcosured by the quotes or the line starting at the
> first quote if line is truncated.
> 
> looking for an RE to match this i've not found the one closing at the
> quote or at EOL:
> 
> 
> while (<>) {
>   ($time,$process,$info,$xml) = /^(\d+).*\.(\d+):(\w+)\s*'(.+)'/;
>   # this one will not match to long xml-lines 

"to long" meaning truncated?

Instead of matching everything up to a "'" (which may never come)
match everything that is not a "'".  So change the last bit of
the regex from "...(.+)'/" to "([^%']*)/".

Anno


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

Date: Wed, 20 Oct 2004 12:23:40 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Regular Expression for HTML Tags and Special Characters
Message-Id: <j3jcn0dp44u8h4pl64gsqpvpsdi3hr11m5@4ax.com>

Marc Bogaard wrote:

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

Typically, people don't like you using regexes for this kind of taask,
because the pattern would be *really* complex before working
satisfactorily. Instead, use something involving a HTML parser module.

I like HTML::TokeParser::Simple for that kind of task.

	<http://search.cpan.org/search?module=HTML::TokeParser::Simple>

 You loop through the input, processing one token (tag, comment, piece
of text) at a time, act differently depending on the type of token and
its actual contents, and can use $token->as_is to just pass it through
unchanged (the ordinary case). You can filter out disallowed tags,
disallowed attributes. You could probably even use it to balance the
left over, allowed tokens. 

Here's a demo script (do at least remove the whitespace in front of the
line containing just "*END*"):

	use HTML::TokeParser::Simple;

	my $html = <<"*END*";
	<P>Get up in the morning, slaving for bread, sir,
	<BR>so that every mouth can be fed.
	<P><B>Poor me</B>, the Israelite. <I>Aah.</I>
	<!-- this is a comment. It'll be gone. -->
	<P>There's a lone "<" in here, matched by a lone ">".
	<script language="Javascript">alert("Hello, World!")</script>
	<P>I don't like <a href="http://example.com">links</a> either,
	but will allow for <a name="foo"></a>anchors.
	*END*

	my $p = HTML::TokeParser::Simple->new(\$html);
	my %allow = map { $_ => 1 } qw(b i u br p);
	my %wipe_content = map { $_ => 1 } qw(style script);
	my %escape = ( '<' => '&lt;', '>' => '&gt;');

	while(my $t = $p->get_token) {
	    if($t->is_tag) {
	        my $tag = $t->get_tag;
	        if($tag eq 'a') {
	            print $t->as_is, "</a>" if defined
$t->get_attr('name');
	        } elsif($allow{$tag}) {
	            print $t->as_is;
	        } elsif($wipe_content{$tag}) {
	            while(my $t = $p->get_token) {
	                # wipe
	                last if $t->is_end_tag($tag);
	            }
	        }
	    } elsif($t->is_comment) {
	        # wipe
	    } elsif($t->is_text) {
	        my $text = $t->as_is;
	        $text =~ s/([<>])/$escape{$1}/g;
	        print $text;
	    }
	}


Result:
	<P>Get up in the morning, slaving for bread, sir,
	<BR>so that every mouth can be fed.
	<P><B>Poor me</B>, the Israelite. <I>Aah.</I>

	<P>There's a lone "&lt;" in here, matched by a lone "&gt;".

	<P>I don't like links either, 
	but will allow for <a name="foo"></a>anchors.

-- 
	Bart.


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

Date: Wed, 20 Oct 2004 02:43:36 -0500
From: Vijayaraghavan Kalyanapasupathy <vijai.lists@gmail.com>
Subject: Suggestion: Use EPIC as a perl editor/debugger
Message-Id: <MPG.1bdfd315aee5059f989683@news.vanderbilt.edu>

Hi all,

If you are new to Perl (like me) and use Eclipse, then I suggest the 
EPIC (Eclipse Perl Integration) plugin for Eclipse (http://e-p-i-
c.sf.net/

I have found many of the features very useful for example:

1. Right click on warnings and select "Explain Errors/Warnings" 
2. The ability to have a small window by the side with perl doc for
   function specified etc.

Just a suggestion, hope it's useful. I apologize if this is off-topic.

------
-vijai.


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

Date: Wed, 20 Oct 2004 08:44:01 -0400
From: Fulko Hew <fulko.hew@sita.aero>
Subject: Toronto Perl Mongers - Audio Recordings
Message-Id: <n4tdd.4145$Cb5.31846@newscontent-01.sprint.ca>


As an experiment I've recorded all of the presentations at the latest
Toronto Perl Mongers "Lightning Talk" session.  But so far, I've only
made them available to members of the Toronto group.

It was my thought that by making these recordings available, others who
don't currently come out to meetings would find out how wonderfully
useful our meetings can be and encourage them to come out and participate.

I also thought it might encourage other Perl Monger groups to record
their meetings and make them available for the same reasons.

I haven't made our recordings available to the world yet, because I'm
afraid of the Slash dot effect and the bandwidth cost to the person
who's hosting the files.

Is there someplace out there that would be willing to host the files and
provide the bandwidth?  Not just for us, but perhaps for everyone if it
catches on!


Comments anyone?

Fulko


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

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


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