[30746] in Perl-Users-Digest
Perl-Users Digest, Issue: 1991 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 19 11:09:45 2008
Date: Wed, 19 Nov 2008 08:09:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 19 Nov 2008 Volume: 11 Number: 1991
Today's topics:
ANNOUNCE: AFS Perl API 2.6.1 released <nog@MPA-Garching.MPG.DE>
Re: Create a record with fixed length <mgjv@heliotrope.com.au>
how to support delete of <directoryname> as well as <di <mikaelpetterson@hotmail.com>
Re: how to support delete of <directoryname> as well as <tadmc@seesig.invalid>
Re: MSXML, validateOnParse, win32 <etwas77@googlemail.com>
new CPAN modules on Wed Nov 19 2008 (Randal Schwartz)
Perl module to generate word report <urgearun@gmail.com>
Re: sleep(30) hangs (fidokomik\)
Unexpected (?) try/catch Behavior <rob@robwilkerson.org>
Re: Unexpected (?) try/catch Behavior <cichomitiko@gmail.com>
Re: Unexpected (?) try/catch Behavior <peter@makholm.net>
Re: Unexpected (?) try/catch Behavior <rob@robwilkerson.org>
Re: Unexpected (?) try/catch Behavior <rob@robwilkerson.org>
use constant XX => ( ... <nospam@nospam.com>
Re: use constant XX => ( ... <josef.moellers@fujitsu-siemens.com>
Re: use constant XX => ( ... <1usa@llenroc.ude.invalid>
Re: use constant XX => ( ... <tadmc@seesig.invalid>
Re: use constant XX => ( ... <julian@invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Nov 2008 11:40:31 GMT
From: Norbert Gruener <nog@MPA-Garching.MPG.DE>
Subject: ANNOUNCE: AFS Perl API 2.6.1 released
Message-Id: <KAKwM4.7ow@zorch.sf-bay.org>
AFS Perl API Version 2.6.1
I am pleased to announce the AFS Perl API 2.6.1 release
The AFS module bundle is a dynamically loadable extension to
Perl. It gives the AFS user and administrator access to many of
the AFS programming APIs, allowing you to make these calls
directly from Perl, rather then processing the output of a
command. The AFS module bundle is a thin layer above the low-level
AFS APIs.
This is just a bug-fix release.
Where To Get It
The version 2.6.1 is now available at
http://www.MPA-Garching.MPG.de/~nog/perl/AFS-2.6.1.tar.gz
http://www.cpan.org/authors/id/N/NO/NOG/AFS-2.6.1.tar.gz
This release should work on all UNIX/Linux platforms which have
AFS API interfaces and the appropriate C compilation environment.
MD5SUM
41d266e9eb9e5f3db0447b80555621b5 AFS-2.6.1.tag.gz
User Visible Changes in this Release
- fixed AFS::KAS method "getentry"
- fixed AFS::VLDB method "listvldb"
- updated example scripts
For more information about the current state of the AFS Perl API,
check my "AFS Perl API Kwiki" site at:
http://www.mpa-garching.mpg.de/kwiki/nog/afsperl/
Share and Enjoy!
Norbert
--
------------------------------
Date: Wed, 19 Nov 2008 12:59:39 +1100
From: Martien Verbruggen <mgjv@heliotrope.com.au>
Subject: Re: Create a record with fixed length
Message-Id: <slrngi6sob.7h7.mgjv@mgjv.heliotrope.home>
On Tue, 18 Nov 2008 16:53:05 -0800 (PST),
matou <yvon.cadieux@gmail.com> wrote:
> I have a file where the record that I read is over 2341 char and I
> have to split to a fixed length to an another file ,
What exactly are you having trouble with?
To read a fixed length from a file, see read() (perldoc -f read). To
"split to a fixed length", probably see substr() (perldoc -f substr)),
depending on what exactly you men by that. Maybe you need unpack()? To
write to another file, use print, or maybe syswrite() if you need to
write part of your string. Of course, you'll also need to open the
existing file for read, and the target file for write (perldoc -f open,
perldoc -f close).
It's hard to tell what exactly you need, and in which order. You give
virtually no useful information.
Martien
--
|
Martien Verbruggen | Think of the average person. Half of the
| people out there are dumber.
|
------------------------------
Date: Wed, 19 Nov 2008 03:20:18 -0800 (PST)
From: mike <mikaelpetterson@hotmail.com>
Subject: how to support delete of <directoryname> as well as <directoryname>/
Message-Id: <d3233e7e-5ff9-4a40-a014-2a90a5da7a1e@z6g2000pre.googlegroups.com>
Hi,
We are using a perl script to delete file/folder in apache ( cgi-bin).
When we do a delete with and url that ends with <directoryname>/ the
delete is performed.
However when we use only <directoryname> without the slash then we get
the response saying,
Directory permanently moved.
This is the perl-script we are using ( see below). Any hints on what
we have been missing out?
----------------------------------
#!/usr/bin/perl
use warnings;
use File::Basename;
use File::Path;
#Very simple delete handler implementation.
#Note: This script should be used securely.
# A simple log file, must be writable by the user that this program
runs as.
# Should not be within the document tree.
$deletelog = "/tmp/delete1.log";
my $files_deleted = 0;
# Check we are using PUT method
if ($ENV{'REQUEST_METHOD'} ne "DELETE") { &reply(500, "Request method
is not DELETE"); }
&log("Request is DELETE");
# Note: should also check we are an authentication user by checking
# REMOTE_USER
# Check we got a destination filename
$filenamein = $ENV{'PATH_TRANSLATED'};
if (!$filenamein) {
&reply(500, "No PATH_TRANSLATED");
}
my($filename, $directories) = fileparse($filenamein);
&log("Filename : $filename \n");
&log("Directory : $directories \n");
if(! $filename) {
#we are deleting a directory remove the tree in quiet mode
$files_deleted = rmtree($directories);
&log("Number files deleted in $directories : $files_deleted\n");
} else {
#delete a file
&log("Will remove single file : $filenamein\n");
if(unlink($filenamein) == 0) {
&reply(500, "Cannot delete unknown $filenamein");
}
}
# Everything seemed to work, reply with 204 (or 200). Should reply
with 201
# if content was created, not updated.
&reply(200);
exit(0);
------------------------
------------------------------
Date: Wed, 19 Nov 2008 07:05:48 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: how to support delete of <directoryname> as well as <directoryname>/
Message-Id: <slrngi83pc.duk.tadmc@tadmc30.sbcglobal.net>
mike <mikaelpetterson@hotmail.com> wrote:
> We are using a perl script to delete file/folder in apache ( cgi-bin).
>
> When we do a delete with and url that ends with <directoryname>/ the
> delete is performed.
> However when we use only <directoryname> without the slash then we get
> the response saying,
> Directory permanently moved.
Is that the actual message (copied/pasted) or a paraphrasing
of the message?
Did the directory get removed in this case?
> This is the perl-script we are using ( see below). Any hints on what
> we have been missing out?
fileparse() does not know what are directories and what are files.
That is, it does not look at the actual filesystem, it simply parses
the string that is passed to it. If passed:
/tmp/i_am_a_directory
It does not know that the final component is a directory. It only
knows that it is the final component in the path.
> ----------------------------------
> #!/usr/bin/perl
>
> use warnings;
You should also have
use strict;
in all of your Perl programs.
> &log("Request is DELETE");
You should not use ampersands on subroutine calls unless you know
what it does, and what it does is what you want to do (it seldom is).
log("Request is DELETE");
> # Note: should also check we are an authentication user by checking
> # REMOTE_USER
That is not secure you know...
> # Check we got a destination filename
> $filenamein = $ENV{'PATH_TRANSLATED'};
> if (!$filenamein) {
> &reply(500, "No PATH_TRANSLATED");
> }
That may or may not be a real path you know (google it)...
> if(! $filename) {
> #we are deleting a directory remove the tree in quiet mode
> $files_deleted = rmtree($directories);
>
> &log("Number files deleted in $directories : $files_deleted\n");
> } else {
> #delete a file
> &log("Will remove single file : $filenamein\n");
> if(unlink($filenamein) == 0) {
> &reply(500, "Cannot delete unknown $filenamein");
> }
> }
Since you cannot rely on either PATH_TRANSLATED nor $directories
being a real path, your code should check if it is a real path itself:
# untested
my $path = $ENV{'PATH_TRANSLATED'};
if ( -d $path) { # delete a directory
$files_deleted = rmtree( $path );
log("Number files deleted in $path : $files_deleted\n");
}
elsif ( -f $path ) # delete a file
log("Will remove single file : $path\n");
reply(500, "Cannot delete unknown $path" unless unlink $path;
}
else {
reply(500, "'$path' is neither a directory nor a file");
}
What you are trying to do is fraught with danger, and problems
still exists even with my code above.
I predict disaster...
You need real authentication, else crackers will delete your website.
There is a race condition in my code above.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 19 Nov 2008 06:30:59 -0800 (PST)
From: etwas77 <etwas77@googlemail.com>
Subject: Re: MSXML, validateOnParse, win32
Message-Id: <c75482bc-4c0b-4e55-8e00-521de9b2dfe9@a3g2000prm.googlegroups.com>
>
> Despite what the article says, I don't think you should be using the
> string "False", which has a true value. Use 0 instead. (FWIW, I've used
> MSXML myself this way, and it appears to work fine for me when I specify
> 0 forvalidateOnParse.)
> --
> Eric Amick
> Columbia, MD
tried that and all other combinations. still this:
$dom->{validateOnParse} = 0; # no validate
my $error = $dom->Load($xml);
produces me this:
$dom->parseError()->reason() = The system cannot locate the object
specified.
Error processing resource 'blablabla.dtd'.
------------------------------
Date: Wed, 19 Nov 2008 05:42:25 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Nov 19 2008
Message-Id: <KAKFup.1xJF@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-FloodControl-1.970000
http://search.cpan.org/~gugu/Algorithm-FloodControl-1.970000/
Limit event processing to count/time ratio.
----
Algorithm-FloodControl-v1.97
http://search.cpan.org/~gugu/Algorithm-FloodControl-v1.97/
Limit event processing to count/time ratio.
----
AnyEvent-Mojo-0.6002
http://search.cpan.org/~melo/AnyEvent-Mojo-0.6002/
Start async Mojo servers easly
----
App-ZofCMS-Plugin-FloodControl-0.0101
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-FloodControl-0.0101/
plugin for protecting forms and anything else from floods (abuse)
----
Badger-0.03_02
http://search.cpan.org/~abw/Badger-0.03_02/
Perl Application Programming Toolkit
----
Catalyst-Authentication-Store-DBI-0.00_01
http://search.cpan.org/~janus/Catalyst-Authentication-Store-DBI-0.00_01/
Storage class for Catalyst Authentication using DBI
----
Catalyst-Authentication-Store-DBI-0.00_02
http://search.cpan.org/~janus/Catalyst-Authentication-Store-DBI-0.00_02/
Storage class for Catalyst Authentication using DBI
----
Cisco-ShowIPRoute-Parser-1.02
http://search.cpan.org/~markpf/Cisco-ShowIPRoute-Parser-1.02/
parse Cisco 'show ip route' command
----
Class-MOP-0.69_01
http://search.cpan.org/~drolsky/Class-MOP-0.69_01/
A Meta Object Protocol for Perl 5
----
Combine-3.12-0
http://search.cpan.org/~aardo/Combine-3.12-0/
Focused Web crawler framework
----
Config-KeyValue-0.01
http://search.cpan.org/~blair/Config-KeyValue-0.01/
read simple "KEY=VALUE" formatted configuration files.
----
Config-Settings-0.00_03
http://search.cpan.org/~berle/Config-Settings-0.00_03/
Parsing pleasant configuration files
----
Config-Settings-0.00_04
http://search.cpan.org/~berle/Config-Settings-0.00_04/
Parsing pleasant configuration files
----
Crypt-SKey-0.08
http://search.cpan.org/~kwilliams/Crypt-SKey-0.08/
Perl S/Key calculator
----
DBIx-DataModel-1.07
http://search.cpan.org/~dami/DBIx-DataModel-1.07/
Classes and UML-style Associations on top of DBI
----
DBIx-Migration-Directories-0.08
http://search.cpan.org/~crakrjack/DBIx-Migration-Directories-0.08/
Install/remove/upgrade/downgrade SQL schemas
----
Data-Apache-mod_status-0.01
http://search.cpan.org/~jkutej/Data-Apache-mod_status-0.01/
get values from Apache mod_status page
----
EBook-Tools-0.3.1
http://search.cpan.org/~azed/EBook-Tools-0.3.1/
An object class for the manipulation and generation of E-books based on IDPF standards
----
Graphics-Color-0.17
http://search.cpan.org/~gphat/Graphics-Color-0.17/
Device and library agnostic color spaces.
----
Graphics-Primitive-0.36
http://search.cpan.org/~gphat/Graphics-Primitive-0.36/
Device and library agnostic graphic primitives
----
IO-Stream-1.0.1
http://search.cpan.org/~powerman/IO-Stream-1.0.1/
ease non-blocking I/O streams based on EV
----
IO-Stream-Crypt-RC4-1.0.0
http://search.cpan.org/~powerman/IO-Stream-Crypt-RC4-1.0.0/
Crypt::RC4 plugin for IO::Stream
----
IO-Stream-MatrixSSL-1.0.0
http://search.cpan.org/~powerman/IO-Stream-MatrixSSL-1.0.0/
Crypt::MatrixSSL plugin for IO::Stream
----
IO-Stream-Proxy-HTTPS-1.0.0
http://search.cpan.org/~powerman/IO-Stream-Proxy-HTTPS-1.0.0/
HTTPS proxy plugin for IO::Stream
----
LCFG-Build-Tools-0.0.47
http://search.cpan.org/~sjquinney/LCFG-Build-Tools-0.0.47/
LCFG software release tools
----
Log-Dispatch-Twitter-0.01
http://search.cpan.org/~sartak/Log-Dispatch-Twitter-0.01/
Log messages via Twitter
----
Log-Dispatch-Twitter-0.02
http://search.cpan.org/~sartak/Log-Dispatch-Twitter-0.02/
Log messages via Twitter
----
Mail-Log-Parse-1.0200
http://search.cpan.org/~dstaal/Mail-Log-Parse-1.0200/
Parse and return info in maillogs
----
Mail-Salsa-0.12
http://search.cpan.org/~hdias/Mail-Salsa-0.12/
An easy to use perl mailing list manager module.
----
MojoX-Session-0.02
http://search.cpan.org/~vti/MojoX-Session-0.02/
Session management for Mojo
----
MooseX-Emulate-Class-Accessor-Fast-0.00400
http://search.cpan.org/~groditi/MooseX-Emulate-Class-Accessor-Fast-0.00400/
Emulate Class::Accessor::Fast behavior using Moose attributes
----
MooseX-Templated-0.01
http://search.cpan.org/~isillitoe/MooseX-Templated-0.01/
Template framework for Moose objects
----
Net-BitTorrent-0.027_011
http://search.cpan.org/~sanko/Net-BitTorrent-0.027_011/
BitTorrent peer-to-peer protocol class
----
Net-Calais-1.02
http://search.cpan.org/~aar/Net-Calais-1.02/
Interface to OpenCalais web service
----
POE-Component-SmokeBox-0.02
http://search.cpan.org/~bingos/POE-Component-SmokeBox-0.02/
POE enabled CPAN smoke testing with added value.
----
Parse-Stallion-0.4
http://search.cpan.org/~arthur/Parse-Stallion-0.4/
Backtracking parser with during or after evaluation
----
Path-Abstract-0.095
http://search.cpan.org/~rkrimen/Path-Abstract-0.095/
Fast and featureful UNIX-style path parsing and manipulation
----
Pg-Explain-0.07
http://search.cpan.org/~depesz/Pg-Explain-0.07/
Object approach at reading explain analyze output
----
SVN-Hooks-0.12.477
http://search.cpan.org/~gnustavo/SVN-Hooks-0.12.477/
A framework for implementing Subversion hooks.
----
Sane-0.01
http://search.cpan.org/~ratcliffe/Sane-0.01/
Perl extension for the SANE (Scanner Access Now Easy) Project
----
Statistics-Associations-0.00001
http://search.cpan.org/~miki/Statistics-Associations-0.00001/
Calculats Association Coefficients of Normal Scale.
----
Statistics-Associations-0.00002
http://search.cpan.org/~miki/Statistics-Associations-0.00002/
Calculates Association Coefficients of Nominal Scale.
----
Statistics-Associations-0.00003
http://search.cpan.org/~miki/Statistics-Associations-0.00003/
Calculates Association Coefficients of Nominal Scale.
----
Storable-AMF-0.18
http://search.cpan.org/~grian/Storable-AMF-0.18/
Perl extension for serialize/deserialize AMF0/AMF3 data
----
Test-Aggregate-0.35_01
http://search.cpan.org/~ovid/Test-Aggregate-0.35_01/
Aggregate *.t tests to make them run faster.
----
Test-HTTP-0.14
http://search.cpan.org/~mml/Test-HTTP-0.14/
Test HTTP interactions.
----
Test-Resub-1.06
http://search.cpan.org/~airwave/Test-Resub-1.06/
Lexically scoped subroutine replacement for testing
----
TheSchwartz-Moosified-0.01
http://search.cpan.org/~fayland/TheSchwartz-Moosified-0.01/
TheSchwartz based on Moose!
----
WWW-DHL-0.03
http://search.cpan.org/~sepp/WWW-DHL-0.03/
Perl module for the DHL online tracking service.
----
WWW-Mechanize-1.51_02
http://search.cpan.org/~petdance/WWW-Mechanize-1.51_02/
Handy web browsing in a Perl object
----
WWW-Ohloh-API-1.0_0
http://search.cpan.org/~yanick/WWW-Ohloh-API-1.0_0/
Ohloh API implementation
----
XML-RSS-1.37
http://search.cpan.org/~shlomif/XML-RSS-1.37/
creates and updates RSS files
----
XML-Toolkit-0.03
http://search.cpan.org/~perigrin/XML-Toolkit-0.03/
A set of tools for dealing with XML with the Way of the Moose.
----
Xacobeo-0.03_02
http://search.cpan.org/~potyl/Xacobeo-0.03_02/
XPath (XML Path Language) visualizer.
----
all-0.51
http://search.cpan.org/~dexter/all-0.51/
pragma to load all packages under a namespace
----
warnings-method-0.10
http://search.cpan.org/~gfuji/warnings-method-0.10/
Produces warnings if methods are called as functions
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 19 Nov 2008 06:16:58 -0800 (PST)
From: arun <urgearun@gmail.com>
Subject: Perl module to generate word report
Message-Id: <7c316de6-11d6-409c-bcd4-988fc0017b6e@s9g2000prm.googlegroups.com>
Hi Perl Gurus,
Is there any perl module available to generate MS word report in Linux
environment ?
Thanks in Advance
-Arun
------------------------------
Date: Wed, 19 Nov 2008 03:35:21 +0100
From: "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz>
Subject: Re: sleep(30) hangs
Message-Id: <gfvu2g$54q$1@ns.felk.cvut.cz>
marathoner@sina.com wrote:
> Hi,
>
> I have a programs that checks emails via IMAP and then sleeps for 30
> seconds. Occasionally, it hangs on the line where it calls sleep(30).
>
> I use Perl 5.8.8 (ActivePerl Build 820) running on Windows 2000 SP4.
>
The reason is maybe that IMAP server need more time to logout user. I'm not
familiar with IMAP but my users which are using POP3 must leave 60 seconds time
space before he/she can login again.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail.
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
------------------------------
Date: Wed, 19 Nov 2008 06:05:38 -0800 (PST)
From: Rob Wilkerson <rob@robwilkerson.org>
Subject: Unexpected (?) try/catch Behavior
Message-Id: <1a866f51-c71a-4e5f-a3e6-90d8dad99c69@35g2000pry.googlegroups.com>
Disclaimer: I know enough Perl to get by when I absolutely have
to use it, so maybe this is the correct behavior, but having never
seen it in any other language, I thought I'd post the question to the
group and maybe learn something.
I have a scenario where I need to try to insert a record into a MySQL
database and, if the insert fails due to, well, anything, then perform
an update instead. To do this, I'm using the try/catch construct of
the Error module:
use Error qw(:try);
try {
$sql = qq {
INSERT INTO table (
field1,
field2,
field3,
field4,
field5
)
VALUES ( ?, ?, ?, ?, ? )
};
$sth = $mysql->prepare ( $sql );
$sth->execute ( $value1, $value2, $value3, $value4, $value5 );
$sth->finish();
}
catch Error with {
$sql = qq {
UPDATE table
SET field1 = ?,
field2 = ?,
field3 = ?
WHERE field4 = ?
AND field5 = ?
};
$sth = $mysql->prepare ( $sql );
$sth->execute ( $value1, $value2, $value3, $value4, $value5 );
$sth->finish();
};
The code seems to be doing exactly what I expect. That is, dropping
into the catch block and performing the update where a record exists,
but the errors being caught are not being suppressed. I still get a
lot of:
DBD::mysql::st execute failed: Duplicate entry '121993-14196' for key
1 at ./get_metrics.pl line 247.
It's not the end of the world, but I'd prefer to suppress the message
if there's a way to do that. Is this expected behavior? It certainly
caught me by surprise and I spent a while trying to debug until I
realized that if I looked past the messages, the work was getting
done.
I did try using the eval{} if ($@){} combo, but got the same result.
Thanks.
------------------------------
Date: Wed, 19 Nov 2008 15:13:03 +0100
From: "Radoulov, Dimitre" <cichomitiko@gmail.com>
Subject: Re: Unexpected (?) try/catch Behavior
Message-Id: <gg16tf$v1$1@reader.motzarella.org>
Rob Wilkerson wrote:
[...]
> I have a scenario where I need to try to insert a record into a MySQL
> database and, if the insert fails due to, well, anything, then perform
> an update instead.
[...]
Not answering your Perl question, but
what's wrong with:
INSERT ... ON DUPLICATE KEY UPDATE
Regards
Dimitre
------------------------------
Date: Wed, 19 Nov 2008 15:41:51 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: Unexpected (?) try/catch Behavior
Message-Id: <87myfv6amo.fsf@vps1.hacking.dk>
Rob Wilkerson <rob@robwilkerson.org> writes:
> The code seems to be doing exactly what I expect. That is, dropping
> into the catch block and performing the update where a record exists,
> but the errors being caught are not being suppressed. I still get a
> lot of:
>
> DBD::mysql::st execute failed: Duplicate entry '121993-14196' for key
> 1 at ./get_metrics.pl line 247.
Being in a try block does not prevent DBI from printing error
messages. You have to set the PrintError attribute on you database
handle to 'off'.
//Makholm
------------------------------
Date: Wed, 19 Nov 2008 06:45:33 -0800 (PST)
From: Rob Wilkerson <rob@robwilkerson.org>
Subject: Re: Unexpected (?) try/catch Behavior
Message-Id: <c839b06d-687c-48bf-8075-2bb932f2a237@e1g2000pra.googlegroups.com>
On Nov 19, 9:13=A0am, "Radoulov, Dimitre" <cichomit...@gmail.com> wrote:
> Rob Wilkerson wrote:
>
> Not answering your Perl question, but
> what's wrong with:
>
> INSERT ... ON DUPLICATE KEY UPDATE
>
> Regards
> Dimitre
Hmmm. Nothing at all, except that I'd never needed it and wasn't aware
of its existence. I'll definitely look at that since it'd be a much
cleaner solution all the way around.
Thanks for the clue.
------------------------------
Date: Wed, 19 Nov 2008 06:53:25 -0800 (PST)
From: Rob Wilkerson <rob@robwilkerson.org>
Subject: Re: Unexpected (?) try/catch Behavior
Message-Id: <a1a6df12-fea7-44be-8d61-c58af4d75582@n33g2000pri.googlegroups.com>
On Nov 19, 9:41=A0am, Peter Makholm <pe...@makholm.net> wrote:
> Rob Wilkerson <r...@robwilkerson.org> writes:
> > The code seems to be doing exactly what I expect. That is, dropping
> > into the catch block and performing the update where a record exists,
> > but the errors being caught are not being suppressed. I still get a
> > lot of:
>
> > DBD::mysql::st execute failed: Duplicate entry '121993-14196' for key
> > 1 at ./get_metrics.pl line 247.
>
> Being in a try block does not prevent DBI from printing error
> messages. You have to set the PrintError attribute on you database
> handle to 'off'.
Damn. I've built this thing to reuse a single database handle, so I
can't really do that. I might want those errors somewhere else.
Thanks for the insight.
------------------------------
Date: Wed, 19 Nov 2008 11:06:09 +0100
From: Julian Lafontaine <nospam@nospam.com>
Subject: use constant XX => ( ...
Message-Id: <4923e512$0$2853$ba620e4c@news.skynet.be>
Hi Group,
There are two syntax for the "use constant" pragma: to declare a scalar
or to declare a list.
use constant CONST => scalarvalue;
use constant LIST => qw( listitem1, listitem2, listitem3);
I've found this in a perl module :Win32::Exe.
Could someone explain the syntax?
use constant DISPATCH_TABLE => (
"PE\0\0" => "PE",
'*' => sub { die "Incorrect PE header -- not a valid .exe file" },
);
What is DISPATCH_TABLE: a scalar or a list?
Thanks in advance.
------------------------------
Date: Wed, 19 Nov 2008 12:43:05 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: use constant XX => ( ...
Message-Id: <gg0u43$jli$2@nntp.fujitsu-siemens.com>
Julian Lafontaine wrote:
> Hi Group,
>
> There are two syntax for the "use constant" pragma: to declare a scalar
> or to declare a list.
>
> use constant CONST => scalarvalue;
>
> use constant LIST => qw( listitem1, listitem2, listitem3);
>
>
>
> I've found this in a perl module :Win32::Exe.
> Could someone explain the syntax?
>
>
> use constant DISPATCH_TABLE => (
> "PE\0\0" => "PE",
> '*' => sub { die "Incorrect PE header -- not a valid .exe
> file" },
> );
>
> What is DISPATCH_TABLE: a scalar or a list?
It is a list. The "=>" are "fat commas".
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Wed, 19 Nov 2008 12:08:00 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: use constant XX => ( ...
Message-Id: <Xns9B5B488D78D1Dasu1cornelledu@127.0.0.1>
Julian Lafontaine <nospam@nospam.com> wrote in
news:4923e512$0$2853$ba620e4c@news.skynet.be:
> use constant DISPATCH_TABLE => (
> "PE\0\0" => "PE",
> '*' => sub { die "Incorrect PE header -- not a valid
> .exe file" },
> );
>
> What is DISPATCH_TABLE: a scalar or a list?
It is a list which is most likely used to construct a hash someplace.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Wed, 19 Nov 2008 06:06:33 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: use constant XX => ( ...
Message-Id: <slrngi80a9.duk.tadmc@tadmc30.sbcglobal.net>
Julian Lafontaine <nospam@nospam.com> wrote:
> use constant LIST => qw( listitem1, listitem2, listitem3);
You should always enable warnings when developing Perl code.
[ I also suggest choosing a less common munged address. I have
nospam@nospam.com killfiled due to its use by several trolls.
]
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 19 Nov 2008 16:50:48 +0100
From: Julian Lafontaine <julian@invalid>
Subject: Re: use constant XX => ( ...
Message-Id: <492435d9$0$2846$ba620e4c@news.skynet.be>
Thank you Josef, Sinan,...
Tad J McClellan a écrit :
> Julian Lafontaine <nospam@nospam.com> wrote:
>
>
>> use constant LIST => qw( listitem1, listitem2, listitem3);
>
>
> You should always enable warnings when developing Perl code.
>
You, are, definitely, right!,
>
> [ I also suggest choosing a less common munged address. I have
> nospam@nospam.com killfiled due to its use by several trolls.
> ]
>
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1991
***************************************