[28827] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 71 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 24 21:49:14 2007

Date: Wed, 24 Jan 2007 18:48:40 -0800 (PST)
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, 24 Jan 2007     Volume: 11 Number: 71

Today's topics:
        readdir and regex <buzzinfly@web.de>
    Re: readdir and regex <bik.mido@tiscalinet.it>
    Re: readdir and regex <wahab-mail@gmx.de>
    Re: readdir and regex anno4000@radom.zrz.tu-berlin.de
    Re: separating attribution, quoted text, and sigs from  <art@example.com>
    Re: separating attribution, quoted text, and sigs from  <art@example.com>
        SNPP proxy rmanohar@aol.com
    Re: SNPP proxy <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: SNPP proxy rmanohar@aol.com
        SOAP::Lite + wsdl misunderstanding? <john@castleamber.com>
        Speed comparisons - LWP and database access trashman.horlicks@btinternet.com
    Re: Speed comparisons - LWP and database access xhoster@gmail.com
    Re: Speed comparisons - LWP and database access trashman.horlicks@btinternet.com
    Re: Speed comparisons - LWP and database access anno4000@radom.zrz.tu-berlin.de
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 24 Jan 2007 04:31:55 -0800
From: "poncenby" <buzzinfly@web.de>
Subject: readdir and regex
Message-Id: <1169641915.559435.325760@v45g2000cwv.googlegroups.com>

my perl program accepts arguments which will match a directory under
$path.  however this argument may not be specified so all directories
shall be processed under $path.
this is the way i'm doing it:

my $idopt = $ARGV[0];
my $path = "/home/user/";
opendir (ROOT, "$path");

if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
"!/^\.\.?$/"; }

my @dirid = grep { $idre }, readdir (ROOT);

however the dirid array is populated with every directory under $path,
regardless of what I specify in ARGV[0].

can anyone help?

thanks



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

Date: Wed, 24 Jan 2007 13:46:13 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: readdir and regex
Message-Id: <c3ler25c9iotvbcb7rikb3u58ivpk5sjcp@4ax.com>

On 24 Jan 2007 04:31:55 -0800, "poncenby" <buzzinfly@web.de> wrote:

>my perl program accepts arguments which will match a directory under
>$path.  however this argument may not be specified so all directories
>shall be processed under $path.
>this is the way i'm doing it:
>
>my $idopt = $ARGV[0];

You may want to shift() instead;

>my $path = "/home/user/";
>opendir (ROOT, "$path");
>
>if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
>"!/^\.\.?$/"; }
>
>my @dirid = grep { $idre }, readdir (ROOT);

$idre is a string if $idopt is false, and a string that is always
true.

>however the dirid array is populated with every directory under $path,
>regardless of what I specify in ARGV[0].

The above explains it. You'd better change your logic.


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: Wed, 24 Jan 2007 13:44:15 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: readdir and regex
Message-Id: <ep7m3n$9u9$1@mlucom4.urz.uni-halle.de>

poncenby wrote:
> my perl program accepts arguments which will match a directory under
> $path.  however this argument may not be specified so all directories
> shall be processed under $path.
> this is the way i'm doing it:
> 
> my $idopt = $ARGV[0];
> my $path = "/home/user/";
> opendir (ROOT, "$path");
> 
> if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
> "!/^\.\.?$/"; }
> 
> my @dirid = grep { $idre }, readdir (ROOT);
> 
> however the dirid array is populated with every directory under $path,
> regardless of what I specify in ARGV[0].

Of course, there is a lot of things that went wrong here ;-)

Try to modify your program step for step
and look what happens.

Here's my first shot at it:

    ...
    my $path = '/home/user/';
    my $idre = $ARGV[0] ? qr{$ARGV[0]} :  '^(\.(?!\.))?[^\.].+';

    opendir ROOT, $path or die "open failed $!";
    my @dircont = grep /$idre/, readdir ROOT;
    closedir ROOT;

    print join "\n", @dircont;


Regards

Mirco


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

Date: 24 Jan 2007 14:49:36 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: readdir and regex
Message-Id: <51pa00F1lbjrbU1@mid.dfncis.de>

poncenby <buzzinfly@web.de> wrote in comp.lang.perl.misc:
> my perl program accepts arguments which will match a directory under
> $path.  however this argument may not be specified so all directories
> shall be processed under $path.
> this is the way i'm doing it:
> 
> my $idopt = $ARGV[0];
> my $path = "/home/user/";
> opendir (ROOT, "$path");
> 
> if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
> "!/^\.\.?$/"; }
> 
> my @dirid = grep { $idre }, readdir (ROOT);

The line above is a syntax error.  It can't be your real code.
Please copy/paste code instead of re-typing it.  Typos like that
confuse the issue unnecessarily.

