[30679] in Perl-Users-Digest
Perl-Users Digest, Issue: 1924 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 15 09:09:40 2008
Date: Wed, 15 Oct 2008 06:09:08 -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 Wed, 15 Oct 2008 Volume: 11 Number: 1924
Today's topics:
Compare tool <itamar.sion@gmail.com>
Re: Compare tool <itamar.sion@gmail.com>
Re: Comparing audio files <kieranocall@gmail.com>
Re: Comparing audio files <greymausg@mail.com>
Re: Comparing audio files <RedGrittyBrick@spamweary.invalid>
Re: Help: How to process output of a program <cdalten@gmail.com>
Re: Help: How to process output of a program <tim@burlyhost.com>
mod_perl: sharing data across httpd childs ? <howachen@gmail.com>
Re: mod_perl: sharing data across httpd childs ? <joost@zeekat.nl>
Re: mod_perl: sharing data across httpd childs ? <howachen@gmail.com>
new CPAN modules on Wed Oct 15 2008 (Randal Schwartz)
Re: Odd behaviour with has key - wide character <joe@inwap.com>
Perl script: String comparison Ignoring spaces <mushtaqk921@gmail.com>
Text::CSV problem <natxete@asenjo.nl.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 14 Oct 2008 16:00:12 -0700 (PDT)
From: Itamar <itamar.sion@gmail.com>
Subject: Compare tool
Message-Id: <0455d96b-b41b-411c-ad99-e30dda73ba9a@s9g2000prg.googlegroups.com>
Sarra,
You can use Data and Schema compare tool by Nobhill, its free for
MySQL users, and working with all other data bases.
http://nobhillsoft.com/NHDBCompare.aspx
Goodluck.
------------------------------
Date: Tue, 14 Oct 2008 16:01:53 -0700 (PDT)
From: Itamar <itamar.sion@gmail.com>
Subject: Re: Compare tool
Message-Id: <8ba4eaf2-7b90-4581-bb97-14320c3a907d@l33g2000pri.googlegroups.com>
On Oct 15, 1:00=A0am, Itamar <itamar.s...@gmail.com> wrote:
> Sarra,
> You can use Data and Schema compare tool by Nobhill, its free for
> MySQL users, and working with all other data bases.
>
> http://nobhillsoft.com/NHDBCompare.aspx
>
> Goodluck.
Ooops,
I meant to post at :
http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/cb6=
4dd30b43b059/467111e145f986f6?hl=3Den&lnk=3Dst&q=3Dcompare+Mysql+database#.=
..
------------------------------
Date: Wed, 15 Oct 2008 01:33:39 -0700 (PDT)
From: kieran <kieranocall@gmail.com>
Subject: Re: Comparing audio files
Message-Id: <689a0ab5-0cb8-463c-bc61-c236c678d682@w1g2000prk.googlegroups.com>
On Oct 8, 5:12 pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> kieran <kieranoc...@gmail.com> wrote:
> >I am trying tocompare twosimilar audio files (WAV). From what i have
> >read i need to sample both audio files at certain frequencies and run
> >these through a FFT and then compare the results. Can anyone advise me
> >if this is the correct approach and also describe the steps i need to
> >take to get to the stage where I can compare the files.
>
> You could try the ESP::PSI module.
>
> jue
Hi Jue,
thanks for your reply, i have searched for the module you mentiones in
CPAN and Google but could not find it.
Can you please send me a link.
Best Regards,
Kieran
------------------------------
Date: 15 Oct 2008 10:42:29 GMT
From: greymaus <greymausg@mail.com>
Subject: Re: Comparing audio files
Message-Id: <slrngfbd5r.lk3.greymausg@maus.org>
On 2008-10-15, kieran <kieranocall@gmail.com> wrote:
> On Oct 8, 5:12 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>> kieran <kieranoc...@gmail.com> wrote:
>> >I am trying tocompare twosimilar audio files (WAV). From what i have
>> >read i need to sample both audio files at certain frequencies and run
>> >these through a FFT and then compare the results. Can anyone advise me
>> >if this is the correct approach and also describe the steps i need to
>> >take to get to the stage where I can compare the files.
>>
>> You could try the ESP::PSI module.
>>
>> jue
>
> Hi Jue,
> thanks for your reply, i have searched for the module you mentiones in
> CPAN and Google but could not find it.
> Can you please send me a link.
> Best Regards,
> Kieran
The reply may, just may, be his attempt at humour. You can try the NSA!.
--
Greymaus
.
.
...
------------------------------
Date: Wed, 15 Oct 2008 12:15:47 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Comparing audio files
Message-Id: <48f5d0e8$0$29491$da0feed9@news.zen.co.uk>
greymaus wrote:
> On 2008-10-15, kieran <kieranocall@gmail.com> wrote:
>> On Oct 8, 5:12 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>>> kieran <kieranoc...@gmail.com> wrote:
>>>> I am trying tocompare twosimilar audio files (WAV). From what i have
>>>> read i need to sample both audio files at certain frequencies and run
>>>> these through a FFT and then compare the results. Can anyone advise me
>>>> if this is the correct approach and also describe the steps i need to
>>>> take to get to the stage where I can compare the files.
>>> You could try the ESP::PSI module.
>>>
>>> jue
>> Hi Jue,
>> thanks for your reply, i have searched for the module you mentiones in
>> CPAN and Google but could not find it.
>> Can you please send me a link.
>> Best Regards,
>> Kieran
>
> The reply may, just may, be his attempt at humour. You can try the NSA!.
>
Surely there's an Acme::ESP and Acme::PSI in CPAN?
--
RGB
* ***
*** *
*
------------------------------
Date: Tue, 14 Oct 2008 19:57:39 -0700 (PDT)
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: Help: How to process output of a program
Message-Id: <87ab585f-1b28-4aba-b721-1fbf028a07eb@a29g2000pra.googlegroups.com>
On Oct 14, 2:12 pm, Tim Greer <t...@burlyhost.com> wrote:
> Amy Lee wrote:
> > Hello,
>
> > How to process output of a program? For example, I want to parse the
> > output of /sbin/lspci program.
>
> > Thanks.
>
> > Amy
>
> Open with a pipe for read, or consider something like IPC::Open*. Read
> the information about "Bidirectional Communication with Another
> Process" in the docs.
> --
I would just like to point out that the man pages for both IPC::Open2
and IPC::Open3 assume that the reader is somewhat proficient with
*nix. Over the course of the years, I've met a lot of perl
programmers that don't have the technical literacy to understand and
then use the IPC::Open* functions. I'm serious.
------------------------------
Date: Tue, 14 Oct 2008 20:30:51 -0700
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Help: How to process output of a program
Message-Id: <MtdJk.104$_B6.89@newsfe12.iad>
grocery_stocker wrote:
> On Oct 14, 2:12 pm, Tim Greer <t...@burlyhost.com> wrote:
>> Amy Lee wrote:
>> > Hello,
>>
>> > How to process output of a program? For example, I want to parse
>> > the output of /sbin/lspci program.
>>
>> > Thanks.
>>
>> > Amy
>>
>> Open with a pipe for read, or consider something like IPC::Open*.
>> Read the information about "Bidirectional Communication with Another
>> Process" in the docs.
>> --
>
> I would just like to point out that the man pages for both IPC::Open2
> and IPC::Open3 assume that the reader is somewhat proficient with
> *nix. Over the course of the years, I've met a lot of perl
> programmers that don't have the technical literacy to understand and
> then use the IPC::Open* functions. I'm serious.
I don't doubt what you say. Being a Perl programmer doesn't make you a
systems administrator (especially a *nix sys admin), and there are
chances of some people not understanding the suggestion. However, I
feel it is best to offer the suggestions just in case, and that's
basically always the case).
Of course, there's no denying that most people that claim to be Perl
programmers are hardly people you would feel comfortable using the term
"Programmer" to describe anyway, so I am aware that pretty much any
suggestion could equally be best left unsaid or tossed out the window,
but I like to offer everyone the same chances, even if sometimes it
might be in vain.
You may notice when I post on usenet, that I rarely to never go into any
great detail, and that's primarily the reason why (going on about
something too unfamiliar to the OP). Should someone wish to pay me to
code for them that's different, but on usenet, I try to post in a frame
of mind to provide everyone with the same answers, so they can improve
if they are capable and willing.
Also, IPC::Open2 does work on Win32 or am I mistaken? (IPC::Open3 isn't
fully supported on it though), and regardless, if the user read over
the module's documentation, they could get some insight/ideas, even
with the pipe usage it could replace.
Also, I didn't want to assume their platform, but the fact they said the
wanted the output from /sbin/lspci, pretty much sealed the suggestion
in my mind and had me believe they have some type of insight. Further
suggestions, directions and information, even if they don't use it, is
always a good thing. They might be able to benefit from it, but it
could certainly only add confusion.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Wed, 15 Oct 2008 01:36:01 -0700 (PDT)
From: howa <howachen@gmail.com>
Subject: mod_perl: sharing data across httpd childs ?
Message-Id: <20dfc7fb-3402-4630-b10f-1d3d421f6b33@p10g2000prf.googlegroups.com>
I am refering to the tutorial (http://modperlbook.org/html/4-2-3-
PerlModule-and-PerlRequire.html),
about setting up Perl module memory sharing across http childs:
==================================
1. in httpd.conf
Added PerlRequire /home/www/cgi-bin/startup.pl
the its contents is:
use strict;
use lib "/home/www/cgi-bin/";
use TestPM ();
1;
==================================
2. The TestPM's content
use strict;
package TestPM;
my $data;
sub new {
my ($class) = @_;
my $self = {};
bless $self, $class;
return $self;
}
sub init {
$data = "1234567890" x 1000000; # 10M of data
}
==================================
3. test.cgi
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use strict;
use TestPM;
TestPM::init();
==================================
By stress testing the test.cgi, I found memory is not shared at all,
using the top command, e.g.
>> top -bc -n 1 | grep httpd
11290 web 25 0 100m 23m 1620 R 47 0.3 0:00.29 /usr/
local/apache_1.3.41/bin/httpd
11247 web 20 0 101m 23m 1628 R 41 0.3 0:05.15 /usr/
local/apache_1.3.41/bin/httpd
As you can see, each httpd is using 23m, and 1620bytes shared, which I
belive the much data is shared....
Any idea?
Thanks.
------------------------------
Date: Wed, 15 Oct 2008 12:48:04 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: mod_perl: sharing data across httpd childs ?
Message-Id: <87r66igmmz.fsf@zeekat.nl>
howa <howachen@gmail.com> writes:
> By stress testing the test.cgi, I found memory is not shared at all,
> using the top command, e.g.
The only data that might be shared is data that is already initialized at
the startup phase. Data that's copied / assigned during at later stages
will not be shared. The manual and the book both mention this.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Wed, 15 Oct 2008 04:23:27 -0700 (PDT)
From: howa <howachen@gmail.com>
Subject: Re: mod_perl: sharing data across httpd childs ?
Message-Id: <ad310d67-8dbb-4b75-b95c-3e437c4916ea@a3g2000prm.googlegroups.com>
Hello,
On Oct 15, 6:48=A0pm, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> howa <howac...@gmail.com> writes:
> The only data that might be shared is data that is already initialized at
> the startup phase. Data that's copied / assigned during at later stages
> will not be shared. The manual and the book both mention this.
>
Thanks for reply.
Even I put the line:
>> TestPM::init();
inside the startup.pl, still the same
------------------------------
Date: Wed, 15 Oct 2008 04:42:22 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Oct 15 2008
Message-Id: <K8rJqM.1Hxw@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.
Acme-Murphy-1.00
http://search.cpan.org/~memowe/Acme-Murphy-1.00/
If anything can go wrong, it will.
----
App-Cmd-0.201
http://search.cpan.org/~rjbs/App-Cmd-0.201/
write command line apps with less suffering
----
App-ZofCMS-Plugin-AntiSpamMailTo-0.0101
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-AntiSpamMailTo-0.0101/
"smart" HTML escapes to protect mailto:foo@bar.com links from not-so-smart spam bots
----
App-ZofCMS-Plugin-Cookies-0.0103
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-Cookies-0.0103/
HTTP Cookie handling plugin for ZofCMS
----
App-ZofCMS-Plugin-FormToDatabase-0.0101
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-FormToDatabase-0.0101/
simple insertion of query into database
----
App-ZofCMS-Plugin-TagCloud-0.0103
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-TagCloud-0.0103/
generate "tag clouds"
----
Business-3DSecure-0.02
http://search.cpan.org/~drfrog/Business-3DSecure-0.02/
Perl extension for 3D Secure Credit Card Verification
----
Business-3DSecure-Cardinal-0.05
http://search.cpan.org/~drfrog/Business-3DSecure-Cardinal-0.05/
Perl extension for 3DSecure authentication using Cardinal
----
Business-OnlinePayment-Protx-0.04
http://search.cpan.org/~wreis/Business-OnlinePayment-Protx-0.04/
Protx backend for Business::OnlinePayment
----
CPANPLUS-YACSmoke-0.22
http://search.cpan.org/~bingos/CPANPLUS-YACSmoke-0.22/
Yet Another CPANPLUS Smoke Tester
----
Catalyst-Authentication-Store-Tangram-0.005
http://search.cpan.org/~bobtfish/Catalyst-Authentication-Store-Tangram-0.005/
A storage class for Catalyst authentication from a class stored in Tangram
----
Catalyst-Helper-FastCGI-ExternalServer-0.05
http://search.cpan.org/~zigorou/Catalyst-Helper-FastCGI-ExternalServer-0.05/
FastCGI daemon start/stop script for using FastCgiExternalServer
----
Catalyst-Runtime-5.8000_02
http://search.cpan.org/~mramberg/Catalyst-Runtime-5.8000_02/
The Catalyst Framework Runtime
----
Class-MOP-0.67
http://search.cpan.org/~drolsky/Class-MOP-0.67/
A Meta Object Protocol for Perl 5
----
Coat-Persistent-0.102
http://search.cpan.org/~sukria/Coat-Persistent-0.102/
Simple Object-Relational mapping for Coat objects
----
Config-Model-Itself-1.207
http://search.cpan.org/~ddumont/Config-Model-Itself-1.207/
Model editor for Config::Model
----
Crypt-Rijndael-1.07_01
http://search.cpan.org/~bdfoy/Crypt-Rijndael-1.07_01/
Crypt::CBC compliant Rijndael encryption module
----
DBD-Pg-2.11.1
http://search.cpan.org/~turnstep/DBD-Pg-2.11.1/
PostgreSQL database driver for the DBI module
----
DBIx-SchemaChecksum-0.24
http://search.cpan.org/~domm/DBIx-SchemaChecksum-0.24/
Generate and compare checksums of database schematas
----
DTS-0.05
http://search.cpan.org/~arfreitas/DTS-0.05/
Perl classes to access Microsoft SQL Server 2000 DTS Packages
----
Dist-Zilla-1.003
http://search.cpan.org/~rjbs/Dist-Zilla-1.003/
distribution builder; installer not included!
----
ExtUtils-MakeMaker-6.47_01
http://search.cpan.org/~mschwern/ExtUtils-MakeMaker-6.47_01/
Create a module Makefile
----
File-HomeDir-0.82
http://search.cpan.org/~adamk/File-HomeDir-0.82/
Find your home and other directories, on any platform
----
Gentoo-Probe-1.0.6
http://search.cpan.org/~rpaul/Gentoo-Probe-1.0.6/
----
HTTP-Size-1.13_01
http://search.cpan.org/~bdfoy/HTTP-Size-1.13_01/
Get the byte size of an internet resource
----
IO-Lambda-0.29
http://search.cpan.org/~karasik/IO-Lambda-0.29/
non-blocking I/O in lambda style
----
MIME-Lite-HTML-1.23
http://search.cpan.org/~alian/MIME-Lite-HTML-1.23/
Provide routine to transform a HTML page in a MIME-Lite mail
----
Mail-Log-Parse-1.0.2
http://search.cpan.org/~dstaal/Mail-Log-Parse-1.0.2/
Parse and return info in maillogs
----
Module-Setup-0.03_02
http://search.cpan.org/~yappo/Module-Setup-0.03_02/
a simple module maker "yet another Module::Start(?:er)?"
----
Moose-0.59
http://search.cpan.org/~drolsky/Moose-0.59/
A postmodern object system for Perl 5
----
MooseX-Method-Signatures-0.06
http://search.cpan.org/~flora/MooseX-Method-Signatures-0.06/
Method declarations with type constraints and no source filter
----
Net-OpenID-Consumer-1.02
http://search.cpan.org/~mart/Net-OpenID-Consumer-1.02/
library for consumers of OpenID identities
----
Net-UPnP-1.4
http://search.cpan.org/~skonno/Net-UPnP-1.4/
Perl extension for UPnP
----
Net-UPnP-1.4.1
http://search.cpan.org/~skonno/Net-UPnP-1.4.1/
Perl extension for UPnP
----
POE-Component-CPAN-SQLite-Info-0.08
http://search.cpan.org/~zoffix/POE-Component-CPAN-SQLite-Info-0.08/
non-blocking wrapper around CPAN::SQLite::Info with file fetching abilities.
----
POE-Component-Server-SimpleSMTP-1.22
http://search.cpan.org/~bingos/POE-Component-Server-SimpleSMTP-1.22/
A simple to use POE SMTP Server.
----
POE-Component-Server-SimpleSMTP-1.24
http://search.cpan.org/~bingos/POE-Component-Server-SimpleSMTP-1.24/
A simple to use POE SMTP Server.
----
POE-Component-SmokeBox-0.01_08
http://search.cpan.org/~bingos/POE-Component-SmokeBox-0.01_08/
POE enabled CPAN smoke testing with added value.
----
Perl-Dist-1.05_04
http://search.cpan.org/~adamk/Perl-Dist-1.05_04/
Perl Distribution Creation Toolkit
----
Pod-Weaver-1.002
http://search.cpan.org/~rjbs/Pod-Weaver-1.002/
do horrible things to POD, producing better docs
----
SVN-Dumpfile-0.13.103
http://search.cpan.org/~mscharrer/SVN-Dumpfile-0.13.103/
Perl extension to access and manipulate Subversion dumpfiles
----
Set-Object-1.26
http://search.cpan.org/~samv/Set-Object-1.26/
set of objects and strings
----
ShipIt-Step-CheckVersionsMatch-0.02
http://search.cpan.org/~drolsky/ShipIt-Step-CheckVersionsMatch-0.02/
Check that all modules with a $VERSION match
----
Sphinx-Control-0.03
http://search.cpan.org/~fayland/Sphinx-Control-0.03/
Simple class to manage a Sphinx searchd
----
String-Flogger-1.000
http://search.cpan.org/~rjbs/String-Flogger-1.000/
string munging for loggers
----
String-Flogger-1.001
http://search.cpan.org/~rjbs/String-Flogger-1.001/
string munging for loggers
----
Test-Aggregate-0.34_08
http://search.cpan.org/~ovid/Test-Aggregate-0.34_08/
Aggregate *.t tests to make them run faster.
----
WWW-FreeProxy-0.04
http://search.cpan.org/~swined/WWW-FreeProxy-0.04/
fetch proxies from free proxy lists
----
ensure-1.10
http://search.cpan.org/~gmch/ensure-1.10/
Perl extension to ensure that things, particularly subroutines, are defined before a program runs -- to avoid being bitten by Undefined subroutine &main::foo ... run-time errors.
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, 15 Oct 2008 02:05:11 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Odd behaviour with has key - wide character
Message-Id: <686dnSJeJdfZL2jVnZ2dnUVZ_tjinZ2d@comcast.com>
Tim Greer wrote:
> Jon Combe wrote:
>
>> Does the letter "v" have any significance when creating a hash key?
>> The following code snippet does not behave as I expect it to:-
>>
>> #!/usr/bin/perl -w
>>
>> %H = (v365, 3);
>> print keys %H;
>>
>> When run it outputs
>>
>> Wide character in print at wide.pl line 4.
>> Ã…Â
>>
>> When the key name is changed to "va365" it prints "va365" as I expect.
>> What is special about just v followed by numbers?
>>
>> Jon.
>
> Are you asking what the difference between v and "v" is?
No, he has run across the "Surprise and Confusion" of version strings.
perl -le 'print v65'
A
perl -le 'print chr 65'
A
perldoc perldata
Version Strings
Note: Version Strings (v-strings) have been deprecated.
They will not be available after Perl 5.8. The marginal
benefits of v-strings were greatly outweighed by the
potential for Surprise and Confusion.
A literal of the form "v1.20.300.4000" is parsed as a string
composed of characters with the specified ordinals. This
form, known as v-strings, provides an alternative, more
readable way to construct strings, rather than use the
somewhat less readable interpolation form
"\x{1}\x{14}\x{12c}\x{fa0}". This is useful for
representing Unicode strings, and for comparing version
"numbers" using the string comparison operators, "cmp",
"gt", "lt" etc. If there are two or more dots in the
literal, the leading "v" may be omitted.
print v9786; # prints UTF-8 encoded SMILEY, "\x{263a}"
print v102.111.111; # prints "foo"
print 102.111.111; # same
------------------------------
Date: Wed, 15 Oct 2008 05:43:59 -0700 (PDT)
From: khan <mushtaqk921@gmail.com>
Subject: Perl script: String comparison Ignoring spaces
Message-Id: <257d8c07-9ff8-4309-976c-e55b5bb33cce@c36g2000prc.googlegroups.com>
Hi,
Iam new to Perl Script, am writing a perl script to read a
configuration file and take some actions accordingly. I read each line
of file, split the line in to variables and compare against the
predefined tokens. Comparison fails if variable in file has some
spaces around it.
Eg: Line read from file
Jhon: jack:hill;
spilt(/:/);
if("jack" eq "$_[1])
#Above comparison fails as $_[1] value is " jack"
Please let me know a solution to compare string variables ignoring
spaces around the variables.
Thanks,
-Mushtaq Khan
------------------------------
Date: 15 Oct 2008 12:38:31 GMT
From: Natxo Asenjo <natxete@asenjo.nl.invalid>
Subject: Text::CSV problem
Message-Id: <48f5e447$0$183$e4fe514c@news.xs4all.nl>
hi,
I need to check the status of some schedule tasks in a windows server. At
my $JOB we use nagios, so I thouth, let's write a plugin (I could not
find anything at the nagiosexchange).
windows 2k3 has a command schtasks. I can dump the status of everything
like this:
schtasks /query /fo csv /v > file.csv
the /fo switch is for the format and /v switch makes it verbose. this is
the only way to know if the task has run or not.
The output file looks like this (output truncated):
(1st line)
"HostName","TaskName","Next Run Time","Status","Logon
Mode","Last Run Time","Last Result","Creator","Schedule","Task
To Run","Start In","Comment","Scheduled Task State","Scheduled
Type","Start Time","Start Date","End Date","Days","Months","Run
As User","Delete Task If Not Rescheduled","Stop Task
If Runs X Hours and X Mins","Repeat: Every","Repeat:
Until: Time","Repeat: Until: Duration","Repeat:
Stop If Still Running","Idle Time","Power Management"
(2nd line)
"server","jobname","09:00:00, 16-10-2008","","Interactive
only","09:00:00, 07-10-2008","0","user","At 09:00
every day, starting 18-01-2008","C:\Program Files\SQLyog
Enterprise\sja.exe "afdgroep_progbeh.xml" -l"C:\Documents and
Settings\user\Application Data\SQLyog\sja.log"
-s"C:\Documents and Settings\user\Application
Data\SQLyog\sjasession.xml"","N/A","N/A","Enabled","Daily
","09:00:00","18-01-2008","N/A","Everyday","N/A","domain\administrator","Disabled","Disabled","Disabled","Disabled","Disabled","Disabled","Disabled","Disabled
(no, I did not write this scheduled job)
using TEXT::CSV I can parse the first line, but it stops with the
second:
#!perl
use warnings;
use strict;
use Text::CSV;
my $csv_file = "c:/tmp/dump.csv";
open (CSV, "<", $csv_file) or die "$!\n" ;
my $csv_object = Text::CSV->new();
while (<CSV>) {
if ($csv_object->parse($_)) {
my @columns = $csv_object->fields();
print "@columns\n" ;
}
else {
my $error = $csv_object->error_diag();
print "oeps: $error\n";
}
}
again sorry, all truncated (very long lines)
C:\tmp>test.pl
HostName TaskName Next Run Time Status Logon Mode Last Run Time Last
Result Crea
tor Schedule Task To Run Start In Comment Scheduled Task State Scheduled
Type St
art Time Start Date End Date Days Months Run As User Delete Task If Not
Reschedu
led Stop Task If Runs X Hours and X Mins Repeat: Every Repeat: Until:
Time Repea
t: Until: Duration Repeat: Stop If Still Running Idle Time Power
Management
opes:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
oeps:
I think it has to do with the long paths in the task to run field,
because when I try the same code at another machine with a 'normal'
(shorter) path to run, I get the desired output.
TIA
--
Groeten,
J.I.Asenjo
------------------------------
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 1924
***************************************