[30504] in Perl-Users-Digest
Perl-Users Digest, Issue: 1747 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 26 03:09:42 2008
Date: Sat, 26 Jul 2008 00:09:06 -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 Sat, 26 Jul 2008 Volume: 11 Number: 1747
Today's topics:
Re: Date format (Greg Bacon)
Re: Date format <noreply@gunnar.cc>
Re: Date format <cartercc@gmail.com>
Re: Detecting keypress when window isn't in focus <zentara@highstream.net>
Re: Detecting keypress when window isn't in focus <jurgenex@hotmail.com>
Re: FAQ 4.2 Why is int() broken? <szrRE@szromanMO.comVE>
fork process in Unix <silbermm@gmail.com>
Re: fork process in Unix (Greg Bacon)
How to match () pairs <PengYu.UT@gmail.com>
Re: How to match () pairs <tadmc@seesig.invalid>
Re: How to match () pairs <uri@stemsystems.com>
new CPAN modules on Sat Jul 26 2008 (Randal Schwartz)
perl dbi built on DB2 8.2 does not run on 9.1 dcruncher4@aim.com
Re: perl dbi built on DB2 8.2 does not run on 9.1 <glex_no-spam@qwest-spam-no.invalid>
Re: perl dbi built on DB2 8.2 does not run on 9.1 bwmiller16@gmail.com
Re: Profiling? <brian.d.foy@gmail.com>
Re: Profiling? <john@castleamber.com>
XML::LibXML::Reader Can't Find Method. libxml2 anyone? <jerry@ieee.org>
Re: XML::LibXML::Reader Can't Find Method. libxml2 anyo <jerry@ieee.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 Jul 2008 10:02:56 -0500
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Date format
Message-Id: <G5mdnU09fsm9dhTVnZ2dnUVZ_jSdnZ2d@posted.hiwaay2>
In article <522c892b-4fa9-4207-a4ab-c67ee8ab8f56@f1g2000prb.googlegroups.com>,
cc96ai <calvin.chan.cch@gmail.com> wrote:
: I want to change the date format in perl script
:
: input: "2005-11-01"
: output:November 1, 2005
Use the Date::Parse module:
#! /usr/local/bin/perl
use warnings;
use strict;
use Date::Parse qw/ strptime /;
use POSIX qw/ strftime /;
# output:November 1, 2005
my $date = "2005-11-01";
my(undef,undef,undef,$day,$month,$year) = strptime $date;
print strftime("%B %e, %Y\n", 0, 0, 0, $day, $month, $year);
Hope this helps,
Greg
--
This is the golden rule of fractional reserve banking: Do unto
depositors before the depositors do it unto you.
-- Gary North
------------------------------
Date: Fri, 25 Jul 2008 18:34:10 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Date format
Message-Id: <6eudk6F88nkeU1@mid.individual.net>
Greg Bacon wrote:
>
> use Date::Parse qw/ strptime /;
> use POSIX qw/ strftime /;
>
> # output:November 1, 2005
> my $date = "2005-11-01";
>
> my(undef,undef,undef,$day,$month,$year) = strptime $date;
> print strftime("%B %e, %Y\n", 0, 0, 0, $day, $month, $year);
Or shorter:
print strftime("%B %d, %Y\n", 0, 0, 0, (strptime $date)[3..5]);
(%d is a more portable specifier than %e. The latter does not work on my
Windows XP box.)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 25 Jul 2008 10:57:57 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: Date format
Message-Id: <c286e578-06f8-483f-970a-24eb5c54c90d@z26g2000pre.googlegroups.com>
On Jul 23, 6:34 pm, cc96ai <calvin.chan....@gmail.com> wrote:
> I want to change the date format in perl script
>
> input: "2005-11-01"
> output:November 1, 2005
>
> thanks
If you want to roll your own, do this:
%months = (
1 => "January",
2 => "February",
3 => "March",
etc )
@input = split /-/, $input;
printf "%s $d, $d", $months{$input[1]}, $input[2], $input[0];
CC
------------------------------
Date: Fri, 25 Jul 2008 06:08:56 -0400
From: zentara <zentara@highstream.net>
Subject: Re: Detecting keypress when window isn't in focus
Message-Id: <059j84pr88m5ck81f7mqb5rtc2l3chujqk@4ax.com>
On Fri, 25 Jul 2008 00:53:08 -0700 (PDT), Chris Wilkins
<chris.wilkins1@gmail.com> wrote:
>I have a script which loops forever and I need a way to break out of
>the loop with a keypress. I can do this with the script below and it
>works fine, my problem is that if I take the focus away from the
>command window that the script is running in, the keypress isn't
>recognised and the loop doesn't end.
>
>#!/usr/bin/perl -l
>
>use strict;
>use warnings;
>
>use Win32::GuiTest qw/:ALL/;
>use Term::ReadKey;
>
>my $i = 0;
>
>while (1)
>{
>
> ReadMode(3);
> my $char = ReadKey(-1);
> if ($char eq 'q')
> {
> last;
> }
> print $i;
> sleep 1;
> $i++;
>
>}
>
>Is there a way (with Term::ReadKey or anything else) of detecting a
>keypress when the script window does not have focus?
It looks like you are using Win32, so take this with a grain of salt,
I'm on Linux.
I don't know how Win32 does it, but you are looking for a global
keyboard grab, usually called grabGlobal. Be warned that it will
lock the keyboard from other apps.
You might want to look at defining window manager hotkeys, that
will let other apps run, by working at the window manager level.
Win32 must have some hotkey app you can run, but you will have to do
some work to let the hotkey find the app you are running.... maybe by
giving it a unique name?
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html
------------------------------
Date: Fri, 25 Jul 2008 13:02:15 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Detecting keypress when window isn't in focus
Message-Id: <lejj84dulgs1ada1apj9c9grkqi20pcc7g@4ax.com>
Chris Wilkins <chris.wilkins1@gmail.com> wrote:
>Is there a way (with Term::ReadKey or anything else) of detecting a
>keypress when the script window does not have focus?
AFAIK no because that keypress will go to whatever application currently
has the focus.
jue
------------------------------
Date: Fri, 25 Jul 2008 12:00:52 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <g6d7t402dln@news4.newsguy.com>
Peter J. Holzer wrote:
> On 2008-07-24 16:19, szr <szrRE@szromanMO.comVE> wrote:
>> Peter J. Holzer wrote:
>>> No, floats in perl are normally "double", i.e., 64 bit. But maybe
>>> you've built perl long "long double" (80, 96, or 128 bit, depending
>>> on platform) support?
>>>
>>> % perl -V:nvtype -V:nvsize
>>> nvtype='double';
>>> nvsize='8';
>>
>> You are right. Built with 64 bit int, but 96 bit float, the size of a
>> long double in c:
>>
>> $ perl5.10.0 -V:nvtype -V:nvsize
>> nvtype='long double';
>> nvsize='12';
>>
>> $ perl5.8.8 -V:nvtype -V:nvsize
>> nvtype='long double';
>> nvsize='12';
>>
>>> % perl -e 'print int(0.6/0.2-2), qq{\n};'
>>> 0
>>
>> Seems you need the extra precision that building Perl with "long
>> double" support
>
> No. The extra precision doesn't help. As I argued below it's just
> coincidence that error isn't noticable in this case. if you use other
> numbers instead of 0.6 and 0.2, you will discover some where the
> result is "wrong" even with 96 bits. Indeed you may find some where
> the result is correct for 64 bits and wrong for 96 bits.
Is there any way to get a lore more precision than 96 or 128 bits, or is
it better to write (or find) a module that does "moving" calculations,
kind of like a certain Linux console program whose name I cannot recall.
--
szr
------------------------------
Date: Fri, 25 Jul 2008 06:13:45 -0700 (PDT)
From: ahappydeath <silbermm@gmail.com>
Subject: fork process in Unix
Message-Id: <662f32e9-bdbc-4054-bf70-2b97616b9027@h17g2000prg.googlegroups.com>
Anyone know how to rewrite the script below in Unix?
foreach $dbname (@Import_Databases) {
print "$dbname\n";
Win32::Process::Create( $ProcTemp,
"$Perl_Path",
"perl $Script_Path\\import_db2.pl
$dbname",
0,
CREATE_NEW_CONSOLE,
'.') or die "Couldnt fork process";
push(@ProcObj, $ProcTemp);
}
------------------------------
Date: Fri, 25 Jul 2008 09:49:57 -0500
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: fork process in Unix
Message-Id: <H66dnWTGANWIdRTVnZ2dnUVZ_h-dnZ2d@posted.hiwaay2>
In article <662f32e9-bdbc-4054-bf70-2b97616b9027@h17g2000prg.googlegroups.com>,
ahappydeath <silbermm@gmail.com> wrote:
: Anyone know how to rewrite the script below in Unix?
:
: foreach $dbname (@Import_Databases) {
: print "$dbname\n";
: Win32::Process::Create(
: $ProcTemp,
: "$Perl_Path",
: "perl $Script_Path\\import_db2.pl $dbname",
: 0,
: CREATE_NEW_CONSOLE,
: '.') or die "Couldnt fork process";
: push(@ProcObj, $ProcTemp);
: }
The best answer to your question depends on what you're trying
to do. Are you willing to wait on import_db2.pl? If so, keep it
simple and use the system operator. If you expect import_db2.pl
to be long-running, there are many examples in the perlipc
manpage of forking processes.
Greg
--
Our Bill of Rights is a set of proud claims by free men . . . The alleged
right to abortion, by contrast, had to be tortured out of the Constitution
. . . The Supreme Court's fateful decision, written in cuttlefish ink . . .
would have drawn a grim smile from Orwell. -- Joseph Sobran
------------------------------
Date: Fri, 25 Jul 2008 17:05:09 -0700 (PDT)
From: Peng Yu <PengYu.UT@gmail.com>
Subject: How to match () pairs
Message-Id: <4f8e2cd6-a7f2-4c24-a26e-fbb870a2fb53@u36g2000pro.googlegroups.com>
Hi,
I would like to match a pattern such as
something( something_1( something_2( ...
(something_n)...)something_else_2)something_else_1)
, where all the brackets pair up and there could be any number of
pairs. something_1, something_2, ..., and something_n could contain
'()' pair as well.
I'm wondering if there is any way to do this with regex?
Thanks,
Peng
------------------------------
Date: Fri, 25 Jul 2008 19:52:39 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: How to match () pairs
Message-Id: <slrng8ktan.f99.tadmc@tadmc30.sbcglobal.net>
Peng Yu <PengYu.UT@gmail.com> wrote:
> I would like to match
Then you should type:
perldoc -q match
How do I find matching/nesting anything?
> a pattern such as
>
> something( something_1( something_2( ...
> (something_n)...)something_else_2)something_else_1)
>
> , where all the brackets pair up and there could be any number of
> pairs. something_1, something_2, ..., and something_n could contain
> '()' pair as well.
>
> I'm wondering if there is any way to do this with regex?
"This isn't something that can be done in one regular expression, no
matter how complicated."
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 26 Jul 2008 06:16:28 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: How to match () pairs
Message-Id: <x7fxpxw4oz.fsf@mail.sysarch.com>
>>>>> "TJM" == Tad J McClellan <tadmc@seesig.invalid> writes:
TJM> Peng Yu <PengYu.UT@gmail.com> wrote:
>> I would like to match
TJM> Then you should type:
TJM> perldoc -q match
TJM> How do I find matching/nesting anything?
>> a pattern such as
>> something( something_1( something_2( ...
>> (something_n)...)something_else_2)something_else_1)
>>
>> , where all the brackets pair up and there could be any number of
>> pairs. something_1, something_2, ..., and something_n could contain
>> '()' pair as well.
TJM> "This isn't something that can be done in one regular expression, no
TJM> matter how complicated."
that could be done with (??{ code }) which is considered experimental
but 5.10 has (?PARNO) which says it can match nested parens. see perldoc
perlre and look for PARNO. it is still not for newbies and the faint of
heart but it is supported. it is still better/simpler to use a module like
text::balanced to match nested parens.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sat, 26 Jul 2008 04:42:21 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jul 26 2008
Message-Id: <K4LJqL.1068@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.
AnyEvent-CouchDB-1.00
http://search.cpan.org/~beppu/AnyEvent-CouchDB-1.00/
a non-blocking CouchDB client based on jquery.couch.js
----
Bio-Grep-0.10.4
http://search.cpan.org/~limaone/Bio-Grep-0.10.4/
Perl extension for searching in DNA and Protein sequences
----
Cache-Repository-0.06
http://search.cpan.org/~dmcbride/Cache-Repository-0.06/
Generic repository of files
----
Catalyst-Authentication-Credential-Kerberos-0.01
http://search.cpan.org/~evdb/Catalyst-Authentication-Credential-Kerberos-0.01/
----
Catalyst-Authentication-Credential-Testing-0.01
http://search.cpan.org/~evdb/Catalyst-Authentication-Credential-Testing-0.01/
----
Check-ISA-0.04
http://search.cpan.org/~nuffin/Check-ISA-0.04/
DWIM, correct checking of an object's class
----
Config-Model-0.624
http://search.cpan.org/~ddumont/Config-Model-0.624/
Framework to create configuration validation tools and editors
----
Config-Model-Itself-0.204
http://search.cpan.org/~ddumont/Config-Model-Itself-0.204/
Model editor for Config::Model
----
DB2-db-0.21
http://search.cpan.org/~dmcbride/DB2-db-0.21/
Framework wrapper around DBD::DB2 for a specific database
----
Data-Rand-0.0.4
http://search.cpan.org/~dmuey/Data-Rand-0.0.4/
Random string and list utility
----
Data-UUID-LibUUID-0.03
http://search.cpan.org/~nuffin/Data-UUID-LibUUID-0.03/
uuid.h based UUID generation (versions 1, 2 and 4)
----
Digest-MD5-File-0.07
http://search.cpan.org/~dmuey/Digest-MD5-File-0.07/
Perl extension for getting MD5 sums for files and urls.
----
Form-Processor-0.19
http://search.cpan.org/~hank/Form-Processor-0.19/
validate and process form data
----
Games-Solitaire-Verify-0.03
http://search.cpan.org/~shlomif/Games-Solitaire-Verify-0.03/
verify solutions for solitaire games.
----
Google-Chart-0.05000_02
http://search.cpan.org/~dmaki/Google-Chart-0.05000_02/
Interface to Google Charts API
----
HTML-Mason-1.40
http://search.cpan.org/~drolsky/HTML-Mason-1.40/
High-performance, dynamic web site authoring system
----
JE-0.023
http://search.cpan.org/~sprout/JE-0.023/
Pure-Perl ECMAScript (JavaScript) Engine
----
LaTeX-Table-0.6.3
http://search.cpan.org/~limaone/LaTeX-Table-0.6.3/
Perl extension for the automatic generation of LaTeX tables.
----
Locale-Maketext-Utils-0.0.10
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-0.0.10/
Adds some utility functionality and failure handling to Local::Maketext handles
----
Locale-Maketext-Utils-0.0.11
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-0.0.11/
Adds some utility functionality and failure handling to Local::Maketext handles
----
Log-Handler-0.45
http://search.cpan.org/~bloonix/Log-Handler-0.45/
Log messages to several outputs.
----
Math-GSL-0.05_01
http://search.cpan.org/~leto/Math-GSL-0.05_01/
Perl interface to the GNU Scientific Library (GSL) using SWIG
----
Math-Units-1.3
http://search.cpan.org/~dmuey/Math-Units-1.3/
Unit conversion
----
Module-Replace-0.02
http://search.cpan.org/~dmcbride/Module-Replace-0.02/
Replace functionality in other modules
----
Net-Pcap-Easy-1.0
http://search.cpan.org/~jettero/Net-Pcap-Easy-1.0/
Net::Pcap is awesome, but it's difficult to bootstrap
----
OpenResty-0.3.19
http://search.cpan.org/~agent/OpenResty-0.3.19/
General-purpose web service platform for web applications
----
POE-Component-SNMP-1.10
http://search.cpan.org/~rdb/POE-Component-SNMP-1.10/
POE interface to Net::SNMP
----
Proc-ProcessTable-0.44
http://search.cpan.org/~durist/Proc-ProcessTable-0.44/
Perl extension to access the unix process table
----
Pugs-Compiler-Rule-0.34
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.34/
Compiler for Perl 6 regexes
----
Rose-DBx-Object-Renderer-0.20
http://search.cpan.org/~danny/Rose-DBx-Object-Renderer-0.20/
Web UI Rendering for Rose::DB::Object
----
Sort-MultipleFields-0.001_01
http://search.cpan.org/~dcantrell/Sort-MultipleFields-0.001_01/
Conveniently sort on multiple fields
----
Sphinx-Search-0.12
http://search.cpan.org/~jjschutz/Sphinx-Search-0.12/
Sphinx search engine API Perl client
----
Squatting-0.42
http://search.cpan.org/~beppu/Squatting-0.42/
A Camping-inspired Web Microframework for Perl
----
String-Trigram-0.11
http://search.cpan.org/~tareka/String-Trigram-0.11/
Find similar strings by trigram (or 1, 2, 4, etc.-gram) method
----
Text-InHTML-0.0.4
http://search.cpan.org/~dmuey/Text-InHTML-0.0.4/
Display plain text in HTML
----
Tk-EntrySet-0.01
http://search.cpan.org/~lamprecht/Tk-EntrySet-0.01/
display/edit a list of values in a Set of Widgets.
----
WebService-EveOnline-0.5.1
http://search.cpan.org/~chrisc/WebService-EveOnline-0.5.1/
a wrapper intended to (eventually) provide a consistent interface to the MMORPG game, "Eve Online"
----
WebService-EveOnline-0.5.2
http://search.cpan.org/~chrisc/WebService-EveOnline-0.5.2/
a wrapper intended to (eventually) provide a consistent interface to the MMORPG game, "Eve Online"
----
WebService-EveOnline-0.5.3
http://search.cpan.org/~chrisc/WebService-EveOnline-0.5.3/
a wrapper intended to (eventually) provide a consistent interface to the MMORPG game, "Eve Online"
----
XML-Grammar-Fortune-0.0101
http://search.cpan.org/~shlomif/XML-Grammar-Fortune-0.0101/
convert the FortunesXML grammar to other formats and from plaintext.
----
libwww-perl-5.814
http://search.cpan.org/~gaas/libwww-perl-5.814/
----
v6-0.026
http://search.cpan.org/~fglock/v6-0.026/
An experimental Perl 6 implementation
----
v6-0.027
http://search.cpan.org/~fglock/v6-0.027/
An experimental Perl 6 implementation
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: 25 Jul 2008 07:47:49 -0700
From: dcruncher4@aim.com
Subject: perl dbi built on DB2 8.2 does not run on 9.1
Message-Id: <g6cp2l01fns@drn.newsguy.com>
Our perl DBI is built on DB2 8.2. It runs fine on 8.2
However it does not run on 9.1. After the connect to the database, at the first
SQL it gives this error
"sql0818n A timestamp conflict occurred sqlstate 51003"
Are we suppose to rebuild perl DBI for db2 in ver 9.1
------------------------------
Date: Fri, 25 Jul 2008 10:40:44 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: perl dbi built on DB2 8.2 does not run on 9.1
Message-Id: <4889f3fc$0$48227$815e3792@news.qwest.net>
dcruncher4@aim.com wrote:
> Our perl DBI is built on DB2 8.2. It runs fine on 8.2
>
> However it does not run on 9.1. After the connect to the database, at the first
> SQL it gives this error
>
> "sql0818n A timestamp conflict occurred sqlstate 51003"
>
> Are we suppose to rebuild perl DBI for db2 in ver 9.1
>
I don't use DB2, however spending a couple of minutes searching
the Internet for that error seems to point to a db2stats.bnd
problem.
Cause
The db2stats.bnd package is not bound after fix pack installations.
And may sites list how to update it.
It probably wouldn't hurt to rebuild DBD with the new 9.1 libraries.
------------------------------
Date: Fri, 25 Jul 2008 12:18:41 -0700 (PDT)
From: bwmiller16@gmail.com
Subject: Re: perl dbi built on DB2 8.2 does not run on 9.1
Message-Id: <e244d9c0-131f-46cc-85dd-2466791fca9f@m3g2000hsc.googlegroups.com>
On Jul 25, 10:47=A0am, dcrunch...@aim.com wrote:
> Our perl DBI is built on DB2 8.2. It runs fine on 8.2
>
> However it does not run on 9.1. After the connect to the database, at the=
first
> SQL it gives this error
>
> "sql0818n A timestamp conflict occurred sqlstate 51003"
>
> Are we suppose to rebuild perl DBI for db2 in ver 9.1
This should be fixed after you bind these:
db2 CONNECT TO MYDB
db2 BIND $HOME/sqllib/bnd/@db2ubind.lst BLOCKING ALL GRANT PUBLIC
db2 BIND $HOME/sqllib/bnd/@db2cli.lst BLOCKING ALL GRANT PUBLIC
db2 BIND $HOME/sqllib/bnd/db2schema.bnd BLOCKING ALL GRANT PUBLIC
db2rbind MYDB all /l $HOME/MYDB.log
------------------------------
Date: Fri, 25 Jul 2008 12:37:25 -0700
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: Profiling?
Message-Id: <250720081237257334%brian.d.foy@gmail.com>
In article <slrng8i70m.4pm.tadmc@tadmc30.sbcglobal.net>, Tad J
McClellan <tadmc@seesig.invalid> wrote:
> Alex Buell <alex.buell@munted.org.uk> wrote:
> > Is there a way to profile a Perl program? for example, see where it
> > spends most of its time doing things? Thanks!
>
>
> Your Question is Asked Frequently:
>
> perldoc -q profile
The answer in the FAQ is a bit dated, but I've just fixed it to include
the latest technology in profiling. Once the web site updates you'll
be able to see the new answer at
http://faq.perl.org/perlfaq3.html#How_do_I_profile_my_
I also added a list of other things to read about profiling:
You can read more about profiling in I<Programming Perl>, chapter 20,
or I<Mastering Perl>, chapter 5.
L<perldebguts> documents creating a custom debugger if you need to
create a special sort of profiler. brian d foy describes the process
in I<The Perl Journal>, "Creating a Perl Debugger",
http://www.ddj.com/184404522 , and "Profiling in Perl"
http://www.ddj.com/184404580 .
Perl.com has two interesting articles on profiling: "Profiling Perl",
by Simon Cozens, http://www.perl.com/lpt/a/850 and "Debugging and
Profiling mod_perl Applications", by Frank Wiles,
http://www.perl.com/pub/a/2006/02/09/debug_mod_perl.html .
Randal L. Schwartz writes about profiling in "Speeding up Your Perl
Programs" for I<Unix Review>,
http://www.stonehenge.com/merlyn/UnixReview/col49.html , and "Profiling
in Template Toolkit via Overriding" for I<Linux Magazine>,
http://www.stonehenge.com/merlyn/LinuxMag/col75.html .
------------------------------
Date: 25 Jul 2008 22:39:46 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Profiling?
Message-Id: <Xns9AE6B3AC936ABcastleamber@130.133.1.4>
brian d foy <brian.d.foy@gmail.com> wrote:
> I also added a list of other things to read about profiling:
Thanks brian, great list.
--
John
http://johnbokma.com/
------------------------------
Date: Fri, 25 Jul 2008 09:05:20 -0700 (PDT)
From: Jerry Krinock <jerry@ieee.org>
Subject: XML::LibXML::Reader Can't Find Method. libxml2 anyone?
Message-Id: <79a69713-663b-4d1f-912b-e5f3be1379d9@w1g2000prk.googlegroups.com>
I need to use Perl module XML::LibXML::Reader [1]. My web host has it
installed. However, when I simply invoke it to create a new object, I
get an error message from within the module:
Can't locate object method "_newForString" via package
"XML::LibXML::Reader" at /usr/lib/perl5/site_perl/5.8.8/i686-linux/XML/
LibXML/Reader.pm line 159.
Checking the source, I find that indeed _newForString is called at
line 159 and not defined anywhere.
The XML::LibXML::Reader documentation states that it "requires at
least libxml2-2.6.21". So, I thought: Maybe my web host does not have
this prerequisite installed?
I then installed XML::LibXML::Reader on my local Macintosh and ran my
script there, but got the same result. My Mac has a 4.2-megabyte /usr/
lib/libxml2.2.dylib. Admittedly, I don't understand much about this,
but I thought that these dylibs were only available to programs
written in C, not scripts. What should I be looking for?
Of course, the problem could be in my code, shown below, but I don't
see how because the bomb at line 159 is when the constructor simply
tries to hand off my string argument, before anything substantive is
done.
Thank you,
Jerry Krinock
[1] http://search.cpan.org/dist/XML-LibXML/lib/XML/LibXML/Reader.pod
[2] ***** TestSS.pl *****
#!/usr/local/bin/perl
my $string = q{<?xml version="1.0" encoding="UTF-8"?>
<new-order-notification xmlns="http://checkout.google.com/schema/2"
serial-number="403468137391754-00001-7">
<timestamp>2008-07-25T14:20:57.237Z</timestamp>
<shopping-cart>
<items>
<item>
<item-name>Bookmarksman</item-name>
</item>
</items>
</shopping-cart>
</new-order-notification>} ;
use XML::LibXML::Reader ;
my $reader = XML::LibXML::Reader->new(string => $string) ;
while ($reader->read) {
print "Parsed node name: $reader->name\n" ;
}
------------------------------
Date: Fri, 25 Jul 2008 17:37:36 -0700 (PDT)
From: Jerry Krinock <jerry@ieee.org>
Subject: Re: XML::LibXML::Reader Can't Find Method. libxml2 anyone?
Message-Id: <e3dcb8f9-2673-484d-b6f7-7a2f6f0c2849@34g2000hsh.googlegroups.com>
Well, after my web host decided to loosen up and give me shell access,
and read the logs, I was able to find the problem. It was in my
code: "You are not defining a location, string, IO, DOM or FD". I
had directed STDERR to a separate log file, but for some reason it
gave me only that other error, which set me on the wrong
troubleshooting path.
Thanks for reading!
Jerry
------------------------------
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 1747
***************************************