[25998] in Perl-Users-Digest
Perl-Users Digest, Issue: 8217 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 30 18:06:30 2005
Date: Thu, 30 Jun 2005 15: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 Thu, 30 Jun 2005 Volume: 10 Number: 8217
Today's topics:
[ANNOUNCE] wxPerl 0.23 <mattia.barbon@libero.it>
accessing NEW modules when you don't have privs <Mark.Seger@hp.com>
Re: accessing NEW modules when you don't have privs <1usa@llenroc.ude.invalid>
Re: Global variables from a module, while using strict <phaylon@dunkelheit.at>
Re: Proxy and LWP::UserAgent <RedGrittyBrick@SpamWeary.foo>
Re: SOAP::Lite proxied <scobloke2@infotop.co.uk>
Re: UTF-8 to named character entities <RedGrittyBrick@SpamWeary.foo>
Re: weird behavior with open and pipe (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Jun 2005 20:09:19 GMT
From: Mattia Barbon <mattia.barbon@libero.it>
Subject: [ANNOUNCE] wxPerl 0.23
Message-Id: <Xns9685E1AB0F9ADrbootliberoit@193.70.192.192>
A new version of wxPerl, the Perl bindings to wxWidgets, is out!
wxWidgets is a free and cross platform (Windows/Motif/GTK/Mac) C++ GUI
toolkit with native look and feel. (visit http://www.wxwidgets.org/
for details).
You can download wxPerl sources from
$CPAN/authors/id/M/MB/MBARBON/Wx-0.23.tar.gz;
Screenshots: http://wxperl.sourceforge.net/sshot01.html
Binary packages for ActivePerl/Win32 8xx builds, Red Hat
Linux and Mac OS X are available along with documentation
in HTML and MS HTML Help format from
http://wxperl.sourceforge.net/download.html
The project home page is http://wxperl.sourceforge.net/. There is also
a mailing list dedicated to wxPerl users:
wxperl-users@lists.sourceforge.net
Changes since the last release:
- Added wxArtProvider and Wx::PlArtProvider
(thanks to Matthew "Cheetah" Gabeler-Lee).
- Compatibility with wxWidgets 2.5.4, 2.6.0 and 2.6.1.
- Added Wx::PlPreviewFrame, Wx::PlPreviewControlBar,
Wx::PrintFactory.
- Added Wx::PopupWindow and Wx::PopupTransientWindow.
- Added Wx::DatePickerCtrl. (2.5/2.6)
- Added Wx::MimeTypesManager.
Regards
Mattia
------------------------------
Date: Thu, 30 Jun 2005 17:19:02 -0400
From: Mark Seger <Mark.Seger@hp.com>
Subject: accessing NEW modules when you don't have privs
Message-Id: <42c461c9@usenet01.boi.hp.com>
I find myself on a system with no privs trying to build a pm that links
into an object module with swig - very cool tool. Therefore I can't
'make install'. Naturally when I try to 'use' it the load fails. I've
gotta believe this has come up before and there is some 'trick' but I
just don't know enough about the subtleties of module loading, to know
what it is. Can someone help?
-mark
------------------------------
Date: Thu, 30 Jun 2005 21:58:54 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: accessing NEW modules when you don't have privs
Message-Id: <Xns9685B6EA65969asu1cornelledu@127.0.0.1>
Mark Seger <Mark.Seger@hp.com> wrote in news:42c461c9@usenet01.boi.hp.com:
> I find myself on a system with no privs trying to build a pm that links
> into an object module with swig - very cool tool. Therefore I can't
> 'make install'. Naturally when I try to 'use' it the load fails. I've
> gotta believe this has come up before and there is some 'trick' but I
> just don't know enough about the subtleties of module loading, to know
> what it is. Can someone help?
perldoc -q lib
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 30 Jun 2005 18:04:27 GMT
From: Robert Sedlacek <phaylon@dunkelheit.at>
Subject: Re: Global variables from a module, while using strict
Message-Id: <42c4342b$0$10811$9b4e6d93@newsread4.arcor-online.net>
Shea Martin <sam_squirrelnutz@hotmail.com> wrote
> I have a module which is basically a about 50 global variables and about
> 2 methods. Because I am 'using' strict, all of the variables are
> declared with 'my'.
>
> I in my scripts which use the module, I can't access any of the
> variables, though I can access the sub routines.
Try: perldoc -f our
hth,p
--
There's a storm on the horizon. It's gonna be everywhere.
-- Michael Moynihan
------------------------------
Date: Thu, 30 Jun 2005 18:03:18 +0000 (UTC)
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Proxy and LWP::UserAgent
Message-Id: <da1c56$4b1$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com>
Mike wrote:
> I have put together a pretty good working webcrawler using ActivePerl for
> windows. I am trying to get it to access a proxy from a list of PUBLIC
> proxies stored in a text file. I am seem to have trouble in this area. I am
> using a standard agent to access and I am setting up the proxy in the
> standard way using a public proxy from the text file.
> the way I am reading the description of a proxy setting in LWP::UserAgent
> is: (bare with me on this logic) I am telling the server I am trying to
> access the web page to send the data to the proxy address I have set up in
> UserAgent . The problem is that I have not notified or accessed the public
> proxy where to tell it where to send the data. In other words, I have not
> before hand notified the proxy server to send the data to my IP address and
> I believe this is where I am having trouble.
Unless I misunderstand, your description of HTTP proxy operation is
incorrect.
Let's say you wish to retrieve a web page at
http://www.example.com/support/manual.html
Your script actually makes a TCP connection to www.example.com (on TCP
port 80) and sends a request:
"GET /support/manual.html"
If you have a proxy at http://proxy.myco.org:3128 then what happens is
that your script makes a TCP connection to proxy.myco.org (on TCP port
3128) and sends a request
"GET http://www.example.com/support/manual.html"
Since HTTP is stateless there's no question of "before hand notified the
proxy server".
In very simplified form, ignoring caching, what happens is ...
script opens TCP connection 1 to proxy
script sends GET request to proxy
Proxy opens connection 2 to webserver
Proxy sends modified GET request to webserver
Webserver sends response to Proxy
Connection 2 is closed
Proxy sends response to script
Connection 1 is closed
>
> I was looking for any information or any help in the use of proxies and
> LWP::UserAgent.
>
You don't have to change your code, the same code can work with or
without proxies. If you want to use a proxy you can set environment
variable HTTP_proxy=http://proxy.myco.org:3128.
Alternatively you can add a statement to your script that tells
LWP::Useragent to use a proxy. I wouldn't try to deal with it all at the
low level described above.
This is described in the LWP::UserAgent documentation. Go to
www.google.com, type LWP::UserAgent and click "I'm feeling Lucky".
If your code isn't working, post it (after reading the posting
guidelines at
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.text)
------------------------------
Date: Thu, 30 Jun 2005 16:06:04 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: SOAP::Lite proxied
Message-Id: <da159b$d7$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>
A. Sinan Unur wrote:
> Ian Wilson <scobloke2@infotop.co.uk> wrote in
> news:da0bqv$4ih$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com:
>
>
<snip: Discussion of how to set user and password for HTTP-proxy when
using SOAP::Lite>
To summarise, you can either set environment variables HTTP_proxy,
HTTP_proxy_user and HTTP_proxy_pass or you can use a construct like:
$soap->proxy('http://endpoint.server/',
proxy => ['http' => 'http://user:pass@my.proxy.server/']);
>
> I would focus on the differences rather than the similarities between
> the two systems. Are two systems going through the same proxy?
They use different proxies. I'm now almost certain the problem lies with
configuration of the other proxy, which means it isn't a Perl problem
despite my earlier difficulty in finding out exactly how
authenticated-proxies are meant to work in SOAP::Lite.
Thanks for your help - much appreciated.
------------------------------
Date: Thu, 30 Jun 2005 20:59:39 +0000 (UTC)
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: UTF-8 to named character entities
Message-Id: <da1mfr$ku7$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>
Crap wrote:
> Thanks for the reply, however I am still lost.
> What I want is a conversion from UTF-8 to the corresponding named
> character entities (ë --> ë). But I get really funny
> characters. Below is my script, test.xml, and output.xml
>
> command line: perl utf.pl test.xml
>
>
> --utf.pl--
> #!/usr/bin/perl -w
>
> use HTML::Entities;
>
> open OUT, ">output.xml";
>
> while(<>){
> $string=(encode_entities($_));
> print OUT $string;
> }
>
> close OUT;
>
>
> ---test.xml---
> <a>patiënten reguleert.�<vn>
> <al>
> <a>EN 1130b31-1131a.</a>
> </al>
> </vn>
>
> ---output.xml---
> <a>patiënten
> reguleert.�<vn>
> <al>
> <a>EN 1130b31-1131a.</a>
> </al>
> </vn>
>
> ---expected.xml---
> <a>patiënten reguleert.’<vn>
> <al>
> <a>EN 1130b31-1131a.</a>
> </al>
> </vn>
Your problem is that HTML::Entities needs Latin-1 not utf8
#!perl
use strict;
use warnings;
use Encode;
use HTML::Entities;
open my $out, '>', 'output.xml' or die "Unable to open output.xml
because $!";
while (<>) {
my $string = $_;
$string = encode("iso-8859-1", decode("utf8", $string));
print $out encode_entities($string);
}
close $out or die "Woo $!";
------------------------------
Date: 30 Jun 2005 15:38:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: weird behavior with open and pipe
Message-Id: <da13mg$2ni$1@mamenchi.zrz.TU-Berlin.DE>
Moritz Karbach <moritz.karbach@desy.de> wrote in comp.lang.perl.misc:
> Hi,
>
> I'm still tuning the run()-function of my Command class (see some older
> postings of mine, if you like).
>
> I'm using
>
> open($fh_child,"-|");
>
> to fork and to open a pipe to the child, which then exec's a system command.
> The parent uses
>
> my @output = <$fh_child>;
> close($fh_child);
>
> to receive the output. Here is the problem:
>
> If the childs executes a certain system command and the system command gets
> killed externally (by a watchdog), sometimes the parent doesn't receive any
> output! Yes, I'm sure, that the system command has written something to std
> out before it got killed.
Buffering. The output is still in a buffer when the program gets killed,
so the data is lost. At least, that's consistent with what you're
seeing.
> The weird thing is, that if I execute something like
>
> <test.sh>
> #!/bin/bash
> echo "this is a test"
> sleep 10
> </test.sh>
>
> and if I kill the process after say 5 seconds, the parent indeed receives
> the line "this is a test"!
A shell script is a bad approximation for a single process, it runs
as a series of sub-processes, held together by the shell. You probably
killed the shell, which is neither the process that echoed, nor the
one that sleeps. A perl program would be a better approximation (store
in /tmp/prog):
#!/usr/local/bin/perl
use strict; use warnings;
$| = 1; # auto-flush -- comment this out
print "this is a test\n";
sleep 5;
This runs all in a single process. The parent program
#!/usr/local/bin/perl
use strict; use warnings; $| = 1;
my $pid_child = open my $fh_child, '-|', '/tmp/prog' or
die "pipe open: $!";
sleep 2;
kill TERM => $pid_child or die;
print while <$fh_child>;
still sees the output, but if you comment-out "$| = 1" and run the kid
buffered it doesn't.
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 V10 Issue 8217
***************************************