Anno


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

Date: 18 Jan 2007 16:36:37 -0000
From: Art Merkel <art@example.com>
Subject: Re: separating attribution, quoted text, and sigs from the body of a
Message-Id: <G1KZBRJM39100.4420949074@anonymous.poster>

usenet@DavidFilmer.com wrote:

> You can probably exclude 90%+ of attribution lines by excluding
> /wrote:$/ (but it won't work for Dr.Ruud's posts, etc).  Of course,
> that assumes English-language newsgroups.  Some folks try to be cute
> with attribution lines like:
>    When Art Merkel finally sobered up, he blundered:
> Nuthin you can do about attribution lines like that, unless you
> hard-code distinctive strings for prolific posters.

How about storing lines (some people's attributin lines wrap) that
don't match /^>/ until

(1) I hit one that does match, and I discard what I've already got
or
(2) I hit the sig cutline or end of the message, in this case I keep
everything I've already got since it's probably an OP?

Not sure what to do about top-posting (b*st*rds) though!


> You can probably exclude 90%+ of context quotes by excluding /^>/.

Of course.

> A usenet sig (if it's properly configured) follows a cutline which is
> two dashes and a space.  It's easy to identify such a cutline and
> ignore everything which follows.  But many posters don't use a proper
> cutline.

Right --- when I hit /^-- $/ , stop there.




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

Date: 19 Jan 2007 21:17:21 -0000
From: Art Merkel <art@example.com>
Subject: Re: separating attribution, quoted text, and sigs from the body of a
Message-Id: <KP96BSFH39101.6370486111@anonymous.poster>

usenet@DavidFilmer.com wrote:

> You won't be able to do this 100% of the time because the behavior of
> replies is different (and can be customized) in different newsreaders.
> Usenet posts are plain text, and lack the context tagging of XML, etc.
> But you can probably get pretty close to what you want.
> 
> You can probably exclude 90%+ of attribution lines by excluding
> /wrote:$/ (but it won't work for Dr.Ruud's posts, etc).  Of course,
> that assumes English-language newsgroups.  Some folks try to be cute
> with attribution lines like:
>    When Art Merkel finally sobered up, he blundered:
> Nuthin you can do about attribution lines like that, unless you
> hard-code distinctive strings for prolific posters.
> 
> You can probably exclude 90%+ of context quotes by excluding /^>/.

I'm thinking of something "stateful" in which I scan lines until 

(1) I hit a line that starts with '>', in which case I discard
everything I have so far (attribution). Then I keep going, ignoring
/^>/ lines (quoted) but keeping other lines until I hit the cutline or
the end.

(2) I hit the cutline or the end, in which case I keep everything so
far (an OP).


> A usenet sig (if it's properly configured) follows a cutline which is
> two dashes and a space.  It's easy to identify such a cutline and
> ignore everything which follows.  But many posters don't use a proper
> cutline.

No way to deal with top-posting, is there?




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

Date: 24 Jan 2007 09:22:27 -0800
From: rmanohar@aol.com
Subject: SNPP proxy
Message-Id: <1169659347.767570.96170@a75g2000cwd.googlegroups.com>

Hello,

I am behind a firewall and the only way i know of to acess external
hostnames is through proxy. I am trying to write a SNPP perl program to
send text pages (port 444 is open on firewall) but not sure how to go
about setting up the connection through proxy.

Any pointers?

Thanks
--
Raj



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

Date: Wed, 24 Jan 2007 21:51:29 +0100
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: SNPP proxy
Message-Id: <45b7c6d1$0$27376$ba4acef3@news.orange.fr>

rmanohar@aol.com wrote:
> Hello,
> 
> I am behind a firewall and the only way i know of to acess external
> hostnames is through proxy. I am trying to write a SNPP perl program to
> send text pages (port 444 is open on firewall) but not sure how to go
> about setting up the connection through proxy.
> 

Some (jumbled) thoughts:

I'm not familiar with SNPP, but if the necessary port is open on the 
firewall, why do you need to worry about a proxy? You've mentioned 
external "hostnames" rather than "hosts", but I'll assume you're not 
talking about DNS. Are you using Net::SNPP?

Mark


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

Date: 24 Jan 2007 13:23:18 -0800
From: rmanohar@aol.com
Subject: Re: SNPP proxy
Message-Id: <1169673797.989438.128210@s48g2000cws.googlegroups.com>

I am using Net::SNPP, port 444 is open on the firewall but I still can
only resolve (DNS) intranet hosts and NOT internet hosts. The only way
we currently access external hosts (web, telnet etc) is through a proxy
server.


On Jan 24, 2:51 pm, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
wrote:
> rmano...@aol.com wrote:
> > Hello,
>
> > I am behind a firewall and the only way i know of to acess external
> > hostnames is through proxy. I am trying to write a SNPP perl program to
> > send text pages (port 444 is open on firewall) but not sure how to go
> > about setting up the connection through proxy.Some (jumbled) thoughts:
>
> I'm not familiar with SNPP, but if the necessary port is open on the
> firewall, why do you need to worry about a proxy? You've mentioned
> external "hostnames" rather than "hosts", but I'll assume you're not
> talking about DNS. Are you using Net::SNPP?
> 
> Mark



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

Date: 24 Jan 2007 04:58:22 GMT
From: John Bokma <john@castleamber.com>
Subject: SOAP::Lite + wsdl misunderstanding?
Message-Id: <Xns98C1E9B023365castleamber@130.133.1.4>

Hi,

I thought that the whole point of providing a wsdl file to SOAP::Lite was 
that SOAP::Lite could turn a structure like:

foo => { bar => 1, baz => [ 0, 1, 2, 3, 4, 5 ] }

into XML with the right types based on the information in the WSDL file 
(which I consider a grammar specification). Or am I severely mistaken and 
the Lite in SOAP::Lite means it doesn't do this?

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: 24 Jan 2007 05:14:15 -0800
From: trashman.horlicks@btinternet.com
Subject: Speed comparisons - LWP and database access
Message-Id: <1169644455.512861.153240@v45g2000cwv.googlegroups.com>

Hi all,
I'm writing a two-block application, the first in C++, and the second
in perl (for cgi/webforms); at the moment, I am unsure as to whether to
write the whole lot in perl because its easier :)

I'd like to ask a few questions if possible:
How fast is LWP compared to comparable C/C++ socket open,close,receive
calls etc.? LWP seems to be a more compact way of doing parsing of URLs
but how much latency does perl add to the speed overhead?
Secondly, for simple MySql calls to open,close,read,write a database,
how well does C/C++ compare to Perl ?

TIA

Paul



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

Date: 24 Jan 2007 16:09:11 GMT
From: xhoster@gmail.com
Subject: Re: Speed comparisons - LWP and database access
Message-Id: <20070124110954.781$oB@newsreader.com>

trashman.horlicks@btinternet.com wrote:
> Hi all,
> I'm writing a two-block application, the first in C++, and the second
> in perl (for cgi/webforms); at the moment, I am unsure as to whether to
> write the whole lot in perl because its easier :)
>
> I'd like to ask a few questions if possible:
> How fast is LWP compared to comparable C/C++ socket open,close,receive
> calls etc.? LWP seems to be a more compact way of doing parsing of URLs
> but how much latency does perl add to the speed overhead?

I expect the http server you are talking to will add way more latency
than any difference between C++ and Perl that you will see in this regard.

> Secondly, for simple MySql calls to open,close,read,write a database,
> how well does C/C++ compare to Perl ?

Same thing, I'd expect the work that the database server had to do to
handle your request would swamp any differences on the client side.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 24 Jan 2007 09:02:46 -0800
From: trashman.horlicks@btinternet.com
Subject: Re: Speed comparisons - LWP and database access
Message-Id: <1169658166.001959.203710@j27g2000cwj.googlegroups.com>


Thanks!



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

Date: 24 Jan 2007 20:17:13 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Speed comparisons - LWP and database access
Message-Id: <51pt69F1lcj5bU1@mid.dfncis.de>

 <trashman.horlicks@btinternet.com> wrote in comp.lang.perl.misc:
> Hi all,
> I'm writing a two-block application, the first in C++, and the second
> in perl (for cgi/webforms); at the moment, I am unsure as to whether to
> write the whole lot in perl because its easier :)

Go ahead!

> I'd like to ask a few questions if possible:
> How fast is LWP compared to comparable C/C++ socket open,close,receive
> calls etc.? LWP seems to be a more compact way of doing parsing of URLs
> but how much latency does perl add to the speed overhead?
> Secondly, for simple MySql calls to open,close,read,write a database,
> how well does C/C++ compare to Perl ?

I am inclined to join Xho in predicting that the time will be consumed
elsewhere.  The difference in time efficiency will be small.  A Perl
solution may take more memory.

Independent of that, I'd suggest writing both parts in Perl.  If it
turns out (unlikely) that some part *is* a bottleneck, rewrite it
in C++ or whatever.

That may sound like an invitation to do part of the job twice, but
the second time through most of the design is already done, it's
just the implementation language that changes.  You will also have
a working prototype while working on the change, which is a big
advantage.  Most importantly, you'll do the change only with that
part of the code that actually needs it.

Anno


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

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 V11 Issue 71
*************************************


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