[25647] in Perl-Users-Digest
Perl-Users Digest, Issue: 7889 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 16 21:05:33 2005
Date: Wed, 16 Mar 2005 18:05:10 -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, 16 Mar 2005 Volume: 10 Number: 7889
Today's topics:
Re: DBI DBM Slow - Is a ramdisk the answer? burlo.stumproot@gmail.com
Expect module - need some help... tudmuf2b@onebox.com
Re: Extract data using Curl Unix Command & Perl Script <ifiaz@hotmail.com>
Re: Hashes, flattening, evaluation <matternc@comcast.net>
HTML table position text injector? <jidanni@jidanni.org>
perl bug with pos() and placing matches in an array? t13_e@yahoo.com
Re: perl bug with pos() and placing matches in an array <1usa@llenroc.ude.invalid>
Re: perl bug with pos() and placing matches in an array t13_e@yahoo.com
Re: perl bug with pos() and placing matches in an array <1usa@llenroc.ude.invalid>
Re: perl bug with pos() and placing matches in an array t13_e@yahoo.com
Re: perl bug with pos() and placing matches in an array <tadmc@augustmail.com>
Re: PerlScript (WSH) - Cannot set property <smugs_boy@yahoo.com>
Re: PerlScript (WSH) - Cannot set property <1usa@llenroc.ude.invalid>
pop3 and http proxy (Daniel)
Re: PPM not working <jinsun@agere.com>
Re: PPM not working <doug@taperedsquare.com>
Re: PPM not working <x3v0-usenet@yahoo.com>
Re: PPM not working <kalinaubears@iinet.net.au>
Re: Probably a dumb s/// question. <someone@example.com>
Re: Probably a dumb s/// question. <nobull@mail.com>
Re: Probably a dumb s/// question. <No_4@dsl.pipex.com>
Re: Probably a dumb s/// question. <tadmc@augustmail.com>
Re: Probably a dumb s/// question. <tadmc@augustmail.com>
Regex - every character but " <cyde@umd.edu>
Re: Regex - every character but " <tzz@lifelogs.com>
Re: Regex - every character but " <spamtrap@dot-app.org>
Re: Regex - every character but " <someone@example.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Mar 2005 22:52:57 GMT
From: burlo.stumproot@gmail.com
Subject: Re: DBI DBM Slow - Is a ramdisk the answer?
Message-Id: <u8y4n5hgh.fsf@gmail.com>
Jim Gibson <jgibson@mail.arc.nasa.gov> writes:
> In article <umzt4inpg.fsf@notvalid.se>, <burlo.stumproot@gmail.com>
> wrote:
>
> > Using WinXP Activestate 5.8.4
> >
> > I'm using dbi:DBM to analyze some data. I read it from a file,
> > process it some and then put it in a dbi:DBM database. I run a couple
> > of sql's on it and save the result for later use.
<snip>
> It sounds like you are creating a persistent database on disk (or ram
> disk) and using it as a temporary data set, extracting data, writing
> out the results, then deleting the database when you are done. If that
> is the case, why are you using a database at all. You could easily save
> 1000 records in memory using arrays or hashes or some combination of
> the two. Perform whatever manipulation you need on that data, write out
> the results, and quit. That should be a lot faster than the overhead of
> an RDBMS. Your problem would be translating the SQL manipulations into
> Perl expressions and statements.
Yes and that's what I'm trying to avoid. Why go thrugh the trouble of
creating a set of funktions working on hashes to (probably badly) emulate
SQL when I can use SQL.
I actually started with hashes and wrote a couple of snippets to collect
the data I wanted when it started to look like:
select a,b from foo where a > b and a between d and e
So I thought why bother and went with the database/SQL approach.
Speed is not critical, having it take 1-2 seconds is ok(*), 18s was not.
/PM
(*)
Using SQLite with AutoCommit off
------------------------------
Date: 16 Mar 2005 11:59:31 -0800
From: tudmuf2b@onebox.com
Subject: Expect module - need some help...
Message-Id: <1111003171.911067.217910@g14g2000cwa.googlegroups.com>
Hey folks...
I am playing around with the Expect module and have been looking at the
docs, but am confused as to why my code does not send the "ls" to the
remote host.
My code is below (along with the trace). The remote host does not have
NIS running so hence the warnings...
So I am trying to ssh to "moocow" and the just run and "ls" and get
that output but for whatever reason it just doesn't give me the ls
output. I do see that I get into expect part (where I am expecting to
get the $ prompt), but when I do a print "ls\n", it doesn't work. I've
tried this with the $exp->send("ls\r") but it doesn't work.
any ideas, as this is probably a simple issue???
#!/usr/local/bin/perl
use strict;
use warnings;
use Expect;
$Expect::Exp_Internal = 1;
#$Expect::Debug = 3;
my $exp = new Expect;
$exp->spawn("ssh moocow") || warn "Cannot spawn ssh: $!\n";
if ( $exp->expect(12,"\$ ") ) {
print "I made it in here\n";
print $exp "ls\n";
}
print "\n";
=========================
Spawned 'ssh moocow'
spawn id(3)
Pid: 10919
Tty: /dev/pts/22
Expect::spawn('Expect=GLOB(0x9eb5f38)', 'ssh moocow') called at
./test
.expect.module.pl line 17
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x9eb5f38)', 12, '$ ') called at
./test.ex
pect.module.pl line 19
spawn id(3): list of patterns:
#1: -ex `$ '
spawn id(3): Does `'
match:
pattern #1: -ex `$ '? No.
Waiting for new data (12 seconds)...
Warning: Remote host denied X11 forwarding, perhaps xauth program could
not be
run on the server side.
spawn id(3): Does `Warning: Remote host denied X11 forwarding, perhaps
xauth p
rogram could not be run on the server side.\
r\r\n'
match:
pattern #1: -ex `$ '? No.
Waiting for new data (12 seconds)...
ypwhich: can't get local yp domain: Local domain name not set
spawn id(3): Does `Warning: Remote host denied X11 forwarding, perhaps
xauth p
rogram could not be run on the server side.\r\r\nypwhich: can\'t get
local yp
domain: Local domain name not set\r\n'
match:
pattern #1: -ex `$ '? No.
Waiting for new data (12 seconds)...
moocow 1$
spawn id(3): Does `Warning: Remote host denied X11 forwarding, perhaps
xauth p
rogram could not be run on the server side.\r\r\nypwhich: can\'t get
local yp
domain: Local domain name not set\r\nmoocow 1$ '
match:
pattern #1: -ex `$ '? YES!!
Before match string: `Warning: Remote host denied X11 forwarding,
perhaps
xauth program could not be run on the server side.\r\r\nypwhich: can\'t
get lo
cal yp domain: Local domain name not set\r\nmoocow 1'
Match string: `$ '
After match string: `'
Matchlist: ()
Returning from expect successfully.
I made it in here
------------------------------
Date: 16 Mar 2005 17:17:49 -0800
From: "ifiaz" <ifiaz@hotmail.com>
Subject: Re: Extract data using Curl Unix Command & Perl Script from Webpage
Message-Id: <1111022269.438556.91210@f14g2000cwb.googlegroups.com>
> > I tried using your script for the latest results, and it works like
a
> > wonder:
>
>
> That is how ALL of _my_ code works!
>
> heh.
>
>
> [snip code fragments]
>
>
> > But, both your version of the script and my version stops after
> > processing approx. the 90th student number unconditionally although
the
> > loop extends beyond that.
>
>
> It gets all 318 of them when I try it.
>
>
> > Could you or someone explain why?
>
>
> Nope, since I cannot duplicate the problem.
>
> (but I do see that 64 of the regno's return no results,
> invalid registration numbers I assume...
> )
I could see this too.
>
Did you make any code changes on your script?
Is it to do anything with network overloading, etc. etc.?
I am using perl 5.8.5, Windows 98 SE, cygwin
Any pointers is much appreciated. Thanks.
------------------------------
Date: Wed, 16 Mar 2005 14:41:03 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Hashes, flattening, evaluation
Message-Id: <J-ydnSqoxvlSFqXfRVn-sg@comcast.com>
A. Sinan Unur wrote:
> Gregory Toomey <nospam@bigpond.com> wrote in
> news:39r4mbF5vb5tqU1@individual.net:
>
>> Theres a section in the cookbook on using closures as objects
>> http://www.india-seo.com/perl/cookbook/ch11_08.htm
>
> You know that is an illegal copy, right? Have you informed O'Reilley about
> the site?
>
Not to mention out of date; it's the first edition.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Thu, 17 Mar 2005 07:02:30 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: HTML table position text injector?
Message-Id: <87is3r42k9.fsf@jidanni.org>
Gentlemen, often HTML tables meant for regular monitors become hard to
keep one's place reading when viewed on small handheld devices. So
let's insert visual clues -- letters or numbers indicating what column
we are looking at -- right into the text of the table, so the user is
sure to know what column an item was in, no matter how jumbled the
table ends up.
Let's put a,b,c,d before each bus departure time:
aNurdsburg bTurdsburg cNorflewitz dBlahsville
eSoftstools fBoogerworth gSnitsville
a16:20 b16:50 c17:15 d
e18:50 f19:20 g22:00
(Blahsville to boring to stop in these days.)
One might further deal with e.g., COLSPAN="3": a-c or abc.
Multi-dimensional tables: a3, c7b etc.
HTML::TableExtract, HTML::Parser is way over my head.
Anyway perhaps somebody has already made a table position text injector?
(What I did:)
$ wget -O - http://www.fybus.com.tw/bus8.htm| #[1.6MB Big5]
tr -d \\n|perl -pwe 's/<t[dhr]/\n$&/ig'|
perl -pwe '$c=ord q{a}if/<tr/i;
s/<t[dh][^>]*>(<[^t\/][^>]*>|\ \;|\s)*/$&.chr $c++/ige'
... plucker-build ... pilot-xfer
------------------------------
Date: 16 Mar 2005 14:17:37 -0800
From: t13_e@yahoo.com
Subject: perl bug with pos() and placing matches in an array?
Message-Id: <1111011457.955716.49950@f14g2000cwb.googlegroups.com>
For this code:
$x1 = "abcdefgh";
if(@vars = ($x1 =~ m/(b)/g))
{
$p = pos $x1;
print "pos is $p\n";
}
$x2 = "abcdefgh";
if($x2 =~ m/(b)/g)
{
$p = pos $x2;
print "pos is $p\n";
}
The following is displayed using perl v5.8.4:
pos is
pos is 2
Does someone know why pos is returning '' for the first regexp, and the
correct value, 2, for the second?
Thanks,
Tim
------------------------------
Date: Wed, 16 Mar 2005 23:12:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl bug with pos() and placing matches in an array?
Message-Id: <Xns961BB93F7799Easu1cornelledu@127.0.0.1>
t13_e@yahoo.com wrote in news:1111011457.955716.49950
@f14g2000cwb.googlegroups.com:
Subject: perl bug with pos() and placing matches in an array?
As I have pointed out many times before, it never fails to astonish me
when people automatically assume there is a "bug" as opposed to
realizing that they may be missing something.
> For this code:
>
> $x1 = "abcdefgh";
>
> if(@vars = ($x1 =~ m/(b)/g))
> {
> $p = pos $x1;
> print "pos is $p\n";
> }
See perldoc perlop:
m/PATTERN/cgimosx
/PATTERN/cgimosx
...
Options are:
c Do not reset search position on a failed match when /g is
in effect.
...
The "/g" modifier specifies global pattern matching--that is,
matching as many times as possible within the string.
Hence, by the time of the call to pos above, the match will have failed,
and therefore the search position will have been reset (because you did
not use the c option.
D:\Home\asu1> cat v.pl
use strict;
use warnings;
my $x1 = "abcdefgh";
if(my @vars = ($x1 =~ m/(b)/cg)) {
my $p = pos $x1;
print "pos is $p\n";
}
my $x2 = "abcdefgh";
if($x2 =~ m/(b)/g) {
my $p = pos $x2;
print "pos is $p\n";
}
__END__
D:\Home\asu1> v
pos is 2
pos is 2
You will become much better at programming if you first assume that you
might, just might, be making a mistake instead of being convinced that
there is a bug in something someone else did every time things don't
work in line with your expectations.
Sinan
Sinan
------------------------------
Date: 16 Mar 2005 15:56:53 -0800
From: t13_e@yahoo.com
Subject: Re: perl bug with pos() and placing matches in an array?
Message-Id: <1111017413.199762.176700@g14g2000cwa.googlegroups.com>
I see... sorry, I was assuming that "@vars = $x =~ m/(a)/" worked the
same as "@vars = $x =~ m/(a)/g", except that the /g would enable me to
get the position of the match.
I'm trying to do a single match, place the submatches in an array, and
at the same time finding the position of the match. I don't want to
use $1,$2,$3, etc... since the regexp is dynamic and created at
runtime. Do you have any idea of how to accomplish this without using
"length &`"?
Thanks,
Tim
------------------------------
Date: Thu, 17 Mar 2005 00:04:38 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl bug with pos() and placing matches in an array?
Message-Id: <Xns961BC2124CAE1asu1cornelledu@127.0.0.1>
t13_e@yahoo.com wrote in news:1111017413.199762.176700
@g14g2000cwa.googlegroups.com:
> I see
What do you see? Please quote an appropriate amount of context when
replying.
> ... sorry, I was assuming that "@vars = $x =~ m/(a)/" worked the
> same as "@vars = $x =~ m/(a)/g", except that the /g would enable me to
> get the position of the match.
>
> I'm trying to do a single match, place the submatches in an array, and
> at the same time finding the position of the match.
The position of which match? You can only hope to get the position of
the *last* match using the c option.
> I don't want to use $1,$2,$3, etc...
Who said you needed to?
If you want to get the position of all the matches in a string, then
you'll need to loop trough the matches, saving the position of the match
in each case.
> Do you have any idea of how to accomplish this without using
> "length &`"?
What is &` ?
I think, at this point, you need to take deep breath, read the posting
guidelines to get some pointers on how to compose a meaningful post that
helps others help you, and follow up with an accurate description of
what you are trying to achieve.
Sinan.
------------------------------
Date: 16 Mar 2005 16:34:22 -0800
From: t13_e@yahoo.com
Subject: Re: perl bug with pos() and placing matches in an array?
Message-Id: <1111019662.810556.122040@g14g2000cwa.googlegroups.com>
A. Sinan Unur wrote:
> t13_e@yahoo.com wrote in news:1111017413.199762.176700
> @g14g2000cwa.googlegroups.com:
>
> > I see
>
> What do you see? Please quote an appropriate amount of context when
> replying.
This is just an expression. I'll refrain from using these from now on.
>
> > ... sorry, I was assuming that "@vars = $x =~ m/(a)/" worked the
> > same as "@vars = $x =~ m/(a)/g", except that the /g would enable me
to
> > get the position of the match.
> >
> > I'm trying to do a single match, place the submatches in an array,
and
> > at the same time finding the position of the match.
>
> The position of which match? You can only hope to get the position of
> the *last* match using the c option.
I would like to find the position of the first match.
I'll try to describe this more plainly. I have a string, $x, that may
match one or more times to a regexp, $re. $re is defined at runtime,
and contains one or more groupings using '(' and ')'.
I want to find the first match in the string, place all the submatches
of the first match into an array, @vars. I also would like to find the
position in $x of the first match.
It seems like the answer is to attempt the match twice, as follows:
$x = "abcdefg";
$re = qr/([bd])(.)/;
if(@vars = $x =~ /$re/) #get the submatches of the first match
{
$x =~ /$re/g; #find the position of the first match
$p = pos($x) - length $&;
print "pos is $p\n";
print "vars = ".join(' ',@vars)."\n";
}
If know of a nicer, more efficient way of doing this, then great.
Otherwise, thanks for your time.
>
> > I don't want to use $1,$2,$3, etc...
>
> Who said you needed to?
>
> If you want to get the position of all the matches in a string, then
> you'll need to loop trough the matches, saving the position of the
match
> in each case.
>
> > Do you have any idea of how to accomplish this without using
> > "length &`"?
>
> What is &` ?
>
Sorry, I meant "$`"...
> I think, at this point, you need to take deep breath, read the
posting
> guidelines to get some pointers on how to compose a meaningful post
that
> helps others help you, and follow up with an accurate description of
> what you are trying to achieve.
>
> Sinan.
------------------------------
Date: Wed, 16 Mar 2005 18:39:32 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: perl bug with pos() and placing matches in an array?
Message-Id: <slrnd3hke4.dv0.tadmc@magna.augustmail.com>
t13_e@yahoo.com <t13_e@yahoo.com> wrote:
> For this code:
>
> $x1 = "abcdefgh";
>
> if(@vars = ($x1 =~ m/(b)/g))
A pattern match in list context.
It matches as many times as it can right here, then it is done matching.
> {
> $p = pos $x1;
> print "pos is $p\n";
> }
>
> $x2 = "abcdefgh";
>
> if($x2 =~ m/(b)/g)
A pattern match in scalar context.
Must remember pos() in case we resume matching against $x2.
> {
> $p = pos $x2;
> print "pos is $p\n";
> }
>
> The following is displayed using perl v5.8.4:
>
> pos is
> pos is 2
>
>
> Does someone know why pos is returning '' for the first regexp,
Because it is all done matching before you get to calling pos().
> and the
> correct value, 2, for the second?
Because it is still matching, so it is still maintaining position info.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Mar 2005 12:58:08 -0800
From: "Smugsboy" <smugs_boy@yahoo.com>
Subject: Re: PerlScript (WSH) - Cannot set property
Message-Id: <1111006688.677476.179480@g14g2000cwa.googlegroups.com>
MyObj is a .NET managed object declared in C# in the following way:
class MyObj
{
MyObj() {}
private int m_prop1;
public int Prop1
{
get { return m_prop1; }
set { m_prop1 = value; }
}
}
It is added into Microsoft's Script Control and used through
PerlScript.
I need to add that accessing Prop1 works fine with VBScript & JScript.
Any idea ?
Thanks,
Tim Hammerquist wrote:
> Smugsboy <smugs_boy@yahoo.com> wrote:
> > When I try to read the propery I succeed using the following
syntax:
> > $MyObj->Prop1
> >
> > However, whem I try to write to the propery using the following
> > syntax I get an error:
> > $MyObj->Prop1 = 6;
> >
> > Any ideas ?
>
> You'll need to provide more information about $MyObj in order to get
> a definitive answer. Also, hopefully someone more familiar with
> WSH/PerlScript programming than me is lurking around here. I used
> ASP/PerlScript about 5 years ago, but I haven't kept up.
>
> PerlScript lacks a lot of the syntactic sugar that makes VBScript
look
> so simple. E.g., "default objects." You'll probably need to take
> a deeper look into the $MyObj object and see what, if anything, is
going
> on behind the scenes.
>
> HTH,
> Tim Hammerquist
------------------------------
Date: Wed, 16 Mar 2005 23:16:45 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: PerlScript (WSH) - Cannot set property
Message-Id: <Xns961BB9F44A8BBasu1cornelledu@127.0.0.1>
"Smugsboy" <smugs_boy@yahoo.com> wrote in news:1110989063.304894.6550
@f14g2000cwb.googlegroups.com:
> Hi,
> I have an application which uses Microsoft's ScriptControl as a script
> host for PerlScript.
> I add an object to it that contains a property.
>
> When I try to read the propery I succeed using the following syntax:
> $MyObj->Prop1
>
> However, whem I try to write to the propery using the following syntax
> I get an error:
> $MyObj->Prop1 = 6;
I have never used PerlScript, but does the obvious way work?
$MyObj->Prop1(6);
Sinan.
------------------------------
Date: 16 Mar 2005 13:52:06 -0800
From: sharondaniel@gmail.com (Daniel)
Subject: pop3 and http proxy
Message-Id: <67975475.0503161352.7e019be4@posting.google.com>
Hi,
I need to write a small tool to read mail from a mailbox using pop3.
the problem i have is that i use proxy to connect to the internet, and
the Net::Pop3 does not support proxy. outlook can get to the mailbox
with no problem.
can someone give me direction how do i use proxy for pop3 in perl?
Regards,
Daniel
------------------------------
Date: Wed, 16 Mar 2005 14:39:59 -0500
From: "Jin Sun" <jinsun@agere.com>
Subject: Re: PPM not working
Message-Id: <d1a22k$ke5$1@alageremail2.agere.com>
This what I've done for the similar problem. Hope this may help.
Go to you internet browser (e.g. IE), choose tools/internet
options/connections, in LAN settings, check Proxy server and put proxy
server name and port there. Set an enviromential variable
HTTP_proxy="http://proxyservername:port". In ppm, type search * and wait for
a while(be patient), it's going to return a list.
"Doug Wells" <doug@taperedsquare.com> wrote in message
news:CQ_Zd.15$fG.916@news.uswest.net...
> I'm trying to get XML::Simple and I'm having trouble. I haven't used
> PPM in a while, but I can't seem to get it to return a listing when I
> search for XML (it just hangs there until I Ctrl-C). I assume it could
> be a firewall issue (I have Windows XP firewall), but I turned it off
> and it did the same thing. I tried getting the file from CPAN, but have
> never loaded a module without PPM.
>
> Can anyone offer suggestions?
> Thanks
> Doug
------------------------------
Date: Wed, 16 Mar 2005 22:01:27 GMT
From: "Doug Wells" <doug@taperedsquare.com>
Subject: Re: PPM not working
Message-Id: <X02_d.39$ix1.2831@news.uswest.net>
Jin Sun wrote:
> This what I've done for the similar problem. Hope this may help.
>
> Go to you internet browser (e.g. IE), choose tools/internet
> options/connections, in LAN settings, check Proxy server and put proxy
> server name and port there. Set an enviromential variable
> HTTP_proxy="http://proxyservername:port". In ppm, type search * and
> wait for a while(be patient), it's going to return a list.
>
> "Doug Wells" <doug@taperedsquare.com> wrote in message
> news:CQ_Zd.15$fG.916@news.uswest.net...
> > I'm trying to get XML::Simple and I'm having trouble. I haven't used
> > PPM in a while, but I can't seem to get it to return a listing when
> > I search for XML (it just hangs there until I Ctrl-C). I assume it
> > could be a firewall issue (I have Windows XP firewall), but I
> > turned it off and it did the same thing. I tried getting the file
> > from CPAN, but have never loaded a module without PPM.
> >
> > Can anyone offer suggestions?
> > Thanks
> > Doug
Thanks for the response. That didn't work for me, but I'll play around
with that concept.
Doug
------------------------------
Date: Wed, 16 Mar 2005 17:38:26 -0500
From: Ken <x3v0-usenet@yahoo.com>
Subject: Re: PPM not working
Message-Id: <Dz2_d.156$Ba6.149@fe37.usenetserver.com>
You can download ppms from activestate directly from:
http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/
After downloading a activestate ppm, unzip it then just run the ppd file
through ppm:
ppm c:/path/to/module-name.ppd
The problem with this is that activestate does not have a ppm for
XML::Simple. Don't worry, you can get it here:
http://theoryx5.uwinnipeg.ca/ppms/XML-Simple.ppd
Note that the above ppm is going to try pulling the module from the
theoryx5 site, so if you have a firewall problem it may still fail. In
that case, you can download the module from:
http://theoryx5.uwinnipeg.ca/ppms/x86/XML-Simple.tar.gz
Then edit the XML-Simple.ppd file. Change this line:
<CODEBASE HREF="http://theoryx5.uwinnipeg.ca/ppms/x86/XML-Simple.tar.gz" />
To this:
<CODEBASE HREF="XML-Simple.tar.gz" />
Then run the newly edited ppd file through ppm (making sure
XML-Simple.tar.gz is the same directory as XML-Simple.ppd)
- Ken
Doug Wells wrote:
> I'm trying to get XML::Simple and I'm having trouble. I haven't used
> PPM in a while, but I can't seem to get it to return a listing when I
> search for XML (it just hangs there until I Ctrl-C). I assume it could
> be a firewall issue (I have Windows XP firewall), but I turned it off
> and it did the same thing. I tried getting the file from CPAN, but have
> never loaded a module without PPM.
>
> Can anyone offer suggestions?
> Thanks
> Doug
------------------------------
Date: Wed, 16 Mar 2005 23:18:26 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: PPM not working
Message-Id: <4238ce61$0$27585$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Doug Wells wrote:
> I'm trying to get XML::Simple and I'm having trouble. I haven't used
> PPM in a while, but I can't seem to get it to return a listing when I
> search for XML (it just hangs there until I Ctrl-C). I assume it could
> be a firewall issue (I have Windows XP firewall), but I turned it off
> and it did the same thing. I tried getting the file from CPAN, but have
> never loaded a module without PPM.
>
> Can anyone offer suggestions?
Ships as standard with ActiveState perl - which is probably why they
don't have a ppm package for it.
Anyway - if you're running AS perl, you already have XML-Simple.
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Wed, 16 Mar 2005 19:50:41 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Probably a dumb s/// question.
Message-Id: <l60_d.60224$gJ3.48199@clgrps13>
Glenn Jackman wrote:
> At 2005-03-16 11:14AM, Mark Healey <die@spammer.die> wrote:
>
>> For example I'd like to turn
>> the quick brown fox jumped over the lazy dogs.
>> to
>> The Quick Brown Fox Jumped Over the Lazy Dogs.
>>
>> Is this doable on a single line?
>
>
> my $string = 'the quick brown fox jumped over the lazy dogs.';
> my $String = join ' ', map {ucfirst lc} split ' ', $string;
>
> That forces your string to lower case first then capitalizes the first
> letter. It won't preserve whitespace though.
If you want to preserve whitespace:
my $String = join '', map {ucfirst lc} split /(\s+)/, $string;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 16 Mar 2005 19:50:57 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Probably a dumb s/// question.
Message-Id: <d1a2cb$n2a$1@sun3.bham.ac.uk>
Ted Zlatanov wrote:
> On Wed, 16 Mar 2005, mritty@gmail.com wrote:
>
>
>>s/(^|\s)([a-z])/$1\u$2/g;
>
>
> I always find it better to work with Perl built-ins such as ucfirst
Err... is \u not the same thing as ucfirst?
------------------------------
Date: Wed, 16 Mar 2005 22:57:11 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Probably a dumb s/// question.
Message-Id: <zcSdnRHDQKpXJKXfRVnytQ@pipex.net>
John W. Krahn wrote:
> If you want to preserve whitespace:
...then remember \b
$string =~ s/\b(.)/\u$1/g;
Still doesn't help with deciding which "words" not to capitalize.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: Wed, 16 Mar 2005 17:52:21 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Probably a dumb s/// question.
Message-Id: <slrnd3hhll.dv0.tadmc@magna.augustmail.com>
Ted Zlatanov <tzz@lifelogs.com> wrote:
> On Wed, 16 Mar 2005, mritty@gmail.com wrote:
>
>> s/(^|\s)([a-z])/$1\u$2/g;
>
> I always find it better to work with Perl built-ins such as ucfirst
> and \w, which respect locale and know about Unicode uppercasing rules.
\u _is_ ucfirst(), it respects locales too.
> Any time I see a range like [a-z] or [A-Za-z]
Ahh, now that is a different thing.
> I try to reduce it to at
> least a POSIX class like [:alpha:] unless I must only accept [a-z].
For this application, we don't need to ensure that it is a letter at all:
s/(^|\s)(.)/$1\u$2/g;
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 16 Mar 2005 18:34:43 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Probably a dumb s/// question.
Message-Id: <slrnd3hk53.dv0.tadmc@magna.augustmail.com>
Ted Zlatanov <tzz@lifelogs.com> wrote:
> On 16 Mar 2005, xx087@freenet.carleton.ca wrote:
>
>> my $string = 'the quick brown fox jumped over the lazy dogs.';
>> my $String = join ' ', map {ucfirst lc} split ' ', $string;
>>
>> That forces your string to lower case first then capitalizes the first
>> letter. It won't preserve whitespace though.
>
> It's probably better to do something like this:
>
> perl -p -e's/(\w+)/ucfirst($1)/eg'
Try it on this string:
it's a wonderful life!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 16 Mar 2005 19:25:41 +0000 (UTC)
From: Cyde Weys <cyde@umd.edu>
Subject: Regex - every character but "
Message-Id: <Xns961B92C47E7CD2galopagosterrapincy@128.8.10.18>
How do I write a negative character class? I.e. everything except a
certain character or a certain few characters? For instance, lets say I
wanted to represent all valid ASCII characters that can appear in a string.
It'd go something like this:
/"[A-Za-z0-9_ ~!@#\$%^&*()+\- ....... ]*"/ etc (some skipped for brevity)
Basically it would be everything on the keyboard except for "
There has to be a better way :-/
--
~ Cyde Weys ~
So say we all.
------------------------------
Date: Wed, 16 Mar 2005 14:39:45 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Regex - every character but "
Message-Id: <4nd5tzl6ri.fsf@lifelogs.com>
On Wed, 16 Mar 2005, cyde@umd.edu wrote:
> How do I write a negative character class? I.e. everything except a
> certain character or a certain few characters? For instance, lets say I
> wanted to represent all valid ASCII characters that can appear in a string.
> It'd go something like this:
>
> /"[A-Za-z0-9_ ~!@#\$%^&*()+\- ....... ]*"/ etc (some skipped for brevity)
>
> Basically it would be everything on the keyboard except for "
>
> There has to be a better way :-/
Read "perldoc perlre" carefully. It's very useful.
Negated character classes are done with [^abc], for instance, to mean
"everything except a, b, or c". So [^"] should do what you need.
Ted
------------------------------
Date: Wed, 16 Mar 2005 14:47:41 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Regex - every character but "
Message-Id: <ue2dneHSQM_CEKXfRVn-ug@adelphia.com>
Cyde Weys wrote:
> How do I write a negative character class? I.e. everything except a
> certain character or a certain few characters?
Prefix it with ^. As the first character in a regex, ^ anchors the match to
the beginning of the target, but as the first character in a character
class, it negates the class. So, the example class from the subject is:
[^"]
> For instance, lets say I
> wanted to represent all valid ASCII characters that can appear in a
> string.
That's a different question entirely - the valid range of ASCII character
codes is 0-127, so a character class that includes all that is:
[\x00..\x7f]
> Basically it would be everything on the keyboard except for "
"The" keyboard? No such beast. The characters available on any given kb will
vary.
Again, this contradicts both of your earlier questions. " is a perfectly
valid character that can appear in a string with no problem. And, there are
often *lots* of keys with codes that fall outside of the standard ASCII
range - especially when non-English users start typing accented characters
such as ü or ç.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Wed, 16 Mar 2005 19:54:05 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regex - every character but "
Message-Id: <x90_d.38115$ZO2.37023@edtnps84>
Cyde Weys wrote:
> How do I write a negative character class? I.e. everything except a
> certain character or a certain few characters? For instance, lets say I
> wanted to represent all valid ASCII characters that can appear in a string.
> It'd go something like this:
>
> /"[A-Za-z0-9_ ~!@#\$%^&*()+\- ....... ]*"/ etc (some skipped for brevity)
>
> Basically it would be everything on the keyboard except for "
>
> There has to be a better way :-/
/"[^"[:^ascii:]]*"/
John
--
use Perl;
program
fulfillment
------------------------------
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 7889
***************************************