[29984] in Perl-Users-Digest
Perl-Users Digest, Issue: 1227 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 24 00:09:44 2008
Date: Wed, 23 Jan 2008 21:09:07 -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, 23 Jan 2008 Volume: 11 Number: 1227
Today's topics:
Re: Can't Install Perl as Non-Root <Dawmail333@gmail.com>
Re: Can't Install Perl as Non-Root <ben@morrow.me.uk>
Re: Can't Install Perl as Non-Root <Dawmail333@gmail.com>
Re: Can't Install Perl as Non-Root <ben@morrow.me.uk>
Re: Can't Install Perl as Non-Root <Dawmail333@gmail.com>
Re: Can't Install Perl as Non-Root <Dawmail333@gmail.com>
Re: Multiple File upload <john.swilting@wanadoo.fr>
Re: Problem relaying uploads <ben@morrow.me.uk>
Re: RegEx, how to seperate word from digits? <sensorflo@gmail.com>
Re: RegEx, how to seperate word from digits? <kirk@hdsdata.com>
Re: RegEx, how to seperate word from digits? (Greg Bacon)
Re: RegEx, how to seperate word from digits? <abigail@abigail.be>
Re: sorting a list of objects using one of their method <sensorflo@gmail.com>
Re: sorting a list of objects using one of their method <uri@stemsystems.com>
Re: sorting a list of objects using one of their method <john@castleamber.com>
Re: sorting a list of objects using one of their method <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 23 Jan 2008 17:23:45 -0800 (PST)
From: dawmail333 <Dawmail333@gmail.com>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <089512a5-3989-40f6-905b-b98e8b312b1f@s8g2000prg.googlegroups.com>
On Jan 24, 1:41=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth dawmail333 <Dawmail...@gmail.com>:
>
> > On Jan 19, 5:12=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > > File::Find is trying to work out its cwd, which means it needs to be
> > > able to readdir all the directories down from /. Do you not have read
> > > permission on /home?
>
> <snip>
> > > Is it possible for you to build perl (not necessarily install perl) in=
a
> > > directory where you *can* read all the directories down from /? Perhap=
s
> > > /tmp, if there's enough room there? Otherwise, try 5.10.0, which has a=
> > > newer version of Cwd that (at least on my machine) doesn't fail in the=
> > > same way.
>
> > I don't have read permissions in home, and I don't think I have write
> > in tmp either. =A0Doesn't that get removed anyway?
>
> It doesn't matter if it gets removed: you only need to build perl there,
> not install it, so you'd remove the build tree afterwards anyway.
>
>
>
> > I tried 5.10, and this is my new error.
>
> <snip>
> > make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
> > DynaLoader'
> > /bin/sh: line 1: /miniperl: No such file or directory
>
> This looks like the same problem: the Makefile is supposed to invoke
> miniperl by an absolute path, but it is failing because it can't work
> out its cwd. If you look at ext/Dynaloader/Makefile, what is ABSPERL set
> to (it's in the section called 'MakeMaker constants section')? It should
> be an absolute path to miniperl in the build directory.
>
> I suspect you may not be able to fix this, as MakeMaker needs to know
> its cwd, even after perl is installed. Can you find it at all? What do
> you get if you run, from the build directory,
>
> =A0 =A0 /bin/pwd
> =A0 =A0 ./miniperl -Ilib -MCwd -le'print Cwd::getcwd'
> =A0 =A0 ./miniperl -Ilib -MCwd -le'print Cwd::cwd'
>
> If one of those works, you may be able to patch MakeMaker to use it.
>
> Ben
This line works:
=2E/miniperl -Ilib -MCwd -le'print Cwd::cwd'
So how do I patch Dynaloader?
------------------------------
Date: Thu, 24 Jan 2008 02:46:21 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <toal65-sg3.ln1@osiris.mauzo.dyndns.org>
Quoth dawmail333 <Dawmail333@gmail.com>:
> On Jan 24, 1:41 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth dawmail333 <Dawmail...@gmail.com>:
> > > On Jan 19, 5:12 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> >
> > > > File::Find is trying to work out its cwd, which means it needs to be
> > > > able to readdir all the directories down from /. Do you not have read
> > > > permission on /home?
> >
<snip>
> > > I tried 5.10, and this is my new error.
> >
<snip>
> > I suspect you may not be able to fix this, as MakeMaker needs to know
> > its cwd, even after perl is installed. Can you find it at all? What do
> > you get if you run, from the build directory,
> >
> > /bin/pwd
> > ./miniperl -Ilib -MCwd -le'print Cwd::getcwd'
> > ./miniperl -Ilib -MCwd -le'print Cwd::cwd'
> >
> > If one of those works, you may be able to patch MakeMaker to use it.
>
> This line works:
> ./miniperl -Ilib -MCwd -le'print Cwd::cwd'
> So how do I patch Dynaloader?
Apply this patch with patch -p0 <cwd.patch from in the perl source
directory. Check after you have installed perl that you can still
install XS modules sucessfully, and make sure you don't upgrade
File::Spec (if you do, you'll need to patch it again) :). Could you let
me know if this works? If it does I'll suggest it to the File::Spec
maintainer.
Ben
--- lib/File/Spec/Unix.pm Tue Dec 18 10:47:07 2007
+++ lib/File/Spec/Unix.pm.cwd Thu Jan 24 02:38:09 2008
@@ -475,7 +475,7 @@
# File::Spec subclasses use this.
sub _cwd {
require Cwd;
- Cwd::getcwd();
+ Cwd::cwd();
}
------------------------------
Date: Wed, 23 Jan 2008 19:22:20 -0800 (PST)
From: dawmail333 <Dawmail333@gmail.com>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <6d4eb83a-4bd1-4348-bde1-c4aaaa0c5e55@e25g2000prg.googlegroups.com>
On Jan 24, 12:46=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth dawmail333 <Dawmail...@gmail.com>:
>
>
>
> > On Jan 24, 1:41=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> > > Quoth dawmail333 <Dawmail...@gmail.com>:
> > > > On Jan 19, 5:12=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > > > > File::Find is trying to work out its cwd, which means it needs to =
be
> > > > > able to readdir all the directories down from /. Do you not have r=
ead
> > > > > permission on /home?
>
> <snip>
> > > > I tried 5.10, and this is my new error.
>
> <snip>
> > > I suspect you may not be able to fix this, as MakeMaker needs to know
> > > its cwd, even after perl is installed. Can you find it at all? What do=
> > > you get if you run, from the build directory,
>
> > > =A0 =A0 /bin/pwd
> > > =A0 =A0 ./miniperl -Ilib -MCwd -le'print Cwd::getcwd'
> > > =A0 =A0 ./miniperl -Ilib -MCwd -le'print Cwd::cwd'
>
> > > If one of those works, you may be able to patch MakeMaker to use it.
>
> > This line works:
> > ./miniperl -Ilib -MCwd -le'print Cwd::cwd'
> > So how do I patch Dynaloader?
>
> Apply this patch with patch -p0 <cwd.patch from in the perl source
> directory. Check after you have installed perl that you can still
> install XS modules sucessfully, and make sure you don't upgrade
> File::Spec (if you do, you'll need to patch it again) :). Could you let
> me know if this works? If it does I'll suggest it to the File::Spec
> maintainer.
>
> Ben
>
> --- lib/File/Spec/Unix.pm =A0 =A0 =A0 Tue Dec 18 10:47:07 2007
> +++ lib/File/Spec/Unix.pm.cwd =A0 Thu Jan 24 02:38:09 2008
> @@ -475,7 +475,7 @@
> =A0# File::Spec subclasses use this.
> =A0sub _cwd {
> =A0 =A0 =A0require Cwd;
> - =A0 =A0Cwd::getcwd();
> + =A0 =A0Cwd::cwd();
> =A0}
Sorry, I'm not a terribly knowledgeable person about Linux. Could you
please give me easy, step by step commands to follow? I can access a
terminal and all that, but I have never installed Perl before, and
don't understand what you are saying.
------------------------------
Date: Thu, 24 Jan 2008 04:22:20 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <scgl65-7l4.ln1@osiris.mauzo.dyndns.org>
Quoth dawmail333 <Dawmail333@gmail.com>:
> On Jan 24, 12:46 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> >
<snip>
> > Apply this patch with patch -p0 <cwd.patch from in the perl source
> > directory. Check after you have installed perl that you can still
> > install XS modules sucessfully, and make sure you don't upgrade
> > File::Spec (if you do, you'll need to patch it again) :). Could you let
> > me know if this works? If it does I'll suggest it to the File::Spec
> > maintainer.
>
> Sorry, I'm not a terribly knowledgeable person about Linux. Could you
> please give me easy, step by step commands to follow? I can access a
> terminal and all that, but I have never installed Perl before, and
> don't understand what you are saying.
OK, that's fine :).
- Save this message somewhere, and transfer it to the machine you're
building perl on. Make sure your newsreader/ftp client/whatever
doesn't mangle it.
- Delete your perl build directory and untar it again.
rm -rf perl-5.10.0
tar -xzvf perl-5.10.0.tar.gz
- Copy this message into the new perl-5.10.0 directory as cwd.patch.
cp this.message perl-5.10.0/cwd.patch
- cd into the perl build directory.
cd perl-5.10.0
- Run the command
patch -p0 <cwd.patch
- Try to build perl again.
- If it succeeds, and installs correctly, try installing an XS
module from CPAN, to make sure it works. Something like
/path/to/new/perl -MCPAN -e'force(install => "Scalar::Util")'
. This should succeed.
If you could post the output of
/path/to/new/perl -MCwd -le'print Cwd::cwd'
/path/to/new/perl -MCwd -le'print Cwd::getcwd'
after installing, this would be helpful: at least on my system, getcwd
only fails under miniperl, as getcwd(3) has kernel support and doesn't
need readable directories.
Ben
[patch appended again]
--- lib/File/Spec/Unix.pm Thu Jan 24 04:18:08 2008
+++ lib/File/Spec/Unix.pm.cwd Thu Jan 24 04:19:40 2008
@@ -475,7 +475,7 @@
# File::Spec subclasses use this.
sub _cwd {
require Cwd;
- Cwd::getcwd();
+ Cwd::cwd();
}
------------------------------
Date: Wed, 23 Jan 2008 20:45:44 -0800 (PST)
From: dawmail333 <Dawmail333@gmail.com>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <5f038fad-664e-4cce-be31-bb2ed01f6606@f10g2000hsf.googlegroups.com>
On Jan 24, 2:22=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth dawmail333 <Dawmail...@gmail.com>:
>
> > On Jan 24, 12:46=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> <snip>
> > > Apply this patch with patch -p0 <cwd.patch from in the perl source
> > > directory. Check after you have installed perl that you can still
> > > install XS modules sucessfully, and make sure you don't upgrade
> > > File::Spec (if you do, you'll need to patch it again) :). Could you le=
t
> > > me know if this works? If it does I'll suggest it to the File::Spec
> > > maintainer.
>
> > Sorry, I'm not a terribly knowledgeable person about Linux. =A0Could you=
> > please give me easy, step by step commands to follow? =A0I can access a
> > terminal and all that, but I have never installed Perl before, and
> > don't understand what you are saying.
>
> OK, that's fine :).
>
> =A0 =A0 - Save this message somewhere, and transfer it to the machine you'=
re
> =A0 =A0 =A0 building perl on. Make sure your newsreader/ftp client/whateve=
r
> =A0 =A0 =A0 doesn't mangle it.
>
> =A0 =A0 - Delete your perl build directory and untar it again.
>
> =A0 =A0 =A0 =A0 rm -rf perl-5.10.0
> =A0 =A0 =A0 =A0 tar -xzvf perl-5.10.0.tar.gz
>
> =A0 =A0 - Copy this message into the new perl-5.10.0 directory as cwd.patc=
h.
>
> =A0 =A0 =A0 =A0 cp this.message perl-5.10.0/cwd.patch
>
> =A0 =A0 - cd into the perl build directory.
>
> =A0 =A0 =A0 =A0 cd perl-5.10.0
>
> =A0 =A0 - Run the command
>
> =A0 =A0 =A0 =A0 patch -p0 <cwd.patch
>
> =A0 =A0 - Try to build perl again.
>
> =A0 =A0 - If it succeeds, and installs correctly, try installing an XS
> =A0 =A0 =A0 module from CPAN, to make sure it works. Something like
>
> =A0 =A0 =A0 =A0 /path/to/new/perl -MCPAN -e'force(install =3D> "Scalar::Ut=
il")'
>
> =A0 =A0 =A0 . This should succeed.
>
> If you could post the output of
>
> =A0 =A0 /path/to/new/perl -MCwd -le'print Cwd::cwd'
> =A0 =A0 /path/to/new/perl -MCwd -le'print Cwd::getcwd'
>
> after installing, this would be helpful: at least on my system, getcwd
> only fails under miniperl, as getcwd(3) has kernel support and doesn't
> need readable directories.
>
> Ben
>
> [patch appended again]
>
> --- lib/File/Spec/Unix.pm =A0 =A0 =A0 Thu Jan 24 04:18:08 2008
> +++ lib/File/Spec/Unix.pm.cwd =A0 Thu Jan 24 04:19:40 2008
> @@ -475,7 +475,7 @@
> =A0# File::Spec subclasses use this.
> =A0sub _cwd {
> =A0 =A0 =A0require Cwd;
> - =A0 =A0Cwd::getcwd();
> + =A0 =A0Cwd::cwd();
> =A0}
That patch didn't work, so I manually changed the line in question.
It then went much further, until:
including snprintf
including exception
including strlfuncs
running /home/.bazooka/dawliam/perl-5.10.0/miniperl -I../../../lib
ppport_h.PL
installing ppport.h for ext/Time/HiRes
installing ppport.h for ext/Win32API/File
removing temporary file PPPort.pm
removing temporary file ppport.h
Making B (dynamic)
opendir(./../../../../..): Permission denied at ../../lib/File/Find.pm
line 605
Use of chdir('') or chdir(undef) as chdir() is deprecated at ../../lib/
File/Find
=2Epm line 768.
Writing Makefile for B
Warning: No Makefile!
make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
make[1]: *** No rule to make target `config'. Stop.
make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
make config failed, continuing anyway...
make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
make[1]: *** No rule to make target `all'. Stop.
make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
make: *** [lib/auto/B/B.so] Error 2
[hyperion]$
Is this another error to do with not being able to read the /home/ dir?
------------------------------
Date: Wed, 23 Jan 2008 20:53:33 -0800 (PST)
From: dawmail333 <Dawmail333@gmail.com>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <27e0c82c-6e82-483a-9b23-201f7ceee8d5@v46g2000hsv.googlegroups.com>
On Jan 24, 2:45=A0pm, dawmail333 <Dawmail...@gmail.com> wrote:
> On Jan 24, 2:22=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
>
>
> > Quoth dawmail333 <Dawmail...@gmail.com>:
>
> > > On Jan 24, 12:46=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > <snip>
> > > > Apply this patch with patch -p0 <cwd.patch from in the perl source
> > > > directory. Check after you have installed perl that you can still
> > > > install XS modules sucessfully, and make sure you don't upgrade
> > > > File::Spec (if you do, you'll need to patch it again) :). Could you =
let
> > > > me know if this works? If it does I'll suggest it to the File::Spec
> > > > maintainer.
>
> > > Sorry, I'm not a terribly knowledgeable person about Linux. =A0Could y=
ou
> > > please give me easy, step by step commands to follow? =A0I can access =
a
> > > terminal and all that, but I have never installed Perl before, and
> > > don't understand what you are saying.
>
> > OK, that's fine :).
>
> > =A0 =A0 - Save this message somewhere, and transfer it to the machine yo=
u're
> > =A0 =A0 =A0 building perl on. Make sure your newsreader/ftp client/whate=
ver
> > =A0 =A0 =A0 doesn't mangle it.
>
> > =A0 =A0 - Delete your perl build directory and untar it again.
>
> > =A0 =A0 =A0 =A0 rm -rf perl-5.10.0
> > =A0 =A0 =A0 =A0 tar -xzvf perl-5.10.0.tar.gz
>
> > =A0 =A0 - Copy this message into the new perl-5.10.0 directory as cwd.pa=
tch.
>
> > =A0 =A0 =A0 =A0 cp this.message perl-5.10.0/cwd.patch
>
> > =A0 =A0 - cd into the perl build directory.
>
> > =A0 =A0 =A0 =A0 cd perl-5.10.0
>
> > =A0 =A0 - Run the command
>
> > =A0 =A0 =A0 =A0 patch -p0 <cwd.patch
>
> > =A0 =A0 - Try to build perl again.
>
> > =A0 =A0 - If it succeeds, and installs correctly, try installing an XS
> > =A0 =A0 =A0 module from CPAN, to make sure it works. Something like
>
> > =A0 =A0 =A0 =A0 /path/to/new/perl -MCPAN -e'force(install =3D> "Scalar::=
Util")'
>
> > =A0 =A0 =A0 . This should succeed.
>
> > If you could post the output of
>
> > =A0 =A0 /path/to/new/perl -MCwd -le'print Cwd::cwd'
> > =A0 =A0 /path/to/new/perl -MCwd -le'print Cwd::getcwd'
>
> > after installing, this would be helpful: at least on my system, getcwd
> > only fails under miniperl, as getcwd(3) has kernel support and doesn't
> > need readable directories.
>
> > Ben
>
> > [patch appended again]
>
> > --- lib/File/Spec/Unix.pm =A0 =A0 =A0 Thu Jan 24 04:18:08 2008
> > +++ lib/File/Spec/Unix.pm.cwd =A0 Thu Jan 24 04:19:40 2008
> > @@ -475,7 +475,7 @@
> > =A0# File::Spec subclasses use this.
> > =A0sub _cwd {
> > =A0 =A0 =A0require Cwd;
> > - =A0 =A0Cwd::getcwd();
> > + =A0 =A0Cwd::cwd();
> > =A0}
>
> That patch didn't work, so I manually changed the line in question.
> It then went much further, until:
>
> including snprintf
> including exception
> including strlfuncs
> running /home/.bazooka/dawliam/perl-5.10.0/miniperl -I../../../lib
> ppport_h.PL
> installing ppport.h for ext/Time/HiRes
> installing ppport.h for ext/Win32API/File
> removing temporary file PPPort.pm
> removing temporary file ppport.h
>
> =A0 =A0 =A0 =A0 Making B (dynamic)
> opendir(./../../../../..): Permission denied at ../../lib/File/Find.pm
> line 605
> Use of chdir('') or chdir(undef) as chdir() is deprecated at ../../lib/
> File/Find
> .pm line 768.
> Writing Makefile for B
> Warning: No Makefile!
> make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
> make[1]: *** No rule to make target `config'. =A0Stop.
> make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
> make config failed, continuing anyway...
> make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
> make[1]: *** No rule to make target `all'. =A0Stop.
> make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/B'
> make: *** [lib/auto/B/B.so] Error 2
> [hyperion]$
>
> Is this another error to do with not being able to read the /home/ dir?
Sorry, I fixed this problem as well. I have hit another one:
make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
Digest/SHA'
Making Encode (dynamic)
opendir(../../lib/../../../..): Permission denied at ../../lib/
ExtUtils/MakeMake
r.pm line 182
opendir(./../../../../..): Permission denied at ../../lib/ExtUtils/
MakeMaker.pm
line 182
ERROR from evaluation of /home/.bazooka/dawliam/perl-5.10.0/ext/Encode/
Byte/Make
file.PL: Can't locate File/Spec/Functions.pm in @INC (@INC
contains: ../../lib /
home/.bazooka/dawliam/bin/perl/lib/5.10.0/i686-linux /home/.bazooka/
dawliam/bin/
perl/lib/5.10.0 /home/.bazooka/dawliam/bin/perl/lib/site_perl/5.10.0/
i686-linux
/home/.bazooka/dawliam/bin/perl/lib/site_perl/5.10.0 . .) at ./
Makefile.PL line
4.
BEGIN failed--compilation aborted at ./Makefile.PL line 4.
Warning: No Makefile!
make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
Encode'
make[1]: *** No rule to make target `config'. Stop.
make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
Encode'
make config failed, continuing anyway...
make[1]: Entering directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
Encode'
make[1]: *** No rule to make target `all'. Stop.
make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
Encode'
make: *** [lib/auto/Encode/Encode.so] Error 2
[hyperion]$
/home/.bazooka/dawliam/perl-5.10.0/ext/Encode/lib/auto doesn't exist.
/home/.bazooka/dawliam/perl-5.10.0/lib/auto/Encode/Encode.so doesn't
exist.
What do I need to do now?
Oh BTW, thanks for the help so far.
------------------------------
Date: Thu, 24 Jan 2008 01:27:27 +0100
From: swilting <john.swilting@wanadoo.fr>
Subject: Re: Multiple File upload
Message-Id: <4797dd83$0$901$ba4acef3@news.orange.fr>
Gunnar Hjalmarsson wrote:
> vijay@iavian.com wrote:
>> How do i upload multiple files with the same name and handle it using
>> cgi-lib?
>
> Unless somebody is inclined to give you a history lesson on cgi-lib.pl,
> the Perl 5 module CGI::UploadEasy (with CGI.pm behind the scenes) will
> probably do what you need.
>
yes i do
that
at the same with my crew
------------------------------
Date: Wed, 23 Jan 2008 23:38:22 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Problem relaying uploads
Message-Id: <eovk65-b92.ln1@osiris.mauzo.dyndns.org>
Quoth smallpond <smallpond@juno.com>:
>
> Doh. What am I thinking. This will never work. curl
> is sending form fields, not the file. When a form has
> input type="file" name="somename" size="chars"
> the client browser is packing up the file and sending
> it along in a multipart request. curl has no clue how to
> do that. You could write the whole thing in perl
> and issue the request to the server. The basics of file
> input type are here:
>
> http://www.cs.tut.fi/~jkorpela/forms/file.html
>
> It would require you to create the whole multipart form request
> with the file properly MIME-encoded, then connect to the web
> server and ship up the whole thing.
LWP will handle this trivially.
Ben
------------------------------
Date: Wed, 23 Jan 2008 13:12:39 -0800 (PST)
From: Florian Kaufmann <sensorflo@gmail.com>
Subject: Re: RegEx, how to seperate word from digits?
Message-Id: <920656a6-25af-4c81-b91d-ca6967e7ad72@i12g2000prf.googlegroups.com>
Similar to smallpond's answer, however enforces that the word- and the
digitpart are at least 1 character long. Else, also things like "3"
"x" or even the empty string "" are found.
my ($word,$digit) = /([[:alpha:]]+)\s*(\d+)/;
# do something with $word and $digit
------------------------------
Date: Wed, 23 Jan 2008 13:53:56 -0800 (PST)
From: kirknew2Reg <kirk@hdsdata.com>
Subject: Re: RegEx, how to seperate word from digits?
Message-Id: <c43a4a43-86d3-47b8-9c7f-d7d4369a4492@d21g2000prg.googlegroups.com>
On Jan 23, 1:12=A0pm, Florian Kaufmann <sensor...@gmail.com> wrote:
> Similar to smallpond's answer, however enforces that the word- and the
> digitpart are at least 1 character long. Else, also things like "3"
> "x" or even the empty string "" are found.
>
> my ($word,$digit) =3D /([[:alpha:]]+)\s*(\d+)/;
> # do something with $word and $digit
Thanks for the help. the solution worked.
------------------------------
Date: Wed, 23 Jan 2008 22:30:31 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: RegEx, how to seperate word from digits?
Message-Id: <13pfg07d22dvn1e@corp.supernews.com>
kirknew2Reg <kirk@hdsdata.com> wrote:
: I have a column that contains "suite 111" and "suite222"I need a $
: variable containing the word part and aother $ variable containing
: the digit part. I have tried variations on this syntax:
:
: (\w*)(\d*)(.*)
: (\w*)(\s?)(\d*)(.*)
:
: But nothig I have tried seperates the word from the digits when
: there is no space. How do i get 'suite222' to brake in to seperate
: variables?
Another handy trick is the double-negative:
$ cat try
#! /usr/bin/perl
for ("suite 111", "suite222") {
if (/^([^\W\d]+)\s*(\d+)$/) {
print "$_: $1 - $2\n";
}
else {
print "$_: no match\n";
}
}
$ ./try
suite 111: suite - 111
suite222: suite - 222
It's easy to forget that \w matches both alphabetic characters
and numeric characters. (Don't forget about the poor underscore!)
Written out longhand, the pattern [^\W\d] is
NOT [ (NOT a word character) OR (a digit) ]
Apply DeMorgan's theorem to see that this is equivalent to "a
word character that isn't a digit."
Maybe our English teachers didn't know so much after all!
Hope this helps,
Greg
--
What light is to the eyes -- what air is to the lungs -- what love is to
the heart, liberty is to the soul of man.
-- Robert Green Ingersoll
------------------------------
Date: 23 Jan 2008 23:32:32 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: RegEx, how to seperate word from digits?
Message-Id: <slrnfpfjkg.pb5.abigail@alexandra.abigail.be>
_
Greg Bacon (gbacon@hiwaay.net) wrote on VCCLVIII September MCMXCIII in
<URL:news:13pfg07d22dvn1e@corp.supernews.com>:
;; kirknew2Reg <kirk@hdsdata.com> wrote:
;;
;; : I have a column that contains "suite 111" and "suite222"I need a $
;; : variable containing the word part and aother $ variable containing
;; : the digit part. I have tried variations on this syntax:
;; :
;; : (\w*)(\d*)(.*)
;; : (\w*)(\s?)(\d*)(.*)
;; :
;; : But nothig I have tried seperates the word from the digits when
;; : there is no space. How do i get 'suite222' to brake in to seperate
;; : variables?
;;
;; Another handy trick is the double-negative:
;;
;; $ cat try
;; #! /usr/bin/perl
;;
;; for ("suite 111", "suite222") {
;; if (/^([^\W\d]+)\s*(\d+)$/) {
;; print "$_: $1 - $2\n";
;; }
;; else {
;; print "$_: no match\n";
;; }
;; }
;;
;; $ ./try
;; suite 111: suite - 111
;; suite222: suite - 222
;;
;; It's easy to forget that \w matches both alphabetic characters
;; and numeric characters. (Don't forget about the poor underscore!)
Why so complicated with a double negative? Matching letters is easy:
\pL will match a letter. \d matches a digit. So, I'd use:
/(?<word>\pL+) \s* (?<number>\d+)/x;
Example code:
for ("suite 111", "suite222") {
if (/(?<word>\pL+) \s* (?<number>\d+)/x) {
say $+ {word}, " -- ", $+ {number};
}
}
__END__
suite -- 111
suite -- 222
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
------------------------------
Date: Wed, 23 Jan 2008 13:23:36 -0800 (PST)
From: Florian Kaufmann <sensorflo@gmail.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <49ddf274-85f4-4b6e-bce0-35c16b3949a5@d4g2000prg.googlegroups.com>
I can't help you with the error message. I only have an optimization
hint once it is running: If the method call is not cheap (in terms of
runtime) and if its result (per object) is const during the sort,
consider the Schwartzian Transform: http://en.wikipedia.org/wiki/Schwartzian_transform#History.
It only calls the name subroutine once per object, whereas the naive
approach calls it many many times per object. To be more precise,
assuming that the complexity of perl's sort is n*log(n), name would be
called log(n) per object.
# untested example:
@list =
map { $_->[0] }
sort { $a->[1] cmp $b->[1]}
map { [ $_, $_->name ] }
@list;
Flo
------------------------------
Date: Thu, 24 Jan 2008 00:39:00 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <x763xk5a6y.fsf@mail.sysarch.com>
>>>>> "FK" == Florian Kaufmann <sensorflo@gmail.com> writes:
FK> I can't help you with the error message. I only have an optimization
FK> hint once it is running: If the method call is not cheap (in terms of
FK> runtime) and if its result (per object) is const during the sort,
FK> consider the Schwartzian Transform: http://en.wikipedia.org/wiki/Schwartzian_transform#History.
FK> It only calls the name subroutine once per object, whereas the
FK> naive approach calls it many many times per object. To be more
FK> precise, assuming that the complexity of perl's sort is n*log(n),
FK> name would be called log(n) per object.
nope. name is called once per object and cached which makes it O(N). it
doesn't change the growth curve of sort but factors out the method call
so it is O(N) and not O(N * log N).
and if you want the ST or the faster GRT and don't want to deal with
coding it, use Sort::Maker which does all the work for you.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: 24 Jan 2008 01:51:14 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <Xns9A2EC9F7BD6B8castleamber@130.133.1.4>
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "FK" == Florian Kaufmann <sensorflo@gmail.com> writes:
>
> FK> I can't help you with the error message. I only have an
> optimization FK> hint once it is running: If the method call is not
> cheap (in terms of FK> runtime) and if its result (per object) is
> const during the sort, FK> consider the Schwartzian Transform:
> http://en.wikipedia.org/wiki/Schwartzian_transform#History.
>
> FK> It only calls the name subroutine once per object, whereas the
> FK> naive approach calls it many many times per object. To be more
> FK> precise, assuming that the complexity of perl's sort is
> n*log(n), FK> name would be called log(n) per object.
>
> nope. name is called once per object and cached which makes it O(N).
> it doesn't change the growth curve of sort but factors out the method
> call so it is O(N) and not O(N * log N).
I read FK as: naive requires O( log N) get_name calls per object. Each
comparison does 2 calls, so in total O( N * 2 * log N ) = O( N log N).
A simple test I wrote shows for:
10240 objects, shuffled, naive ~ 248, 086 calls, which is close to 10240
x 2 x log 10240.
Of course ST results in 10240 calls exactly.
--
John
Arachnids near Coyolillo - part 1
http://johnbokma.com/mexit/
------------------------------
Date: Thu, 24 Jan 2008 04:36:56 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <x7r6g73klz.fsf@mail.sysarch.com>
>>>>> "JB" == John Bokma <john@castleamber.com> writes:
JB> Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "FK" == Florian Kaufmann <sensorflo@gmail.com> writes:
>>
FK> I can't help you with the error message. I only have an
>> optimization FK> hint once it is running: If the method call is not
>> cheap (in terms of FK> runtime) and if its result (per object) is
>> const during the sort, FK> consider the Schwartzian Transform:
>> http://en.wikipedia.org/wiki/Schwartzian_transform#History.
>>
FK> It only calls the name subroutine once per object, whereas the
FK> naive approach calls it many many times per object. To be more
FK> precise, assuming that the complexity of perl's sort is
>> n*log(n), FK> name would be called log(n) per object.
>>
>> nope. name is called once per object and cached which makes it O(N).
>> it doesn't change the growth curve of sort but factors out the method
>> call so it is O(N) and not O(N * log N).
JB> I read FK as: naive requires O( log N) get_name calls per object. Each
JB> comparison does 2 calls, so in total O( N * 2 * log N ) = O( N log N).
JB> A simple test I wrote shows for:
JB> 10240 objects, shuffled, naive ~ 248, 086 calls, which is close to 10240
JB> x 2 x log 10240.
JB> Of course ST results in 10240 calls exactly.
not to be annoying, what is your point? you generated numbers that
agreed with my analysis. remember that O() math is about growth rates
and not about absolute counts. yes you can save a ton of real world work
with caching of sort keys but it still won't change the growth rate.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
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 1227
***************************************