[24054] in Perl-Users-Digest
Perl-Users Digest, Issue: 6251 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 12 18:05:46 2004
Date: Fri, 12 Mar 2004 15:05:09 -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, 12 Mar 2004 Volume: 10 Number: 6251
Today's topics:
Re: [OT] Re: Spreadsheet::WriteExcel - Excel 97 install <remorse@partners.org>
ANNOUNCE: Filter::HereDocIndent initial release (Miko O'Sullivan)
Re: bit string parsing and mapping question <nobull@mail.com>
Re: bit string parsing and mapping question <jurgenex@hotmail.com>
Re: bit string parsing and mapping question (Jay Tilton)
Re: bit string parsing and mapping question <dwall@fastmail.fm>
Re: bit string parsing and mapping question <dwall@fastmail.fm>
C expressions in Perl <mail@annuna.com>
Re: C expressions in Perl (Walter Roberson)
Re: C expressions in Perl <tadmc@augustmail.com>
call a cgi script from a cgi script (Joe)
Re: call a cgi script from a cgi script <usenet@morrow.me.uk>
Re: call a cgi script from a cgi script <chatiman@free.fr>
Re: call a cgi script from a cgi script <nobull@mail.com>
Re: DBI and DBD problems <remorse@partners.org>
DBI and Oracle Stored Procedure Arrays <kevin_skelton@mgic.com>
Re: formmail problem <noreply@gunnar.cc>
Re: formmail problem <dwall@fastmail.fm>
Re: formmail problem <noreply@gunnar.cc>
Re: How to redirect headers in Perl? <gnari@simnet.is>
Image-Magick.ppd installation <ha@hago-ziegler.de>
Re: Image-Magick.ppd installation <chatiman@free.fr>
Re: Image-Magick.ppd installation <ha@hago-ziegler.de>
Re: Mixing WAV Files <todd@asgweb.net>
Re: Multiple compares -- TMTOWTDI <remorse@partners.org>
Re: Multiple compares -- TMTOWTDI <usenet@morrow.me.uk>
Re: Passing variables / data between php - perl <noreply@gunnar.cc>
Re: Regex to match simple line of XML <tadmc@augustmail.com>
SCALAR(0x82e1024) <todd@asgweb.net>
Re: SCALAR(0x82e1024) <jurgenex@hotmail.com>
Re: Text editor implemented in Perl <jgibson@mail.arc.nasa.gov>
Re: Text editor implemented in Perl <jgibson@mail.arc.nasa.gov>
Re: Tricky Perl Bug (amusing/unamusing) <nobull@mail.com>
Re: Tricky Perl Bug (amusing/unamusing) <tadmc@augustmail.com>
Re: using an assoc. array as a 'set' <usenet@morrow.me.uk>
Re: using an assoc. array as a 'set' <remorse@partners.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Mar 2004 16:34:41 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: [OT] Re: Spreadsheet::WriteExcel - Excel 97 install problem
Message-Id: <remorse-BEB74C.16344112032004@plato.harvard.edu>
In article <20040312161200.6de7e876.thens@NOSPAMti.com>,
Thens <thens@NOSPAMti.com> wrote:
> On 12 Mar 2004 09:02:08 GMT
> Bhaskar Reddy <rbin.kor901209@in.bosch.com> wrote:
>
> # MyPrj
> # |
> # |----csv2xls.pl (My pl file which calls the write() method)
> # |
> # |----Spreadsheet
> # |
> # |----WriteExcel.pm
> # |----WriteExcel
> # |----BIFFwriter.pm
> # |----Big.pm
> # |----Format.pm
> # |----Formula.pm
> # |----OLEwriter.pm
> # |----Utility.pm
> # |----Workbook.pm
> # |----WorkbookBig.pm
> # |----Worksheet.pm
>
> Bhaskar,
>
> Do you have a perl script/utility that generates this kind of a tree
> structure or was this hand created. Just out of curiosity !!
>
> Regards,
> Thens.
You might look for the 'tree' command, or on windows it might be
'dirtree'.
Ricky
------------------------------
Date: Fri, 12 Mar 2004 19:31:06 GMT
From: miko@idocs.com (Miko O'Sullivan)
Subject: ANNOUNCE: Filter::HereDocIndent initial release
Message-Id: <HuHDD5.r5G@zorch.sf-bay.org>
Filter::HereDocIndent - Indent here documents
SYNOPSIS
use Filter::HereDocIndent;
if ($sometest) {
print <<'(MYDOC)';
Melody
Starflower
Miko
(MYDOC)
}
outputs (with text beginning at start of line):
Melody
Starflower
Miko
HereDocIndent mimics the planned behavior of here
documents in Perl 6.
DESCRIPTION
HereDocIndent allows you to indent your here documents
along with the rest of the code. The contents of the here
doc and the ending delimiter itself may be indented with
any amount of whitespace. Each line of content will have
the leading whitespace stripped off up to the amount of
whitespace that the closing delimiter is indented. Only
whitespace is stripped off the beginning of the line,
never any other characters.
For example, in the following code the closing delimiter
is indented eight spaces:
if ($sometest) {
print <<'(MYDOC)';
Melody
Starflower
Miko
(MYDOC)
}
All of the content lines in the example will have the
leading eight whitespace characters removed, thereby
outputting the content at the beginning of the line:
Melody
Starflower
Miko
If a line is indented more than the closing delimiter, it
will be indented by the extra amount in the results. For
example, this code:
if ($sometest) {
print <<'(MYDOC)';
Melody
Starflower
Miko
(MYDOC)
}
produces this output:
Melody
Starflower
Miko
HereDocIndent does not distinguish between different types
of whitespace. If you indent the closing delimiter with a
single tab, and the contents eight spaces, each line of
content will lose just one space character. The best
practice is to be consistent in how you indent, using just
tabs or just spaces.
HereDocIndent will only remove leading whitespace. If one
of the lines of content is not indented, the
non-whitespace characters will not be removed. The
trailing newline is never removed.
COMPARISON TO OTHER HEREDOC INDENTATION TECHNIQUES
There are several other here doc indentation techniques,
particularly those discussed in the Perl FAQ. Those
techniques generally have several shortcomings.
First, they require you to modify how you create the here
doc. Instead of simply creating the here doc as you usually
would, except that it is indented, you have to pass the
entire string into a function of through a regex to modify
it.
Second, they usually require that the ending delimiter is
still flush against the left margin. It should be noted
that this shortcoming can be overcome by creating the
heredoc delimiter with padded spaces in the left. However,
even that technique requires you to ensure that the here
doc declaration and the actual delimiter have matching
amounts of padded space... something I personally find
to be a distasteful extra drain on my brain resources.
HereDocIndent allows you to simply create a delimeter
and use it as usual.
Finally, many techniques either produce a string with
padded spaces in the left margin, or force a function to
guess how many spaces it should remove. With
HereDocIndent, that information is cleanly and
unambiguously determined by the indentation of the
delimiter.
------------------------------
Date: 12 Mar 2004 19:27:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: bit string parsing and mapping question
Message-Id: <u98yi5hnn0.fsf@wcl-l.bham.ac.uk>
Paul.Sue@telus.com (Paul) writes:
> Hi,
>
> Let's say a command outputs results like this:
>
> code1 = 1
> code2 = 0
> code3 = 0
> code4 = 0
> code5 = 1
> code6 = 0
> code7 = 1
> code8 = 0
>
> (always 8 lines returned; values are 0 or 1)
>
> I want a script to read this in and then map all the 1's to a
> user-friendly code.
>
> E.g.:
> @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
> badSyntax outOfRange);
>
> So for the above command output, it would output something like:
>
> Errors: lowMem badArg badSyntax
>
> I can do it in a simplistic pedantic way, but I'd like to a more
> elegant solution.
Please define your elegance metric.
Consider for example:
print "Errors: @desc[ map { /(\d) = 1/ } `command` ]\n";
That's short but inflexible and unreadable. And of course it doesn't
check that the command actually succeded.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 12 Mar 2004 19:37:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: bit string parsing and mapping question
Message-Id: <Tjo4c.1401$F9.302@nwrddc01.gnilink.net>
Paul wrote:
> Let's say a command outputs results like this:
>
> code1 = 1
> code2 = 0
> code3 = 0
> code4 = 0
> code5 = 1
> code6 = 0
> code7 = 1
> code8 = 0
>
> (always 8 lines returned; values are 0 or 1)
>
> I want a script to read this in and then map all the 1's to a
> user-friendly code.
>
> E.g.:
> @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
> badSyntax outOfRange);
>
> So for the above command output, it would output something like:
>
> Errors: lowMem badArg badSyntax
>
> I can do it in a simplistic pedantic way, but I'd like to a more
> elegant solution.
So, in other words you want to map e.g. "code1" to "lowMem", right?
Then why not just do it? Something along the line of (untested):
my %desc = (code1 => 'lowMem',
code2 => 'badHandle',
code3 => 'badPasswd',
code4 => 'noSpace',
code5 => 'badArg',
code6 => 'invalidInput',
code7 => 'badSyntax',
code8 => 'outOfRange');
my ($code,$val) = split (/=/,$in);
if ($val==1) {print $desc{$code};}
------------------------------
Date: Fri, 12 Mar 2004 20:13:03 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: bit string parsing and mapping question
Message-Id: <40521951.61209369@news.erols.com>
Paul.Sue@telus.com (Paul) wrote:
: Let's say a command outputs results like this:
:
: code1 = 1
: code2 = 0
: code3 = 0
: code4 = 0
: code5 = 1
: code6 = 0
: code7 = 1
: code8 = 0
:
: (always 8 lines returned; values are 0 or 1)
:
: I want a script to read this in and then map all the 1's to a
: user-friendly code.
:
: E.g.:
: @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
: badSyntax outOfRange);
:
: So for the above command output, it would output something like:
:
: Errors: lowMem badArg badSyntax
#!perl
use warnings;
use strict;
my @desc = qw(
lowMem
badHandle
badPasswd
noSpace
badArg
invalidInput
badSyntax
outOfRange
);
my @errs;
/^code([0-8]) = 1$/
and push @errs, $desc[$1-1]
while <DATA>;
print "Errors: @errs\n" if @errs;
__DATA__
code1 = 1
code2 = 0
code3 = 0
code4 = 0
code5 = 1
code6 = 0
code7 = 1
code8 = 0
------------------------------
Date: Fri, 12 Mar 2004 20:43:27 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: bit string parsing and mapping question
Message-Id: <Xns94AA9FF3156A2dkwwashere@216.168.3.30>
Paul <Paul.Sue@telus.com> wrote:
> Let's say a command outputs results like this:
>
> code1 = 1
> code2 = 0
> code3 = 0
> code4 = 0
> code5 = 1
> code6 = 0
> code7 = 1
> code8 = 0
>
> (always 8 lines returned; values are 0 or 1)
>
> I want a script to read this in and then map all the 1's to a
> user-friendly code.
>
> E.g.:
> @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
> badSyntax outOfRange);
>
> So for the above command output, it would output something like:
>
> Errors: lowMem badArg badSyntax
Cribbing a bit from previous replies, how about this?
my $com_output = <<END;
code1 = 1
code2 = 0
code3 = 0
code4 = 0
code5 = 1
code6 = 0
code7 = 1
code8 = 0
END
# make sure the command was successful....
my %hash = split /\n|\s+=\s+/, $com_output;
my @desc = qw(lowMem badHandle badPasswd noSpace
badArg invalidInput badSyntax outOfRange);
print join ', ', @desc[ grep { $hash{'code'.($_+1)} } 0..$#desc ];
------------------------------
Date: Fri, 12 Mar 2004 21:43:36 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: bit string parsing and mapping question
Message-Id: <Xns94AAAA26ED62dkwwashere@216.168.3.30>
Brian McCauley <nobull@mail.com> wrote:
> Paul.Sue@telus.com (Paul) writes:
>
>> Let's say a command outputs results like this:
>>
>> code1 = 1
>> code2 = 0
>> code3 = 0
>> code4 = 0
>> code5 = 1
>> code6 = 0
>> code7 = 1
>> code8 = 0
>>
>> (always 8 lines returned; values are 0 or 1)
>>
>> I want a script to read this in and then map all the 1's to a
>> user-friendly code.
>>
>> E.g.:
>> @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
>> badSyntax outOfRange);
>>
>> So for the above command output, it would output something like:
>>
>> Errors: lowMem badArg badSyntax
>>
>> I can do it in a simplistic pedantic way, but I'd like to a more
>> elegant solution.
>
> Please define your elegance metric.
>
> Consider for example:
>
> print "Errors: @desc[ map { /(\d) = 1/ } `command` ]\n";
>
> That's short but inflexible and unreadable. And of course it doesn't
> check that the command actually succeded.
And it's off by one. The codes go from 1..8, not 0..7.
--
David Wall
------------------------------
Date: Fri, 12 Mar 2004 20:41:24 GMT
From: Joe <mail@annuna.com>
Subject: C expressions in Perl
Message-Id: <Ufp4c.17461$%06.9177@newsread2.news.pas.earthlink.net>
Can I do this in Perl?
Sub F{
return true'
}
if (!F()) {do something}
------------------------------
Date: 12 Mar 2004 21:03:20 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: C expressions in Perl
Message-Id: <c2t8io$guf$1@canopus.cc.umanitoba.ca>
In article <Ufp4c.17461$%06.9177@newsread2.news.pas.earthlink.net>,
Joe <mail@annuna.com> wrote:
:Can I do this in Perl?
:
:Sub F{
: return true'
:}
:if (!F()) {do something}
No. Perl would be too unhappy about the trailing apostrophe after
the true . And 'Sub' is not a keyword in perl.
I'd recommend:
sub F () { true }
Assuming one had earlier defined 'true'. The () tells perl that you are
working with a subroutine that takes no arguments, and since it returns
a constant value, later perl will know enough to use inlining .
--
Before responding, take into account the possibility that the Universe
was created just an instant ago, and that you have not actually read
anything, but were instead created intact with a memory of having read it.
------------------------------
Date: Fri, 12 Mar 2004 16:27:19 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: C expressions in Perl
Message-Id: <slrnc54ea7.67f.tadmc@magna.augustmail.com>
Joe <mail@annuna.com> wrote:
> Can I do this in Perl?
>
> Sub F{
> return true'
> }
>
> if (!F()) {do something}
What happened when you tried it?
Where are the "C expressions" you mention in the Subject?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Mar 2004 12:15:37 -0800
From: jab_joe@www.com (Joe)
Subject: call a cgi script from a cgi script
Message-Id: <6586e7f6.0403121215.55caa7f6@posting.google.com>
How do I do this?
I want my cgi script to call a cgi script with a argument.
is:
my $cmd = "perl ".$SCRIPT_URL ."?".$POLL_CODE_SURVEY."|";
open CMD, $cmd;
right?
------------------------------
Date: Fri, 12 Mar 2004 20:20:10 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: call a cgi script from a cgi script
Message-Id: <c2t61q$1eu$3@wisteria.csv.warwick.ac.uk>
Quoth jab_joe@www.com (Joe):
> How do I do this?
>
> I want my cgi script to call a cgi script with a argument.
>
> is:
>
> my $cmd = "perl ".$SCRIPT_URL ."?".$POLL_CODE_SURVEY."|";
>
> open CMD, $cmd;
No, not at all. It's probably easiest if you use LWP.
Ben
--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ] ben@morrow.me.uk
------------------------------
Date: Fri, 12 Mar 2004 21:29:49 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: call a cgi script from a cgi script
Message-Id: <40521dc6$0$277$626a14ce@news.free.fr>
"Joe" <jab_joe@www.com> a écrit dans le message de news:
6586e7f6.0403121215.55caa7f6@posting.google.com...
> How do I do this?
>
> I want my cgi script to call a cgi script with a argument.
>
> is:
>
> my $cmd = "perl ".$SCRIPT_URL ."?".$POLL_CODE_SURVEY."|";
>
> open CMD, $cmd;
>
> right?
I don't think this would work.
The method I use is to setup the QUERY_STRING environement variable.
This works most of the time :
system ("QUERY_STRING=$POLL_CODE_SURVEY perl the_script.cgi");
Some scripts may accept parameters passed on the command line.
In this case you could probably use :
system ("perl the_script.cgi $POLL_CODE_SURVEY");
hth
------------------------------
Date: 12 Mar 2004 20:41:06 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: call a cgi script from a cgi script
Message-Id: <u9znalg5nh.fsf@wcl-l.bham.ac.uk>
jab_joe@www.com (Joe) writes:
> I want my cgi script to call a cgi script with a argument.
Are you sure you really want that?
You usually want to access a web entity (makes no difference if it's
GCI or ASP or mod_perl or whatever) or call a script (or other other
local program not using the CGI API).
If the other local program is also Perl then what you really want to
do is cut out the common core and make it a module.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 12 Mar 2004 15:49:18 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: DBI and DBD problems
Message-Id: <remorse-771129.15491812032004@plato.harvard.edu>
In article <404f063f$1@news.wineasy.se>, Ketil <koh@sikkerhet.no>
wrote:
> #!/usr/bin/perl
>
> use strict;
> use DBI;
>
> my $dbh = DBI->connect( 'dbi:Oracle:salabim:1521',
> 'ids',
> 'ids',
> ) || die "Database connection not made:
> $DBI::errstr";
> $dbh->disconnect();
>
> database name : SALABIM
> user:ids
> passwd:ids
My best guess is to try the following:
my $db = DBI->connect('dbi:Oracle:salabim', 'ids', 'ids') or
die("Couldn't connect to db: " . $DBI::errstr);
You don't need to pass the port to the connection, as this is part of
the Net8 configuration (you do have a Net8 connection configured, yes?).
You might also want to run the following:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my @drivers = DBI->available_drivers();
foreach my $driver (@drivers) {
my @names = DBI->data_sources($driver);
print "Driver: $driver\n";
print "\t", join("\n\t", @names), "\n";
}
__END__
HTH,
Ricky
------------------------------
Date: Fri, 12 Mar 2004 15:52:32 -0600
From: Kevin <kevin_skelton@mgic.com>
Subject: DBI and Oracle Stored Procedure Arrays
Message-Id: <40523120.7A83D2DE@mgic.com>
I have an Oracle Insert Stored Procedure which accepts as input PL/SQL
Table parameters (i.e. Arrays).
[package definition]
...
type gca_srvc_id_array is table of
gc_cntct_to_srvc_xref.gca_srvc_id%type
index by binary_integer;
...
[stored proc]
...
v_srvc_id_array IN gca_srvc_id_array
...
Is there a way to pass a Perl array into the stored procedure call via
DBI?
Thanks!
------------------------------
Date: Fri, 12 Mar 2004 21:50:39 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: formmail problem
Message-Id: <c2t83c$20hc53$2@ID-184292.news.uni-berlin.de>
James wrote:
> I have a perl script I've been editing so that I can send some form
> data. it's based on one I used before and I'm pretty sure it's ok
I'm pretty sure it's not. Without having tested it, I see a Perl 4
style script with at least one apparent security hole: It can easily
be abused to send spam to multiple recipients.
> (had this problem before
Which is the problem you are referring to? (You did not tell us, and I
suppose it's not the one I mentioned.)
> sooooo, does all this lot look ok to you?
No.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 12 Mar 2004 21:38:48 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: formmail problem
Message-Id: <Xns94AAA956D3EEFdkwwashere@216.168.3.30>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> James wrote:
>> I have a perl script I've been editing so that I can send some form
>> data. it's based on one I used before and I'm pretty sure it's ok
>
> I'm pretty sure it's not. Without having tested it, I see a Perl 4
> style script with at least one apparent security hole: It can easily
> be abused to send spam to multiple recipients.
Yeah, I'm pretty sure it's formmail.pl from Matt Wright. Spammers love that
thing, and it's all over the place.
To the OP: you can get a drop-in replacement for this program at
http://nms-cgi.sourceforge.net/ -- one without all the security holes.
--
David Wall
------------------------------
Date: Fri, 12 Mar 2004 22:52:35 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: formmail problem
Message-Id: <c2tbno$21pdtb$1@ID-184292.news.uni-berlin.de>
David K. Wall wrote:
> Gunnar Hjalmarsson wrote:
>> James wrote:
>>> I have a perl script I've been editing so that I can send some
>>> form data. it's based on one I used before and I'm pretty sure
>>> it's ok
>>
>> I'm pretty sure it's not. Without having tested it, I see a Perl
>> 4 style script with at least one apparent security hole: It can
>> easily be abused to send spam to multiple recipients.
>
> Yeah, I'm pretty sure it's formmail.pl from Matt Wright. Spammers
> love that thing, and it's all over the place.
>
> To the OP: you can get a drop-in replacement for this program at
> http://nms-cgi.sourceforge.net/ -- one without all the security
> holes.
I don't think it's Matt's script this time, but I agree that OP would
be better off by checking out the script you suggested.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 12 Mar 2004 20:12:30 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: How to redirect headers in Perl?
Message-Id: <c2t5h7$621$1@news.simnet.is>
"Crazy Monkey" <wlin98004@hotmail.com> wrote in message
news:db81df92.0403121008.4d91310e@posting.google.com...
>
> a) client (user browser) hits an auto-login page (perl) on server 1.
> b) The perl program on server 1 is going to request a secure page from
> server 2.
> c) Server 2 will reply with a Realm authentication header.
> d) Perl program on server 1 will respond with the user information.
> e) If the user information is correct, server 2 will send the page to
> server 1.
> f) Server 1 will simply forward the content of the page to client.
> g) Client see the page on the secure server without login.
>
> So far I was able to get the above to work. The issue is that, when
> the client hit another secure page on server 2 without going through
> server 1, the user is prompted for authentication information again.
> ...
> I don't think what I want to do is possible, but you never know.
not unless you are ready to act as a proxy to the second server
for all subsequent requests. then the client just sees pages of server 2
as if they were on server 1.
but this is getting more and more OT
gnari
------------------------------
Date: Fri, 12 Mar 2004 22:04:20 +0100
From: "Hago Ziegler" <ha@hago-ziegler.de>
Subject: Image-Magick.ppd installation
Message-Id: <40522599$0$7975$9b4e6d93@newsread2.arcor-online.net>
Hi,
I have downloaded Image-Magick.zip. It contains Image-Magick.ppd, other
files and a readme-file, which says:
To install this ActiveState PPM package, run the following command
in the current directory: ppm install Image-Magick.ppd
I did this, but without success. This message is displayd:
Error: no suitable installation target found for package Image-Magick.
Does somebody know, what I could do?
Perl is installed and works. (C:\perl)
Also Image-Magick is installed and works.(C:\Image-Magick)
Regards, Hago
------------------------------
Date: Fri, 12 Mar 2004 22:39:55 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Re: Image-Magick.ppd installation
Message-Id: <40522e33$0$293$626a14ce@news.free.fr>
"Hago Ziegler" <ha@hago-ziegler.de> a écrit dans le message de news:
40522599$0$7975$9b4e6d93@newsread2.arcor-online.net...
> Hi,
>
> I have downloaded Image-Magick.zip. It contains Image-Magick.ppd, other
> files and a readme-file, which says:
May be its not the right package. Where did you get it ?
You could look at http://www.imagemagick.org/www/archives.html?
which has an install program which does it all.
------------------------------
Date: Fri, 12 Mar 2004 23:57:06 +0100
From: "Hago Ziegler" <ha@hago-ziegler.de>
Subject: Re: Image-Magick.ppd installation
Message-Id: <40524008$0$10253$9b4e6d93@newsread4.arcor-online.net>
"chatiman" schrieb:
> > I have downloaded Image-Magick.zip. It contains Image-Magick.ppd,
other
> > files and a readme-file, which says:
>
> May be its not the right package. Where did you get it ?
I got it from activestate.com. It's in the list of available modules.
> You could look at http://www.imagemagick.org/www/archives.html?
> which has an install program which does it all.
Thank you, I'll try.
Hago
------------------------------
Date: Fri, 12 Mar 2004 12:32:31 -0700
From: Todd Anderson <todd@asgweb.net>
To: Frescard <me@here.com>
Subject: Re: Mixing WAV Files
Message-Id: <4052104D.7608064@asgweb.net>
try ProTools
Frescard wrote:
> Is there a way (or module) that would allow me to overlay two or more WAV
> files and create a new file out of the mix?
> (If not in Perl, then perhaps someone knows of a way to do it in PHP or
> ASP?)
------------------------------
Date: Fri, 12 Mar 2004 15:31:58 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: Multiple compares -- TMTOWTDI
Message-Id: <remorse-7DC913.15315812032004@plato.harvard.edu>
In article <863f122c.0403110834.291f1cb4@posting.google.com>,
slkleine@hotmail.com (Steve The Geek) wrote:
> ############################################################################
> ## Declare & initialize modules & variables
> ############################################################################
> require 5.002;
> require strict;
> require warnings;
> use Date::Simple ('.all');
Just a small note, completely unrelated to the original discussion...
This should probably be:
require 5.002;
use strict;
use warnings;
Further, I'm not sure that Perl 5.002 had the warnings pragma -- if you
are running on a Unix box, I would put the following as the _first_ line
of the file:
#!/usr/bin/perl -w
[ or whatever the correct path to Perl is ]
If you are using Perl on windows, you might want to make sure that the
equivalent works with your version of Perl (ActiveState's will work, but
other than that I am woefully ignorant) and use the following:
#!perl -w
[or]
#!c:/perl/bin/perl -w
[ or correct path ]
It is very key that this line go before anything else in the file,
otherwise it won't work.
HTH,
Ricky
------------------------------
Date: Fri, 12 Mar 2004 22:33:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Multiple compares -- TMTOWTDI
Message-Id: <c2tdse$74o$1@wisteria.csv.warwick.ac.uk>
Quoth Richard Morse <remorse@partners.org>:
> In article <863f122c.0403110834.291f1cb4@posting.google.com>,
> slkleine@hotmail.com (Steve The Geek) wrote:
>
> > ################################################################
> > ## Declare & initialize modules & variables
> > ################################################################
As a matter of style, girt big block comments like this really don't
make things easier to follow, and neither do comments stating things
which are obvious from the code. It's much better to make sure you make
decent use of whitespace, and split things off into modules before they
get too complex.
> > require 5.002;
> > require strict;
> > require warnings;
> > use Date::Simple ('.all');
That should be ':all', and there's no need for the parens.
> Just a small note, completely unrelated to the original discussion...
>
> This should probably be:
>
> require 5.002;
use 5.002;
is better, as it happens at compile time (so the program will abort
immediately if the version is wrong). You may want to
provide a more friendly error message if the version is too low:
BEGIN {
if ($] < 5.002) {
die "This program requires perl 5.002\n";
}
}
or provide some sort of failover capability (not that *anyone* has *any*
excuse for using anything before 5.005, nowadays).
> use strict;
> use warnings;
Yes. Simply requiring strict/warnings won't do much for you: most of
their beneficial effects occur at compile time, and they won't do
anything at all if you don't call their import methods.
> Further, I'm not sure that Perl 5.002 had the warnings pragma
It was introduced in 5.6.0 (and presumably some dev releases before
that).
> -- if you
> are running on a Unix box, I would put the following as the _first_ line
> of the file:
> #!/usr/bin/perl -w
> [ or whatever the correct path to Perl is ]
It is recommended that /usr/bin/perl be a path to a perl, for the sake
of portability, even if the rest of perl is installed somewhere else.
Make that
#!/usr/bin/perl -w
use 5.002;
use strict;
BEGIN {
if (eval { require warnings }) {
$^W = 0;
import warnings;
}
}
The 'require warnings' is here in a BEGIN block, so it happens at
compile time.
> If you are using Perl on windows, you might want to make sure that the
> equivalent works with your version of Perl (ActiveState's will work, but
> other than that I am woefully ignorant) and use the following:
> #!perl -w
> [or]
> #!c:/perl/bin/perl -w
> [ or correct path ]
The path to perl is irrelevant on Win32: windows does not use the #!
line. Perl will read the -w (and other) switches from it, though, so it
is best to leave it as
#!/usr/bin/perl -w
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* ben@morrow.me.uk *
------------------------------
Date: Fri, 12 Mar 2004 21:50:35 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Passing variables / data between php - perl
Message-Id: <c2t839$20hc53$1@ID-184292.news.uni-berlin.de>
dave wrote:
> I'm looking for code samples on passing variables between php pages
> to perl scrips and from perl scripts to php pages.
I don't know about passing *variables*, but I'm passing *data* from
Perl (CGI) to PHP by
- printing to a temporary file,
- redirecting to a PHP script, and
- having the PHP script "implode" the file.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 12 Mar 2004 16:16:16 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Regex to match simple line of XML
Message-Id: <slrnc54dlg.67f.tadmc@magna.augustmail.com>
ac <aclarke@austin.rr.com> wrote:
> I am trying to get a regex to match a simple line of XML.
> my $xmlregex = qr/(?:^\s*<(\w+))|(?:\s+(\w)+=\"(.*?)\")|(?:>\s*$)/;
^^^^^
You only want the last letter of the attribute name?
(perhaps your test case should have included at least one attribute
with more than a 1-character name...)
Double quotes are not special, there is no need to backslash them.
> @items = ($line =~ m/$xmlregex/g);
> I know that XML can be broken across lines,
And can use single quotes on attributes, and can have space characters
that you don't account for and...
> but this is just a special
> case that I'm interested in.
Oh. OK then.
> Note the blank lines (null entries) that came from the match. How do I
> change the regex to avoid generating these null entries?
You can do it without changing the regex at all:
@items = grep defined, $line =~ m/$xmlregex/g;
> I'm actually
> trying to find the quickest way to parse that line of XML.
I don't know how fast it is, but here is another way to try:
if ( $testline =~ s/<([^>]+)>/$1/ ) { # so long angle brackets
my @items = grep length, split /\s+(\w+)="([^"]+)"/, $testline;
print "'$_'\n" for @items;
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 12 Mar 2004 12:38:03 -0700
From: Todd Anderson <todd@asgweb.net>
Subject: SCALAR(0x82e1024)
Message-Id: <40521199.3F86C688@asgweb.net>
Dear Persons,
I have a flat file that is modified by user with a perl script from
their browser. They can change password etc.. I keep getting this
'SCALAR(0x82e1024)' at the begiining of many rows in the flat file.
Does anyone know what it might mean?
Thanks in advance for your help.
------------------------------
Date: Fri, 12 Mar 2004 19:55:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: SCALAR(0x82e1024)
Message-Id: <tAo4c.1506$F9.1382@nwrddc01.gnilink.net>
Todd Anderson wrote:
> I have a flat file that is modified by user with a perl script from
> their browser. They can change password etc.. I keep getting this
> 'SCALAR(0x82e1024)' at the begiining of many rows in the flat file.
> Does anyone know what it might mean?
You have an error in line 42 of your program
(hint: you get that text when you print a reference).
jue
------------------------------
Date: Fri, 12 Mar 2004 14:38:50 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Text editor implemented in Perl
Message-Id: <120320041438507070%jgibson@mail.arc.nasa.gov>
In article <slrnc5409q.k63.xx087@smeagol.ncf.ca>, Glenn Jackman
<xx087@freenet.carleton.ca> wrote:
> Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> > When I enter a '#' to start a comment, vim puts it in column one,
> > thinking, I suppose, that I am starting a C preprocessor directive. How
> > do I get vim to leave the comment indented where it is? I tried reading
> > the vim help about defining actions for various modes, but it was too
> > complicated to understand easily and I ran out of time and patience to
> > slog through the description.
>
> Place, in your ~/.vimrc
> " don't force perl comment to be entered into column 1
> set cpoptions-=<
> inoremap # X<BS>#
>
> http://www.vim.org/tips/tip.php?tip_id=644
Thanks! Works great.
------------------------------
Date: Fri, 12 Mar 2004 14:42:49 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Text editor implemented in Perl
Message-Id: <120320041442491458%jgibson@mail.arc.nasa.gov>
In article <w4y8q5x6rf.fsf@mid.packer.its.vanderbilt.edu>, Andrew A.
Raines <aaraines@pobox.com> wrote:
> Jim Gibson <jgibson@mail.arc.nasa.gov> writes:
>
> > I, too, dislike all of emacs ctrl key combinations. But for me
> > the fatal flaw of emacs is the jump scroll. You move your cursor
> > line-by-line down to the bottom of the screen and the display
> > jumps up half a screen's worth. I find that very disorienting.
>
> I can understand the bothersome control-key dependency, but a minor
> default setting fatal?
>
> See <URL:http://www.emacswiki.org/cgi-bin/wiki.pl?BufferScrolling>.
Well, it's fatal if you don't know how to change it! There was nothing
in the available documentation about changing the scrolling when I was
trying to learn emacs. Thanks for the tip on changing the scrolling. It
is probably too late in life for me to make the switch to emacs,
however.
------------------------------
Date: 12 Mar 2004 19:36:42 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Tricky Perl Bug (amusing/unamusing)
Message-Id: <u94qsthn79.fsf@wcl-l.bham.ac.uk>
Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de> writes:
> zzapper wrote:
> > $
> > $phone=($phonelocal =~ /\d\d/) ? "$phonelocal":"$phonecentral";
> > In the above code snippet $phone was always being assigned
> > SCALAR(0x18ef230)
> But using strict [...]
>
> Can't use string ("1") as a SCALAR ref while "strict refs" in use at - line 6.
>
> This is assuming you don't have a scalar ref in $phone. You don't I presume?
Since the OP is witnessing autovivification we know that $phone was
undefined. So strict refs would not have helped the OP here.
(Although it often does).
However if the OP were programming with the mindset[1] that goes with
using strict vars then this probably would have avoided the problem.
$
my $phone=($phonelocal =~ /\d\d/) ? $phonelocal : $phonecentral;
Scalar found where operator expected, near "$ my $phone"
[1] Always declare all variables as lexically scoped in the smallest
applicable scope unless you have a reason to do otherwise.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 12 Mar 2004 16:22:30 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Tricky Perl Bug (amusing/unamusing)
Message-Id: <slrnc54e16.67f.tadmc@magna.augustmail.com>
Steven Kuo <skuo@mtwhitney.nsc.com> wrote:
> yes -- strict issues a warning.
strict never issues warnings.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 12 Mar 2004 19:14:35 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: using an assoc. array as a 'set'
Message-Id: <c2t26r$sr3$1@wisteria.csv.warwick.ac.uk>
Quoth anno4000@lublin.zrz.tu-berlin.de (Anno Siegel):
> My one concern is if the Perl community has the power, right down to
> the sense of man-power, to run two major lines of development, or
> three, if you count Parrot.
Well, currently there're only two: perl5 and parrot. When ponie (perl5
on parrot) matures (I think people're saying 5.12?) we'll be down to one
again... and somehow, I doubt perl6language will have finished
thrashing out the design by then... :)
Ben
--
perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
2047502190/' # ben@morrow.me.uk
------------------------------
Date: Fri, 12 Mar 2004 16:08:33 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: using an assoc. array as a 'set'
Message-Id: <remorse-45A217.16083312032004@plato.harvard.edu>
In article <c2o4o5$ajc$1@nets3.rz.RWTH-Aachen.DE>,
"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote:
> Also sprach ixtahdoom:
>
> > I find myself doing this quite a bit in perl:
> >
> > my %h;
> > :
> > :
> > {
> > $h{$k} = 1; # don't care about the value, only the key
> > }
> > :
>
> Here is a counter-intuitive (but working) way:
>
> undef $h{$k};
>
> Or you just assign undef in one or the other way:
>
> $h{$k} = undef;
> # or
> $h{$k} = ();
Internally, there is probably little difference between assigning the
value 1 and assigining the value undef to a key. So, if mostly what
you're concerned with is the truth value of the key, and just don't like
the ugly assignment, howabout
my %h;
$h{$k}++;
This (to my mind at least) looks much cleaner for the action of defining
a key, without necessarily caring about the value. And, what's more,
when six months later your boss comes back and wants to know how many
$k's there were (which happens all the time to me), you now know!
HTH,
Ricky
------------------------------
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 6251
***************************************