[22203] in Perl-Users-Digest
Perl-Users Digest, Issue: 4424 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 18 00:05:45 2003
Date: Fri, 17 Jan 2003 21:05:05 -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 Fri, 17 Jan 2003 Volume: 10 Number: 4424
Today's topics:
Re: $x =~ s!(\d+)%!$1/100!e; <mgjv@tradingpost.com.au>
A Good Perl Developing Enviroment <alvarof2@hotmail.com>
Re: APL's relation to perl (Anno Siegel)
Re: Extraction from variable <mgjv@tradingpost.com.au>
Re: How do I calculate today minus any given number <jurgenex@hotmail.com>
Re: Most efficient way to do this DBI thing? <GPatnude@adelphia.net>
Re: most popular unix scripting language <mgjv@tradingpost.com.au>
Re: most popular unix scripting language <Cng.Gublgf@ovtsbbg.pbz>
Re: perl hashes seems to slow down (Anno Siegel)
Re: Problems sending an image with perl <GPatnude@adelphia.net>
Re: Problems sending an image with perl (Anno Siegel)
Re: Problems sending an image with perl <mgjv@tradingpost.com.au>
Re: Problems sending an image with perl (Tad McClellan)
Re: Recompile Perl with CPAN? (Ben Morrow)
Re: Recompile Perl with CPAN? (Anno Siegel)
Re: Recompile Perl with CPAN? <vhg@byu.edu>
Re: Recompile Perl with CPAN? <vhg@byu.edu>
Re: Recompile Perl with CPAN? <vhg@byu.edu>
Re: Recompile Perl with CPAN? (Anno Siegel)
THANKS Re: regex help plse <penny1482@attbi.com>
Re: THANKS Re: regex help plse (Tad McClellan)
Re: ~ Urgently require a Webpage Hit counter script !!? <jurgenex@hotmail.com>
Re: ~ Urgently require a Webpage Hit counter script !!? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Jan 2003 23:44:04 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: $x =~ s!(\d+)%!$1/100!e;
Message-Id: <slrnb2h5a4.oq9.mgjv@verbruggen.comdyn.com.au>
[Please, in the future, put your reply _after_ the suitably trimmed
text you reply to. This is the convention on this newsgroup and Usenet
in general, because it makes threads easier to follow, and conserves
bandwith and storage requirements for new. Thank you.]
On Fri, 17 Jan 2003 00:19:16 -0500,
istink <istink@real.bad.com> wrote:
> istink wrote:
>>
>> $x =~ s!(\d+)%!$1/100!e;
>>
>> I'm trying to convert a string of characters into ASCII.
>> and then, change ASCII into convert.
> ah-damn!
> this is what happens when I write in the middle of the night like I did
> last night and what I'm doing now.
> I ment something that would take typed text and convert it into ASCII
> numbers. then take ASCII numbers and convert them back to characters.
And this question was (more or less) answered. All you need to do is
check the chr() and ord() functions in perlfunc. However, they will
only do ASCII stuff if your environment does ASCII. Encoding is
platform specific, and you shouldn't rely on those numbers to mean
anything important.
Are you sure that you need to do this?
If so, what does it have to do with the code you added to your post
(the % to fraction conversion thingy)? I can't see in any way that
that would be an attempt to do what you say, in words, you need to do.
Martien
--
|
Martien Verbruggen | Think of the average person. Half of the
Trading Post Australia | people out there are dumber.
|
------------------------------
Date: Sat, 18 Jan 2003 04:17:18 GMT
From: "A. Fuentes" <alvarof2@hotmail.com>
Subject: A Good Perl Developing Enviroment
Message-Id: <iz4W9.43403$aG4.2586200@twister.austin.rr.com>
Fellow Perl Netters:
I have a newbie question:
What would be a good Perl Developing Enviroment for
managing and developing Perl projects?
(Visual Developer Studio-like)
Any suggestions will be appreciated.
Thanks in advance,
A. Fuentes
512-297-9937
------------------------------
Date: 18 Jan 2003 00:17:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: APL's relation to perl
Message-Id: <b0a6fe$58p$1@mamenchi.zrz.TU-Berlin.DE>
Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
> >>>>> "S" == Sara <genericax@hotmail.com> writes:
>
> S> Would I consider APL as a contemporary alternative to Perl? No way.
> S> Once you taste the power of the regex you can never go back. But could
> S> Perl learn a few more things about the power of primitive functions? I
> S> think so. As a "reporting language", some common reporting tasks are
> S> seemingly missing, and their inclusion would make Perl a more
> S> versatile tool. Sure you can probably find a lot of those functions in
> S> CPAN, but the core, in my opinion, could be a lot more powerful.
>
> you should take a peek at the perl 6 world. many of the apl vector
> flavored ops are getting into perl. you will be able to convert most
> common ops to a vector form, e.g. a scalar can be added to all elements
> of an array or two arrays can be compared element by element. there are
> too many other improvements to even list here. go to dev.perl.org and
> read the apocalyse and related docs.
Indeed. A syntax for multi-dimensional slices is also in the making,
which made me think of APL. This would include matrix transposition,
I suppose.
As for the mathematically oriented primitives like equation-solving,
matrix inversion, etc. those are available in languages like Maple
and Mathematica.
Mathematica is a fine language. If it were free and universally available
(it very much isn't) it might well become my default.
An APL-capable system must have been similarly expensive and exclusive.
The tremendous character set alone would be an abhorrent at a time when
everybody was going ASCII to use cheap standard equipment. It couldn't
become very popular.
Anno
------------------------------
Date: Fri, 17 Jan 2003 23:29:27 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Extraction from variable
Message-Id: <slrnb2h4en.oq9.mgjv@verbruggen.comdyn.com.au>
[Please, in the future, put your reply _after_ the text you reply to.
This is the convention on this newsgroup, and Usenet in general,
because it makes threads easier to follow. Thank you.]
On Fri, 17 Jan 2003 18:50:01 +0100,
Jon Rogers <jon@rogers.tv> wrote:
>
>> $var =~ s/[^a-zA-Z0-9]+//g;
>>
>> or if you don't mind leaving underscores in:
>
> Would this mean that $var now is untainted if I use -T mode?
No. Did you read perlsec to find out what you need to do to untaint a
variable?
$ man perlsec
[SNIP]
But testing for taintedness gets you only so far. Sometimes you have
just to clear your data's taintedness. The only way to bypass the
^^^^^^^^
tainting mechanism is by referencing subpatterns from a regular expres-
sion match.
[SNIP]
Note the underlined bit.
So, the other solution Tad posted would result in $var1 being
untainted:
my $var1 = join '', $var =~ /([a-zA-Z0-9]+)/g;
Please, do make sure you read and understand perlsec before relying on
Perl's taint mechanism. That mechanism is only a help to people who
want to be secure about what they do, it does not guarantee that what
you do is secure. That's up to you, and requires an understanding of
what it does and means.
Martien
--
|
Martien Verbruggen |
Trading Post Australia | What's another word for Thesaurus?
|
------------------------------
Date: Sat, 18 Jan 2003 01:01:59 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How do I calculate today minus any given number
Message-Id: <bI1W9.3095$xx4.829@nwrddc01.gnilink.net>
Sherman Willden wrote:
> Problem: Given today minus some number I have to know what that past
> date is. Example: If the user enters 30, what is the date 30 days ago
> from today. Today is 01/17/03 so what is the algorithm to return the
> December 2002 date?
>
> I have reviewed the faq and some past messages but I didn't find this
> particular problem. I probably have to use Date::Calc but I'm not
> sure. I have found some add routines but I didn't see any subtract
> routines.
perldoc -q yesterday
Generalizing the answer in the FAQ to an arbitrary number of days on the
past is left as a (simple) excercise.
jue
------------------------------
Date: Sat, 18 Jan 2003 01:24:40 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: Re: Most efficient way to do this DBI thing?
Message-Id: <s12W9.85645$VA5.13680344@news1.news.adelphia.net>
"Jeff Snoxell" <Jeff@aetherweb.co.uk> wrote in message
news:b089ou$q37$1@newsg2.svr.pol.co.uk...
> Hi again,
>
> I've got this code which takes a local copy of a hash from a hashref
> returned by a Perl DBI statement execution result set:
>
> my $tmp_record;
> my $record;
> my %record_hash;
>
> if ($tmp_record = $sth->fetchrow_hashref())
> {
> %record_hash = %$tmp_record
> $record = \%record_hash;
>
> # Now I can use my $record...
> print "Hello this is my record ID: " . $record->{'ID'};
> }
>
> (NB: I _need_ to take a copy of the hash as I will be making further DBI
> queries whilst still requiring access to the original record data and so,
as
> Perl DBI docs say I can't rely on their hashref not pointing to another
hash
> after a subsequent execution)
>
> Surely there's got to be a nicer way of doing this that doesn't involve
all
> these variables?
>
> Thanks,
>
>
> Jeff
>
>
Do your processing iniside of WHILE loops..
EXAMPLE:
$SQLSTMT = "SELECT cb_employer_plan.cb_employer_id,
cb_employer_plan.cb_plan_id AS plan_id,
cb_employer_plan.active_flag, cb_plan_type.plan_type_desc,
cb_plan_eligibility_type.plan_eligibility_type_desc,
cb_plan_collector.plan_title, cb_plan_collector.plan_identifier
FROM cb_employer_plan, cb_plan_type, cb_plan_eligibility_type,
cb_plan_collector
WHERE cb_employer_plan.cb_employer_id = $PARAMS{EMPLOYER_ID}
AND cb_employer_plan.cb_plan_id = cb_plan_collector.id
AND cb_plan_collector.plan_type_id = cb_plan_type.id
AND cb_plan_collector.plan_eligibility_id = cb_plan_eligibility_type.id
ORDER BY cb_plan_collector.plan_title, cb_plan_type.plan_type_desc,
cb_plan_eligibility_type.plan_eligibility_type_desc,
cb_employer_plan.active_flag";
$SQL = $DBH->prepare($SQLSTMT);
$result = $SQL->execute();
if ($SQL->rows()) {
while (my $REF = $SQL->fetchrow_hashref()) {
$PLAN_ID = $REF->{plan_id};
$ACTIVE_FLAG = $REF->{active_flag};
$PLAN_TYPE_DESC = $REF->{plan_type_desc};
$PLAN_ELIGIBILITY_TYPE_DESC = $REF->{plan_eligibility_type_desc};
$PLAN_TITLE = $REF->{plan_title};
$PLAN_IDENTIFIER = $REF->{plan_identifier};
if ($ACTIVE_FLAG == 1) {
$COLOR = "#1234CC";
$STATUS = 'Available';
} else {
$COLOR = "#FF4321";
$STATUS = '(Inactive)';
}
if ($PARAMS{PERSON_ID} ne "" ) {
$SQLSTMTB = "SELECT CB.cb_plan_id, CB.person_enrolled FROM
cb_person_plan CB, cb_employer_person CEP
WHERE CEP.employer_id = $PARAMS{EMPLOYER_ID} AND CEP.person_id =
$PARAMS{PERSON_ID} AND CEP.person_id = CB.cb_person_id AND CB.cb_plan_id =
$PLAN_ID;";
#sqlTrap("$SQLSTMTB");
$SQLB = $DBH->prepare($SQLSTMTB);
$result = $SQLB->execute();
if ($SQLB->rows()) {
while (my $REFB = $SQLB->fetchrow_hashref()) {
$CB_PLAN_ID = $REFB->{cb_plan_id};
$PERSON_ENROLLED = $REFB->{person_enrolled};
}
if ($CB_PLAN_ID == $PLAN_ID) {
$STATUS = 'Available';
$PLAN_ASSIGNED = 'CHECKED';
} else {
$PLAN_ASSIGNED = '';
}
if ($PERSON_ENROLLED == 1) {
$STATUS = 'Enrolled';
$ENROLLEDCOLOR = '#DDDDDD';
$COLOR = '#FF4321';
} else {
$STATUS = 'Not enrolled';
$ENROLLEDCOLOR = '';
}
} else {
$PLAN_ASSIGNED = '';
$ENROLLEDCOLOR = '';
}
}
$PLANLIST .= pm_readTemplate("$formdir/2064-planlistitemassign.html");
}
} else {
$PLANLIST = "There are no plans assigned or available for
$EMPLOYER_COMPANY_NAME. Until insurance plans are created and assigned,
$EMPLOYER_COMPANY_NAME's employees cannot ernorll for their benefits.";
}
------------------------------
Date: Fri, 17 Jan 2003 23:36:58 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: most popular unix scripting language
Message-Id: <slrnb2h4sq.oq9.mgjv@verbruggen.comdyn.com.au>
On Thu, 16 Jan 2003 23:48:37 -0600,
Tad McClellan <tadmc@augustmail.com> wrote:
> Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote:
>> In article <1fowrd4.17uarvm2og3v4N%tony@svanstrom.com>,
>> Tony L. Svanstrom <tony@svanstrom.com> wrote:
>>:> In article <f51c02db.0301161617.3622cfaa@posting.google.com>,
>>:> dambalaMaster <dorli@hotmail.com> wrote:
>>
>>:> >does anyone know which is the most popular unix scripting language?
>>
>>:sh
>>
>> Are you measuring by:
>> A) number of scripts written,
>> B) enthusiasm level of script authors, or
>> C) number of distinct script authors?
>
>
> By length of the scripting language's name. :-)
>
> So sh is going to be hard to beat (because C is compiled) :-) :-)
Not necessarily. But all C interpreters I know of have longer names
than the language (quincy, ch, cint), so they still wouldn't beat sh.
However, the question was what the most popular unix "scripting
language" is.
Of course, even defining scripting language is hard, and often results
in long, long threads on Usenet. I tend to not use the presence of an
interpreter as the indicator, because there are interpreters for many
languages that most people would definitely not class as scripting
languages. And there are languages that started their life as
"interpreted" languages and got compilers later on. Then, of course,
Perl is one of those "in between" compiled and interpreted languages.
Martien
--
|
Martien Verbruggen |
Trading Post Australia | Can't say that it is, 'cause it ain't.
|
------------------------------
Date: Sat, 18 Jan 2003 02:04:27 GMT
From: Pat Thoyts <Cng.Gublgf@ovtsbbg.pbz>
Subject: Re: most popular unix scripting language
Message-Id: <m27kd32oyq.fsf@binky.home.net>
jgil@gmv.es (Juan C. Gil) writes:
>There is a promising D compiled language
>(http://www.digitalmars.com/d/), but there is also
>a "D scripting language"
>(http://www.google.com/search?q=%22the+d+scripting+language%22).
The "D Scripting Language" is in fact Digital Mars' implementation of
ECMAScript (aka Javascript) and not related to D.
--
Pat Thoyts http://www.zsplat.freeserve.co.uk/resume.html
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
------------------------------
Date: 17 Jan 2003 23:10:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: perl hashes seems to slow down
Message-Id: <b0a2gm$14e$3@mamenchi.zrz.TU-Berlin.DE>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in comp.lang.perl.misc:
> Sara wrote:
> > Benjamin Goldberg wrote:
> [snip]
> > > In addition, I would suggest profiling your code, using
> > > Devel::DProf, and finding out which parts actually *need*
> > > optomization, due to your program spending lots of time in them,
> > > rather than guessing what needs to be sped up.
> >
> > tied hashes sure do- try a GDBM with like 50,000 values.
> > Talk about SLOW!
>
> Sure, but the OP never suggested that any of his hashes were tied, so
> one assumes that they aren't.
>
> Given the slowness of tie()d variables, I've occasionally bypassed
> tieing altogether, and done:
>
> my $db = SDBM_File->TIEHASH('filename', O_RDWR|O_CREAT, 0666);
> my $x = $db->FETCH($key);
> $db->STORE($key, $value);
> undef $db;
>
> This is generally much faster, with the only drawback being that you
I am surprised the tie overhead is that bad.
> can't use $db in places where a hashref is expected... you can only use
> it in places that "know" that it's an object.
You could overload %{} to get that. The overhead of overload vs.
method call is moderate. Don't nail me, but a factor of 1.5 looks
about right.
Anno
------------------------------
Date: Sat, 18 Jan 2003 01:19:46 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: Re: Problems sending an image with perl
Message-Id: <SY1W9.85644$VA5.13679272@news1.news.adelphia.net>
It MIGHT help if you READ the FILEHANDLE into memory before you try to print
it to STDOUT...
"Adrian Garduņo" <mxnegocios@yahoo.com> wrote in message
news:32be2e67.0301170823.25bfc186@posting.google.com...
> Hi,
> I'm trying to retrieve and image in a page using a CGI.
> The page have this code:
>
> <body>
> <img name="perl01" src="/cgi-bin/test.pl" alt="">
> </body>
>
> and the script used is:
>
> #!Perl.exe
> print "Content-type: image/gif\n\n";
> open(PIC, "apache_pb.gif");
> print <PIC>;
> close (PIC);
> print "\n\n";
>
> when I access the page, I get an image, but it sees bad.
> I'm using an apache 2.0 server and perl form windows.
>
> does anyone know what it's bad ?
> Regards . . . .
------------------------------
Date: 18 Jan 2003 01:46:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problems sending an image with perl
Message-Id: <b0ablu$7uq$2@mamenchi.zrz.TU-Berlin.DE>
codeWarrior <GPatnude@HotMail.com> wrote in comp.lang.perl.misc:
> It MIGHT help if you READ the FILEHANDLE into memory before you try to print
> it to STDOUT...
What is the shouting about? Top-posted and full-quoted to boot.
Anno
------------------------------
Date: Sat, 18 Jan 2003 02:14:04 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Problems sending an image with perl
Message-Id: <slrnb2he3c.oq9.mgjv@verbruggen.comdyn.com.au>
[Please, in the future, put your reply _after_ the suitably trimmed
text you reply to. It is the convention on this newsgroup and Usenet
in general, because it makes threads easier to follow, and saves on
bandwidth and storage requirements.
Also, please don't overcapitalise. It's ugly, and it's interpreted as
if you're shouting.]
On Sat, 18 Jan 2003 01:19:46 GMT,
codeWarrior <GPatnude@adelphia.net> wrote:
>
> "Adrian Garduņo" <mxnegocios@yahoo.com> wrote in message
> news:32be2e67.0301170823.25bfc186@posting.google.com...
>> Hi,
>> I'm trying to retrieve and image in a page using a CGI.
>> The page have this code:
>>
>> <body>
>> <img name="perl01" src="/cgi-bin/test.pl" alt="">
>> </body>
>>
>> and the script used is:
>>
>> #!Perl.exe
>> print "Content-type: image/gif\n\n";
>> open(PIC, "apache_pb.gif");
>> print <PIC>;
>> close (PIC);
>> print "\n\n";
>>
>> when I access the page, I get an image, but it sees bad.
>> I'm using an apache 2.0 server and perl form windows.
>>
>> does anyone know what it's bad ?
>> Regards . . . .
> It MIGHT help if you READ the FILEHANDLE into memory before you try to print
> it to STDOUT...
You can't read a file handle into memory. It's meaningless. I'll
interpret it to mean that you advise to read the file contents into
memory before printing it. The OP is doing that. That's what <PIC>
does. It reads (parts) of the file's content.
The OPs problem is that they should use binmode on the input as well
as the output file handle. Not anything else. If the files the OP
deals with are potentially large, they should probably switch to using
read() with a fixed buffer size, but otherwise the above will work,
even though it might not be the most elegant solution[1].
Martien
1. When manipulating binary files, the meaning of <> becomes strange,
unless you use your own record separator. In the default settings, <>
reads a line from the file handle. Binary files do not have lines.
They might accidentally contain your platform's end-of-line character,
but they might also not. read() is a much more natural way to deal
with binary files (unless you want to read in the whole file, in which
case setting $/ to undef and using <> will do just as well, even
though I, personally, wouldn't use it).
--
|
Martien Verbruggen | +++ Out of Cheese Error +++ Reinstall
Trading Post Australia | Universe and Reboot +++
|
------------------------------
Date: Fri, 17 Jan 2003 20:14:04 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problems sending an image with perl
Message-Id: <slrnb2he3c.6av.tadmc@magna.augustmail.com>
codeWarrior <GPatnude@adelphia.net> wrote:
> "Adrian Garduņo" <mxnegocios@yahoo.com> wrote in message
> news:32be2e67.0301170823.25bfc186@posting.google.com...
>> open(PIC, "apache_pb.gif");
>> print <PIC>;
> It MIGHT help if you READ the FILEHANDLE into memory before you try to print
> it to STDOUT...
That would help if he was not doing it.
But he is.
Posting answers that do not correlate to the code provided is
also not helpful, please do not do that either.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Jan 2003 23:18:46 +0000 (UTC)
From: mauzo@mimosa.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: Recompile Perl with CPAN?
Message-Id: <b0a30m$21$1@wisteria.csv.warwick.ac.uk>
Vaughn Gardner <vhg@byu.edu> wrote:
>I'm having trouble installing some modules (Bundle::DBI, etc.) that
>depend on Thread.pm because my Perl build (a binary depot package) was
>built with pthread support. I'd like to rebuild it (Perl, that is).
>Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
>modules, how appropriate would it be to do a "force install perl-5.6.1"?
Did you try it? :)
You can't use CPAN.pm to install a new version of Perl. Grab the tarball off
CPAN (I'd get 5.8.0 if I were you), untar it and read INSTALL. Then you'll
have to re-install most of the modules you installed yourself (well, any using
XS, anyway).
Ben
------------------------------
Date: 17 Jan 2003 23:37:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Recompile Perl with CPAN?
Message-Id: <b0a44d$3ou$1@mamenchi.zrz.TU-Berlin.DE>
Ben Morrow <mauzo@mimosa.csv.warwick.ac.uk> wrote in comp.lang.perl.misc:
> Vaughn Gardner <vhg@byu.edu> wrote:
> >I'm having trouble installing some modules (Bundle::DBI, etc.) that
> >depend on Thread.pm because my Perl build (a binary depot package) was
> >built with pthread support. I'd like to rebuild it (Perl, that is).
> >Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
> >modules, how appropriate would it be to do a "force install perl-5.6.1"?
>
> Did you try it? :)
> You can't use CPAN.pm to install a new version of Perl. Grab the tarball off
If you try, the suggestions lead to
install J/JH/JHI/perl-5.8.0.tar.gz
which does work. I'd use "look" instead of "install", and go manually
from there.
[good advice snipped]
Anno
------------------------------
Date: Fri, 17 Jan 2003 16:54:47 -0700
From: Vaughn Gardner <vhg@byu.edu>
Subject: Re: Recompile Perl with CPAN?
Message-Id: <3E2897C7.80500@byu.edu>
Anno Siegel wrote:
> Vaughn Gardner <vhg@byu.edu> wrote in comp.lang.perl.misc:
>
>>I'm having trouble installing some modules (Bundle::DBI, etc.) that
>>depend on Thread.pm because my Perl build (a binary depot package) was
>>built with pthread support. I'd like to rebuild it (Perl, that is).
>>Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
>>modules, how appropriate would it be to do a "force install perl-5.6.1"?
>
>
> Normally you don't have to force installation of a newly built Perl.
> Install it regularly. And, while you're at it, why not 5.8.0?
>
> Anno
I'm only looking to recompile the current version, not upgrade. The
Powers That Be (TM) get skittish about X.0 releases of anything, and it
doesn't look like I'll be able to upgrade until at least 5.8.1. We're
already upgrading from 5.005_03, so this is a big jump for them :)
Vaughn
------------------------------
Date: Fri, 17 Jan 2003 16:56:37 -0700
From: Vaughn Gardner <vhg@byu.edu>
Subject: Re: Recompile Perl with CPAN?
Message-Id: <3E289835.6040406@byu.edu>
Ben Morrow wrote:
> Vaughn Gardner <vhg@byu.edu> wrote:
>
>>I'm having trouble installing some modules (Bundle::DBI, etc.) that
>>depend on Thread.pm because my Perl build (a binary depot package) was
>>built with pthread support. I'd like to rebuild it (Perl, that is).
>>Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
>>modules, how appropriate would it be to do a "force install perl-5.6.1"?
>
>
> Did you try it? :)
> You can't use CPAN.pm to install a new version of Perl. Grab the tarball off
> CPAN (I'd get 5.8.0 if I were you), untar it and read INSTALL. Then you'll
> have to re-install most of the modules you installed yourself (well, any using
> XS, anyway).
>
> Ben
No, I haven't tried it. It is a development box, so if something went
wrong I could just blow Perl away and re-install the (broken) binary
package. I just haven't been brave enough yet :-}
Vaughn
------------------------------
Date: Fri, 17 Jan 2003 16:57:45 -0700
From: Vaughn Gardner <vhg@byu.edu>
Subject: Re: Recompile Perl with CPAN?
Message-Id: <3E289879.4030107@byu.edu>
Anno Siegel wrote:
> Ben Morrow <mauzo@mimosa.csv.warwick.ac.uk> wrote in comp.lang.perl.misc:
>
>>Vaughn Gardner <vhg@byu.edu> wrote:
>>
>>>I'm having trouble installing some modules (Bundle::DBI, etc.) that
>>>depend on Thread.pm because my Perl build (a binary depot package) was
>>>built with pthread support. I'd like to rebuild it (Perl, that is).
>>>Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
>>>modules, how appropriate would it be to do a "force install perl-5.6.1"?
>>
>>Did you try it? :)
>>You can't use CPAN.pm to install a new version of Perl. Grab the tarball off
>
>
> If you try, the suggestions lead to
>
> install J/JH/JHI/perl-5.8.0.tar.gz
>
> which does work. I'd use "look" instead of "install", and go manually
> from there.
>
> [good advice snipped]
>
> Anno
Thanks, I'll try that. I'll still probably stay with 5.6.1, but the
hint on "look" was a good one.
Vaughn
------------------------------
Date: 18 Jan 2003 00:32:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Recompile Perl with CPAN?
Message-Id: <b0a7bn$58p$2@mamenchi.zrz.TU-Berlin.DE>
Vaughn Gardner <vhg@byu.edu> wrote in comp.lang.perl.misc:
> Ben Morrow wrote:
> > Vaughn Gardner <vhg@byu.edu> wrote:
> >
> >>I'm having trouble installing some modules (Bundle::DBI, etc.) that
> >>depend on Thread.pm because my Perl build (a binary depot package) was
> >>built with pthread support. I'd like to rebuild it (Perl, that is).
> >>Since I'm using the interactive CPAN mode (perl -MCPAN) to install the
> >>modules, how appropriate would it be to do a "force install perl-5.6.1"?
> >
> >
> > Did you try it? :)
> > You can't use CPAN.pm to install a new version of Perl. Grab the tarball off
> > CPAN (I'd get 5.8.0 if I were you), untar it and read INSTALL. Then you'll
> > have to re-install most of the modules you installed yourself (well, any using
> > XS, anyway).
> >
> > Ben
>
> No, I haven't tried it. It is a development box, so if something went
> wrong I could just blow Perl away and re-install the (broken) binary
> package. I just haven't been brave enough yet :-}
One more thing to consider... Is the package a standard installation?
If it isn't, there may be left-overs from the other installation either
way. While usually not a problem, these can be irritating.
Anno
------------------------------
Date: Fri, 17 Jan 2003 23:56:17 GMT
From: "Dick Penny" <penny1482@attbi.com>
Subject: THANKS Re: regex help plse
Message-Id: <BK0W9.719434$%m4.3407734@rwcrnsc52.ops.asp.att.net>
Thank you to two repliers. I had NEVER hear nor read of "non-capturing
parenthesis", but I did wonder how to do grouping w/o capturing.
Dick
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:b0a0af$14e$1@mamenchi.zrz.TU-Berlin.DE...
> Dick Penny <penny1482@attbi.com> wrote in comp.lang.perl.misc:
> > I had a regex number extractor/formatter that worked fine (w the help of
> > this group). Now I am trying to modify it to handle embeded periods
and/or
> > leading minus signs. I copied $rgx2 from Perl docs, it works fine for
> > decimal points, but will not emitt (output) the minus sign. I thought
the
> > enclosing ( ...) in $rgx2 might be wrong, so I tried $rgx2a, still no
good.
> >
> > Suggestions appreciated.
> > --------snippet begin
> > my $rgx1 = '\d+'; #original
> > my $rgx2 = '[+-]?(\d+\.\d+|\d+\.|\.\d+|\d+)'; # num w or w/o decimal
> ^ ^
> These parentheses are needed for the regex to work.
>
> > my $rgx2a = '([+-]?\d+\.\d+|\d+\.|\.\d+|\d+)'; # num w or w/o decimal
> ^ ^
> You have moved the first parenthesis. Now the optional [+-] only belongs
> to the first of the four alternatives. If a later one matches, it matches
> without [+-]. Use
>
> my $rgx2a = qr/([+-]?(?:\d+\.\d+|\d+\.|\.\d+|\d+))/;
>
> Note that I have replaced the second pair of parens with the non-capturing
> variant.
>
> > #test data follows
> > my $lines = [
> > '>>SPM:: 0111350 0113550 0111270 0111425 4173 12150',
> > '>>SPH:: 0111200 0113350 0111050 0113280 -36540 37978',#bad
output
> > '>>SPM:: 0113635 0115750 0112810 0113640 4657 8310',
> > '>>SPH:: 0113400 0115490 0112570 0113400 39.383 39419' ];#OK
output
> > #input/output mappings
> > my @numbrs = map { [ map { s/(\d{4})(\d\d)$/$1.$2/; $_ } /$rgx2/go ] }
> ^^^^^
> You want $rgx2a here. $rgx2 doesn't work, but you knew that.
>
> > grep{/SPH/} @$lines;
> > --------snippet end
>
> It is nice to find some code, for a change, that runs blamelessly under
> strict and warnings.
>
> It is a useful technique to keep (parts of) regexes in variables the
> way you do. You might as well use the regex-quoting mechanism qr//
> for the purpose.
>
> However, you should try to keep *capturing* parentheses out of the
> fixed parts as far as possible. You must count opening parentheses
> to know which parts are captured, so hiding them in a variable is
> a bad idea. This would have been better:
>
> my $rgx2a = qr/[+-]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)/;
>
> ...and later
>
> map { s/(\d{4})(\d\d)$/$1.$2/; $_ } /($rgx2)/go
>
> Anno
------------------------------
Date: Fri, 17 Jan 2003 18:27:41 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: THANKS Re: regex help plse
Message-Id: <slrnb2h7rt.651.tadmc@magna.augustmail.com>
Dick Penny <penny1482@attbi.com> wrote:
> I had NEVER hear nor read of "non-capturing
> parenthesis"
It is in those poor quality docs:
perldoc perlre
"(?:pattern)"
This is for clustering, not capturing; it groups subexpressions
like "()", but doesn't make backreferences as "()" does.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 18 Jan 2003 00:58:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: ~ Urgently require a Webpage Hit counter script !!??~
Message-Id: <GE1W9.5217$V75.4938@nwrddc02.gnilink.net>
inderjit S Gabrie wrote:
[...]
And urgency is the reason that you had to post another off-topic article
just 6 minutes after your first?
Then obviously you have no clue about the nature of Usenet.
jue
------------------------------
Date: Fri, 17 Jan 2003 20:18:32 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: ~ Urgently require a Webpage Hit counter script !!??~
Message-Id: <slrnb2hebo.6av.tadmc@magna.augustmail.com>
Jürgen Exner <jurgenex@hotmail.com> wrote:
> inderjit S Gabrie wrote:
> Then obviously you have no clue about the nature of Usenet.
Hence my pointer to the Posting Guidelines.
Let's wait and see if he fixes things in subsequent posts,
now that he's been given an opportunity for enlightment.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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.
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 4424
***************************************