[23028] in Perl-Users-Digest
Perl-Users Digest, Issue: 5248 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 21 09:05:40 2003
Date: Mon, 21 Jul 2003 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 21 Jul 2003 Volume: 10 Number: 5248
Today's topics:
Re: "use" remote modules? (Lawrence Tierney)
Re: Basic "IO::Select" problem <Ed+nospam@ewildgoose.demon.co.uk@>
Re: Basic "IO::Select" problem <Ed+nospam@ewildgoose.demon.co.uk@>
CGI Programmers needed to hack around at our CGI Scrip (James)
Re: Error upon Error... <cat@no-spam.com>
Re: Import - Read file <member33560@dbforums.com>
Re: JOIN problem ? (2nd attempt to post) <abigail@abigail.nl>
Mailing a message with attachcments <victor@none.it>
Re: Matching URls <abigail@abigail.nl>
Matrix multiplication? <jon.rogers@tv.tu>
Re: Matrix multiplication? <abigail@abigail.nl>
not recursing dir's using File::Find (david)
Re: not recursing dir's using File::Find <jurgenex@hotmail.com>
Re: Notepad Bug when editing Perl scripts in Win XP? <cat@no-spam.com>
package module <vervoom@hotmail.com>
reliable method to find the version of perl <thens@nospam.com>
Re: reliable method to find the version of perl <tassilo.parseval@rwth-aachen.de>
Re: reliable method to find the version of perl <thens@nospam.com>
Re: shorten expression <bigiain@mightymedia.com.au>
Re: shorten expression <abigail@abigail.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Jul 2003 03:50:27 -0700
From: lawrence.tierney@bipcontracts.com (Lawrence Tierney)
Subject: Re: "use" remote modules?
Message-Id: <17e88dbe.0307210250.30ed5d3a@posting.google.com>
Hello again,
I would like to thank you all for your help - I now have the code up
and running - groovy. This has been one of the most enlightening
threads I have been involved with - I had no idea you could add
code-refs etc to @INC.
All the better cos I didn't get hit with any RTFM's etc
Keep up the good work and thanks again
Lord0
------------------------------
Date: Mon, 21 Jul 2003 10:17:30 GMT
From: "Edward Wildgoose" <Ed+nospam@ewildgoose.demon.co.uk@>
Subject: Re: Basic "IO::Select" problem
Message-Id: <Z4PSa.248205$Ho4.1545237@news.easynews.com>
"Benjamin Goldberg" <ben.goldberg@hotpop.com> wrote in message
news:3F1B4882.342BB128@hotpop.com...
> Ed W wrote:
> >
> > I have been staring at this for a day now (durr), but I just can't see
> > what is wrong with this code: (apart from poor coding style, but it's a
> > snippet...)
> >
> > It's running under windows XP with activestate perl 5.6.1. However, the
> > code below always returns an empty array from the select call?
>
> That's because you pass in a timeout of 0. Change it to a postive
> number, or to undef(), and it will work.
I have already tried with (1), but no difference. I thought that 0 was
acceptable, for seeing if anything was waiting, but returning immediately?
>
> Oh, and you should be sysread()ing from $H, not from $ARG.
I am I think?
$H->sysread($somejunk, 10);
Thanks for you help (again!)
Ed
------------------------------
Date: Mon, 21 Jul 2003 10:29:32 GMT
From: "Edward Wildgoose" <Ed+nospam@ewildgoose.demon.co.uk@>
Subject: Re: Basic "IO::Select" problem
Message-Id: <ggPSa.248802$Ho4.1546776@news.easynews.com>
I do actually wonder if this is a win32 issue though. Does the code look
roughly plausible?
I will recode two scripts which can be demo-ed and resend. Thanks all
------------------------------
Date: 21 Jul 2003 02:39:32 -0700
From: jrt@islandseven.com (James)
Subject: CGI Programmers needed to hack around at our CGI Scripts
Message-Id: <9050a597.0307210139.58f87b0@posting.google.com>
If anyone out there is interested, I'm now offering reseller rights
to our complete CGI Archive, which means you and pretty much do
whatever you please with them.
Re-write the code and resell, Sell scripts
individually, or sell them exactly as they are.
Basically - full reseller rights!
If you would like to check it out, go to:
www.superscripts.com
It's a free-for-all, and it may not last long! As far as I know, there's
nobody else offering this type of thing.
Good Luck,
SuperScripts.com
------------------------------
Date: Mon, 21 Jul 2003 22:53:37 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Error upon Error...
Message-Id: <3F1BE251.A633E276@no-spam.com>
rab wrote:
>
> anyone seen this error before:
>
> > Can't load '/usr/local/lib/perl5/5.8.0/PA-RISC2.0/auto/DB_File/DB_File.sl' for module DB_File: No such file or directory at /usr/local/lib/perl5/5.8.0/PA-RISC2.0/XSLoader.pm line 83.
> > at /usr/local/lib/perl5/5.8.0/PA-RISC2.0/DB_File.pm line 236
>
> I'm just trying to run this script:
>
> #!/usr/bin/perl -w
> use strict;
> use DB_File;
>
> print "Hello World!\n"
>
> all three of the files exist on the system....why is it saying this.
> (there are a few scripts that I have that want to use DB_File and they
> all say this.... that's why I just use this simple script above for
> error diagnosis)
>
> rab
DB_File module has not been installed correctly or there may be dependancies.
Ask your system administrator to re-install it.
------------------------------
Date: Mon, 21 Jul 2003 11:31:30 +0000
From: ttnguyen <member33560@dbforums.com>
Subject: Re: Import - Read file
Message-Id: <3133296.1058787090@dbforums.com>
Originally posted by Bob Walton
> ttnguyen wrote:
>
> ...
> > I have been working with ColdFusion and DB2 for about 1 month.
> I have a
> > question and hope someone could me me with.
> > "How can I import an excel file to DB2 table"?
> ...
>
>
> > -Thien
> ...
>
>
> And your Perl question is? Oh, you want to do it with Perl, not
> ColdFusion? Modules are your friend. Check out:
>
> Win32::OLE (if you're on Windoze)
> DBI
> DBD::DB2
> DBD::Excel
> DBD::ODBC (if you're on Windoze)
> Spreadsheet::ParseExcel
>
> --
> Bob Walton
Thanks for your answer. I do it with coldFusion NOT Perl. Thanks.
--
Posted via http://dbforums.com
------------------------------
Date: 21 Jul 2003 09:51:26 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: JOIN problem ? (2nd attempt to post)
Message-Id: <slrnbhndsu.sga.abigail@alexandra.abigail.nl>
Sam Holden (sholden@flexal.cs.usyd.edu.au) wrote on MMMDCX September
MCMXCIII in <URL:news:slrnbhjtoq.rop.sholden@flexal.cs.usyd.edu.au>:
:) On 19 Jul 2003 18:40:43 -0700, stu7 <stuseven@hotmail.com> wrote:
:) > *** No thanks to you Eric... not that usenet isn't plagued
:) > *** with meaningless posts already - and your's fits right in...
:) > *** however, to answer your "friendly post" -
:) > *** A) Usenet is here, among a very few other reasons, so people
:) > *** with legitimate questions can get answers from those who
:) > *** already have encountered these problems... your post had
:) > *** virtually nothing to do with my questions - which were, in
:) > *** fact, answered politely and correctly by two posters previous
:) > *** to your "style whine"_ value of your spam is ? (right... nothing).
:)
:) The chances of any of your legitimate questions being seen by the
:) very people who probably know the answers is quite slim now.
:)
:) [snip a post that breaks almost all the conventions of clpm]
I've been killfiling everything coming from an hotmail account for
many years, and I've never regret it.
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Mon, 21 Jul 2003 11:28:36 GMT
From: Vittorio <victor@none.it>
Subject: Mailing a message with attachcments
Message-Id: <E7QSa.5805$t92.180038@news1.tin.it>
I need sending many mails with the same structure:
An explanatory message AND a couple of attachments, an excel and pdf file.
Now, following the many examples in the Internet, I've been able using
use MIME::Entity;
use NET::Smtp; (this module is necessary because I need authentication
through an Exchange mail server)
to send a message in which both the text of the message and the files
are treated as attachments.
Is there any way to keep them separated?
Please an example would be highly appreciated.
------------------------------
Date: 21 Jul 2003 09:55:43 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Matching URls
Message-Id: <slrnbhne4u.sga.abigail@alexandra.abigail.nl>
Seansan (sheukels=cuthere=@yahoo.co.uk) wrote on MMMDCX September
MCMXCIII in <URL:news:3f1aa893$0$61643$e4fe514c@dreader3.news.xs4all.nl>:
\\ Hi,
\\
\\ Does anyone know of a link to or an example of a decent regexp that wil
\\ recognize internet URLs? (It needs to match urls starting with http:// and
\\ www.)
\\
\\ I am trying to replace a string like
\\ "My Homepage is @ http://www.homepage.nl"
\\ with
\\ "My Homepage is @ <A HREF =
\\ 'http://www.homepage.nl'>http://www.homepage.nl</A>"
use Regexp::Common qw /URI/;
$str =~ s!($RE{URI}{HTTP})!<a href = '$1'>$1</a>!g;
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 21 Jul 2003 14:36:01 +0200
From: jon rogers <jon.rogers@tv.tu>
Subject: Matrix multiplication?
Message-Id: <bfgm33$682$1@news.gu.se>
Hi
I have a 21 * 21 matrix which I'd like to raise to the power of 50. Is it
possible to do that in Perl?
The matrix looks something like this:
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2
... and so on.
I have the matrix both as a file (fields separated by space, \n indicates
new line) and in an array (0 through 440).
Has anyone here done this before, or know how it could be done?
Thanks,
JR
------------------------------
Date: 21 Jul 2003 12:37:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Matrix multiplication?
Message-Id: <slrnbhnnkr.t0s.abigail@alexandra.abigail.nl>
jon rogers (jon.rogers@tv.tu) wrote on MMMDCXI September MCMXCIII in
<URL:news:bfgm33$682$1@news.gu.se>:
<> Hi
<>
<> I have a 21 * 21 matrix which I'd like to raise to the power of 50. Is it
<> possible to do that in Perl?
Yes.
<> The matrix looks something like this:
<>
<> 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
<> 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
<> 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2
<>
<> ... and so on.
<>
<> I have the matrix both as a file (fields separated by space, \n indicates
<> new line) and in an array (0 through 440).
<>
<> Has anyone here done this before, or know how it could be done?
Check out the PDL package.
Abigail
--
perl -wle 'print prototype sub "Just another Perl Hacker" {};'
------------------------------
Date: 20 Jul 2003 21:17:54 -0700
From: dwlepage@yahoo.com (david)
Subject: not recursing dir's using File::Find
Message-Id: <b09a22ae.0307202017.5a42c44d@posting.google.com>
Im trying to find all files ONLY in the current directory that are
called
"today.txt" or "sub.txt" and copy them to a different directory. Im
trying to do so using File::Find and File::Copy, but I cannot seem to
get this not to recurse through the directory structure. (There may be
other "today.txt" files below the current dir.
#!/usr/bin/perl -w
use strict;
use File::Find;
use File::Copy;
my $dir="./floppy";
my $curdir="./work";
opendir(DIR, $curdir) || die "$!";
sub wanted {
if ( -f $_ && ! -d $_) {
my $file = $File::Find::name;
if ($file =~ /today\.txt/ or /sub\.txt/)
{
for ($File::Find::name)
{
print "Copying $_\n";
copy $file, $dir or die "Error copying: $!";
}
}
}
}
find \&wanted, '.';
close(DIR);
-------------
Current DIR is "/work".
/work/today.txt
/work/sub.txt
/work/folder/today.txt
I only want these files from /work. Any suggestions?
Thanks!
------------------------------
Date: Mon, 21 Jul 2003 04:27:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: not recursing dir's using File::Find
Message-Id: <QYJSa.49016$kI5.38746@nwrddc02.gnilink.net>
david wrote:
> Im trying to find all files ONLY in the current directory that are
> called
> "today.txt" or "sub.txt" and copy them to a different directory. Im
> trying to do so using File::Find and File::Copy, but I cannot seem to
> get this not to recurse through the directory structure. (There may be
> other "today.txt" files below the current dir.
In that case I wouldn't use File::Find but a simple glob().
If standard filename expansion is not powerful enough for your needs then
you can always filter the result using grep() in a second step.
jue
------------------------------
Date: Mon, 21 Jul 2003 23:13:12 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Notepad Bug when editing Perl scripts in Win XP?
Message-Id: <3F1BE6E8.88137730@no-spam.com>
randy wrote:
>
> Has anyone else tried editing perl scripts in notepad in XP? I am
> getting some characters inserted into the scripts.....
>
Get a real text editor... http://www.textpad.com/
------------------------------
Date: Mon, 21 Jul 2003 10:50:48 +0100
From: JS <vervoom@hotmail.com>
Subject: package module
Message-Id: <bfgd3c$pr8$1@cspc1n11.baplc.com>
Hi,
Can anyone tell me, do I have to compile a perl module on every box I
want to run it on, or could I just compile it once and package it in
some way to install on the other boxes?
If I can package it, say by tarring it up for example, which files do I
need to include/edit? Better still could anyone point me to
documentation on this please?
Many Thanks,
JS.
------------------------------
Date: Mon, 21 Jul 2003 13:09:09 +0530
From: Thens <thens@nospam.com>
Subject: reliable method to find the version of perl
Message-Id: <20030721130909.7244cab8.thens@nospam.com>
Hi,
I have a perl script that is bootstrapped by a mini shell script at
the beginning. I use
$ perl -V:version
to find the version of the perl in the environment and do some
processing based on that. I would like to know how reliable is this
method. Is this method fool proof or are there cases where this might
fail. Remember I have to find the version from the shell and not when
perl is executing.
Thanks in advance.
Regards,
Thens.
------------------------------
Date: 21 Jul 2003 07:57:51 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: reliable method to find the version of perl
Message-Id: <bfg6dv$c0a$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Thens:
> I have a perl script that is bootstrapped by a mini shell script at
> the beginning. I use
>
> $ perl -V:version
>
> to find the version of the perl in the environment and do some
> processing based on that. I would like to know how reliable is this
> method. Is this method fool proof or are there cases where this might
> fail. Remember I have to find the version from the shell and not when
> perl is executing.
I wouldn't know of a case where this would fail. Another way is to
simply execute the perl in the path and have it return its version:
PERL_VERSION=`perl -e 'print $]'`
You get the version in a different format. 5.8.0 reports as 5.008 and
5.6.1 as 5.006001.
But the -V: interface exists for exactly this reason so I so no reason
not to use it.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Mon, 21 Jul 2003 14:26:43 +0530
From: Thens <thens@nospam.com>
Subject: Re: reliable method to find the version of perl
Message-Id: <20030721142643.2c6f1fa2.thens@nospam.com>
On 21 Jul 2003 07:57:51 GMT
"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote:
>Also sprach Thens:
>
>> I have a perl script that is bootstrapped by a mini shell script at
>> the beginning. I use
>>
>> $ perl -V:version
>>
>
>I wouldn't know of a case where this would fail. Another way is to
>simply execute the perl in the path and have it return its version:
>
> PERL_VERSION=`perl -e 'print $]'`
>
>You get the version in a different format. 5.8.0 reports as 5.008 and
>5.6.1 as 5.006001.
>
>But the -V: interface exists for exactly this reason so I so no reason
>not to use it.
Thanks a lot.
Regards,
Thens.
------------------------------
Date: Mon, 21 Jul 2003 18:49:12 +1000
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: shorten expression
Message-Id: <bigiain-F580FF.18491221072003@nasal.pacific.net.au>
In article <slrnbha22p.oa.abigail@alexandra.abigail.nl>,
Abigail <abigail@abigail.nl> wrote:
> Jeff 'japhy' Pinyan (pinyaj@rpi.edu) wrote on MMMDCV September MCMXCIII
> in
> <URL:news:Pine.SGI.3.96.1030715112248.17707C-100000@vcmr-64.server.rpi.edu>:
> )) On Tue, 15 Jul 2003, ZZT wrote:
> ))
> )) >is there a way to shorten this expression?
> )) >
> )) >$host=~/^(\S*)\s*/; $host=$1;
> ))
> )) Well, as it stands, even if the regex FAILS, $host will be set to
> whatever
> )) $1 was before the regex.
>
> But the only string on which the regexp can fail is a string that
> doesn't have a beginning. Now, in perl6, with lazy evaluation, we
> might be able to construct strings without an end.
>
> But how do I make a string without a beginning?
Easy,
#!/usr/bin/perl -w
use strict;
require 6.001;
use Abigail::Strings qw(make_string_with_no_end);
my $noEnd=make_string_with_no_end();
my $noBeginning=reverse($noEnd);
if ($noBeginning =~/^(\S*)\s*/){print "string '$noBeginning' has no beginning!"}
:-)
cheers,
big
--
"Make some noise. You don't have to join anything; noise need
not be more than individuals standing up for themselves.
You don't win every time. But you do win sometimes."
Bruce Schneier in http://www.counterpane.com/crypto-gram.html
------------------------------
Date: 21 Jul 2003 09:48:24 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: shorten expression
Message-Id: <slrnbhndn7.sga.abigail@alexandra.abigail.nl>
Iain Chalmers (bigiain@mightymedia.com.au) wrote on MMMDCXI September
MCMXCIII in <URL:news:bigiain-F580FF.18491221072003@nasal.pacific.net.au>:
$$ In article <slrnbha22p.oa.abigail@alexandra.abigail.nl>,
$$ Abigail <abigail@abigail.nl> wrote:
$$
$$ > Jeff 'japhy' Pinyan (pinyaj@rpi.edu) wrote on MMMDCV September MCMXCIII
$$ > in
$$ > <URL:news:Pine.SGI.3.96.1030715112248.17707C-100000@vcmr-64.server.rpi.edu>:
$$ > )) On Tue, 15 Jul 2003, ZZT wrote:
$$ > ))
$$ > )) >is there a way to shorten this expression?
$$ > )) >
$$ > )) >$host=~/^(\S*)\s*/; $host=$1;
$$ > ))
$$ > )) Well, as it stands, even if the regex FAILS, $host will be set to
$$ > whatever
$$ > )) $1 was before the regex.
$$ >
$$ > But the only string on which the regexp can fail is a string that
$$ > doesn't have a beginning. Now, in perl6, with lazy evaluation, we
$$ > might be able to construct strings without an end.
$$ >
$$ > But how do I make a string without a beginning?
$$
$$ Easy,
$$
$$ #!/usr/bin/perl -w
$$ use strict;
$$ require 6.001;
$$
$$ use Abigail::Strings qw(make_string_with_no_end);
$$
$$ my $noEnd=make_string_with_no_end();
$$ my $noBeginning=reverse($noEnd);
$$
$$ if ($noBeginning =~/^(\S*)\s*/){print "string '$noBeginning' has no beginning!"}
This will just consume memory until further allocation of memory fails.
I therefore cannot give you any points for this solution.
Furtermore, it makes use of futureware, and not of something that exists
today.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
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 5248
***************************************