[28428] in Perl-Users-Digest
Perl-Users Digest, Issue: 9792 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 21:05:48 2006
Date: Mon, 2 Oct 2006 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 2 Oct 2006 Volume: 10 Number: 9792
Today's topics:
Re: get rid of ^M <benmorrow@tiscali.co.uk>
Re: get rid of ^M <m@remove.this.part.rtij.nl>
Re: get rid of ^M <tadmc@augustmail.com>
Re: get rid of ^M <>
Re: How to make 2 dimensinal aray in Perl $mat(x,y)? anno4000@radom.zrz.tu-berlin.de
Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <noreply@invalid.net>
Re: Inline C and different platforms <benmorrow@tiscali.co.uk>
Re: Inline C and different platforms <sisyphus1@nomail.afraid.org>
Re: inserting lines <daoswald@adelphia.net>
Re: LWP and Unicode <benmorrow@tiscali.co.uk>
Re: Modifying a one-liner <tzz@lifelogs.com>
Re: newbie syntax question -> and => <tadmc@augustmail.com>
Re: newbie syntax question -> and => <kkeller-usenet@wombat.san-francisco.ca.us>
OS X and perldoc <justin.0610@purestblue.com>
Re: OS X and perldoc <David.Squire@no.spam.from.here.au>
Re: OS X and perldoc <jgibson@mail.arc.nasa.gov>
Re: Perl Async .10 <tadmc@augustmail.com>
Re: Perl Async .10 <toddenglish@gmail.com>
Re: Perl Async .10 <tadmc@augustmail.com>
Text::CSV_XS Trying to find empty field <pamelapdh@aol.com>
Re: Text::CSV_XS Trying to find empty field <glex_no-spam@qwest-spam-no.invalid>
Re: XML::Parser Installation error: XML-Parser-2.34 <benmorrow@tiscali.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 2 Oct 2006 23:03:14 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: get rid of ^M
Message-Id: <2ue8v3-plg.ln1@osiris.mauzo.dyndns.org>
Quoth hmchkus <>:
>
> Perl script running on windows, print statement generates text file
>
> File copied to Sun Solaris box and vi sees "^M".
>
> How to get rid of the "^M" in my perl script?
>
> I know I can run "dos2unix" command in Solaris, but can I settle this
> in windows before I copy over the file? No need to open the file in
> windows.
perldoc -f binmode
Ben
--
The cosmos, at best, is like a rubbish heap scattered at random.
Heraclitus
benmorrow@tiscali.co.uk
------------------------------
Date: Tue, 03 Oct 2006 00:23:56 +0200
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: get rid of ^M
Message-Id: <pan.2006.10.02.22.23.56.44208@remove.this.part.rtij.nl>
On Mon, 02 Oct 2006 14:35:49 -0700, beartiger wrote:
> hmchkus wrote:
>> Hi,
>>
>> Perl script running on windows, print statement generates text file
>>
>> File copied to Sun Solaris box and vi sees "^M".
>>
>> How to get rid of the "^M" in my perl script?
>>
>> I know I can run "dos2unix" command in Solaris, but can I settle this in
>> windows before I copy over the file? No need to open the file in
>> windows. Thanks!
>
> You can do a substitution like:
>
> s/\r\n/\n/;
>
> over all lines.
Won't work. The string in Perl has a '\n' only. On writing it out that
gets translated to '\r\n'. I think the suggestion about binmode is the
correct one.
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: Mon, 2 Oct 2006 17:13:43 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: get rid of ^M
Message-Id: <slrnei33on.pqs.tadmc@magna.augustmail.com>
hmchkus <> wrote:
> Perl script running on windows, print statement generates text file
>
> File copied to Sun Solaris box and vi sees "^M".
^^^^^^^^^^^
Copied how?
Via FTP?
If you transfer the file in "ASCII" (or "text") mode rather
than in "binary" mode, then the FTP program will fix the
line-ending sequences for you as part of the file transfer.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 02 Oct 2006 17:15:28 -0700
From: hmchkus <>
Subject: Re: get rid of ^M
Message-Id: <vpa3i21rjtvql5hc635r8ilt6nfeqt9gl5@4ax.com>
On Mon, 2 Oct 2006 17:13:43 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:
>hmchkus <> wrote:
>
>> Perl script running on windows, print statement generates text file
>>
>> File copied to Sun Solaris box and vi sees "^M".
> ^^^^^^^^^^^
>
>
>Copied how?
>
>Via FTP?
>
>If you transfer the file in "ASCII" (or "text") mode rather
>than in "binary" mode, then the FTP program will fix the
>line-ending sequences for you as part of the file transfer.
use Net::SFTP . but I can't find ASCII mode option....
I guess it's all binary with this module ?
------------------------------
Date: 2 Oct 2006 22:40:09 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <4odiq9Fe70g7U1@news.dfncis.de>
Ala Qumsieh <noreply@invalid.net> wrote in comp.lang.perl.misc:
> anno4000@radom.zrz.tu-berlin.de wrote:
>
> > tim <traggatt@gmail.com> wrote in comp.lang.perl.misc:
> >> Joza wrote:
> >
> > [top posting corrected, please don't do that]
> >
> >> > How to make 2 dimensinal aray in Perl $mat(x,y)?
> >> >
> >> > Thanks
> >
> >> Hello
> >>
> >> The syntax is like so:
> >>
> >> $mat[x][y]
> >
> > That's not Perl, unless x and y are predefined functions, constants
> > for example. Also, your syntax is already a simplification.
>
> Yes, but besides the fact that x and y should have been $x and $y, his
> syntax was correct.
>
> > The correct syntax is
> >
> > $mat[ $x]->[ $y]
>
> Perl allows you to drop the arrow between indices, so this is not any more
> correct than the $mat[$x][$y] syntax.
>
> > Strictly speaking, even that is a simplification. The basic syntax is
> >
> > ${ $mat[ $x] }[ $y]
>
> Now, you are just showing off. I don't see what advantage pointing this out
> has, except intimidating the OP and confusing him/her even more with
> unnecessary information.
Knowing how the arrow notation relates to the general de-referencing
syntax isn't entirely useless.
The answer I was replying to was way too pat. I gave an extra complete
one in contrast. Neither did I intend to confuse anyone, nor to show off
(what, really?).
Anno
------------------------------
Date: Mon, 02 Oct 2006 23:55:55 GMT
From: Ala Qumsieh <noreply@invalid.net>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <fGhUg.7824$GR.2961@newssvr29.news.prodigy.net>
anno4000@radom.zrz.tu-berlin.de wrote:
> Knowing how the arrow notation relates to the general de-referencing
> syntax isn't entirely useless.
I never said it was useless. But you made it sound like it's more correct
than dropping the arrow, which I disagree with. TMTOWTDI, and all of the
ways are equally correct.
People don't need to know the internals of Perl to use it, just like people
don't need to know the internals of combustion engines to drive cars.
> The answer I was replying to was way too pat. I gave an extra complete
> one in contrast. Neither did I intend to confuse anyone, nor to show off
> (what, really?).
and I didn't intend to offend. But imagine what the OP, who's obviously a
Perl newbie, would think after reading that $mat[$x][$y] is better written
as $mat[$x]->[$y], which is better written as ${ $mat[ $x] }[ $y].
My point is that an answer should be on the same level as the question
itself. If you want to give more information, then you should at least
point to docs that go into more depth about the subject.
--Ala
------------------------------
Date: Mon, 2 Oct 2006 23:02:31 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Inline C and different platforms
Message-Id: <nse8v3-plg.ln1@osiris.mauzo.dyndns.org>
Quoth vladimir.giron@gmail.com:
> Hi
>
>
> I'm working with Perl and I use the Compress Zlib library in the code..
> the compress zlib module doesn't come with all of perl releases, you
> have to download it.. when finished I want to put my program online so
> anybody can download it and use it no matter what release of perl
> they're using without downloading extra modules and because of this I
> considered Inline C but searching more about this on the Internet I
> found this:
>
> "Inline C works on all of the Perl platforms that I have tested it with
> so far. This includes all common Unixes and recent versions of
> Microsoft Windows. The only catch is that you must have the same
> compiler and make utility that was used to build your perl binary."
>
> This means that if I make this program with inline C the enduser must
> have the same compiler and make utility I used to be able to run it,
> right?
No, they must have the appropriate compiler and make utility for *their*
version of perl.
> Is there any other way I can make one single file?
See PAR.pm from CPAN.
> The problem is that
> the Zlib uses and XS file (C code) and I would have to translate to
> Perl things like
>
> gzopen_(path, mode)
<snip XS>
Err, no, you'd have to do more than that. You'd have to re-implement the
whole of zlib in Perl... not a good idea.
A convenient way to distribute Perl programs is to put the body of the
program in a module or modules, and include a small script with the
module that invokes it all. Then you can upload the module to CPAN, with
the appropriate dependencies, and installation should be a simple matter
of
cpan -i My::App
for anyone with a complete Perl installation. Win32's a little more
tricky, of course, because most Win32 Perl users don't have a compiler;
you would probably have to make a ppm for that.
Ben
--
#!/bin/sh
quine="echo 'eval \$quine' >> \$0; echo quined"
eval $quine
# [benmorrow@tiscali.co.uk]
------------------------------
Date: Tue, 3 Oct 2006 10:10:13 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Inline C and different platforms
Message-Id: <4521ab77$0$5110$afc38c87@news.optusnet.com.au>
"Ben Morrow" <benmorrow@tiscali.co.uk> wrote in message
.
.
> Win32's a little more
> tricky, of course, because most Win32 Perl users don't have a compiler;
> you would probably have to make a ppm for that.
>
Assuming the module builds on Win32 with the MSVC++6.0 compiler, then
ActiveState will automatically build that ppm (usually within a week) and
place it in their ppm repository (which is the place that Win32 perl users
who don't have a compiler would expect to find it).
Other than that minor quibble, I agree - the op just needs to make the
module source available (by placing on CPAN). Whether or not Inline::C is
involved should not make any difference. (There are already some modules on
CPAN that use inline::C, such as Math::Geometry::Planar::GPC::Polygon-0.05.)
Cheers,
Rob
------------------------------
Date: Mon, 02 Oct 2006 17:20:53 -0700
From: David Oswald <daoswald@adelphia.net>
Subject: Re: inserting lines
Message-Id: <c_2dnTalW-J7MbzYnZ2dnUVZ_tednZ2d@adelphia.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Jim Gibson <jgibson@mail.arc.nasa.gov> wrote in comp.lang.perl.misc:
>
> I too find it unfortunate that the FAQ doesn't explain the process
> in more detail.
As they say, "patches are welcome."
------------------------------
Date: Mon, 2 Oct 2006 22:40:23 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: LWP and Unicode
Message-Id: <7jd8v3-plg.ln1@osiris.mauzo.dyndns.org>
Quoth "Dale" <dale.gerdemann@googlemail.com>:
> I have a couple of questions/problems concerning LWP and
> Unicode. Here's an ultra-simple program that goes to a web page,
> downloads it's contents and prints them out in a semi-readable form:
>
> ----------------------------------
>
> #!/.../perl-5.8.8/bin/perl -CSDA
I presume this isn't your real #! line...
Do you know what -CSDA does? In this case it is useless, unless it
interferes with LWP's filehandle encodings. It is probably best avoided
until you understand Perl's (slightly odd) Unicode handling better.
> use utf8;
> use LWP;
> use Encode;
> use URI::Escape;
>
> my $browser = LWP::UserAgent->new;
> $browser->parse_head(0);
>
> my $url = 'http://bg.wiktionary.org/wiki/LotsaCyrillic';
Please don't post 8-bit data (including UTF8) to Usenet unless the
group's charter explicitly permits it.
> my $response = $browser->get(encode("utf8", $url));
>
> my $content = decode("utf8", uri_unescape($response->content));
>
> print "$content\n";
>
> ----------------------------------
>
> Question 1: Why do I need the line that says
>
> $browser->parse_head(0);
You don't. The docs for this are (surprisingly) in perldoc
LWP::UserAgent.
> Question 2: Why do I need to explicitly say:
>
> decode("utf8", ...)
>
> Isn't there a way to tell LWP that the content is utf8? Or more
> precisely, that it is utf8 with some URI percent escapes.
Not AFAIK. You probably ought to decode the data before you uri_unescape
it; one of the virtues of UTF-8 is that this doesn't matter, but it
would for other encodings.
> Question 3: If you change the pragma "use utf8" to "use encoding
> 'utf8'" then you don't need the call to "decode("utf8", ...)". Why
> should this be? What's the difference between "use utf8" and "use
> encoding 'utf8'"? The perldoc:perlunicode is no help here.
The differences are
1. encoding supports many encodings.
2. encoding is probably negligbly slower.
3. encoding gives decent error recovery (as opposed to crashing
perl).
4. encoding sets a default PerlIO layer on STDIN and STDOUT, unless
you've already done so with the -C switch.
I can see no reason why the two should give different results in this
case; but perhaps your -CSDA is interfering.
> Question 4: In the original program, replace the line
>
> my $content = decode("utf8", uri_unescape($response->content));
>
> with
>
> my $content = $response->content;
> utf8::upgrade($content);
>
> The perldoc:perlunicode page says you should do this when, for some
> reason, Unicode does not happen. But this does nothing for me. I still
> end up with bytes.
IMHO perlunicode is wrong in this regard :). The utf8::* functions are
part of the internal implementation of utf8-handling; users should never
have cause to use them.
As of 5.8, Perl strings have an internal flag that marks them as being
stored in utf8. What utf8::upgrade does is
1. If the string already has the UTF8 flag on, quit.
2. For every top-bit-set byte in the string:
3. Look up the appropriate character in ISO8859-1, and
4. Replace the byte with that character's 2-byte encoding in
utf8.
5. Set the UTF8 flag on the string, so that Perl now sees those
2-byte sequences as one character each.
The net result, from the Perl level, is that *absolutely nothing has
changed*. The *only* Perl-visible change is that utf8::is_utf8 now
returns true, even if it returned false before; but you *shouldn't be
concerned with that*.
The correct function for 'this bunch of bytes happens to be a piece of
UTF8-encoded text; decode it and give me a string containing those
characters' is Encode::decode, as you have established.
Ben
--
For far more marvellous is the truth than any artists of the past imagined!
Why do the poets of the present not speak of it? What men are poets who can
speak of Jupiter if he were like a man, but if he is an immense spinning
sphere of methane and ammonia must be silent?~Feynmann~benmorrow@tiscali.co.uk
------------------------------
Date: Mon, 02 Oct 2006 20:37:21 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Modifying a one-liner
Message-Id: <g697iziqloe.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 2 Oct 2006, beartiger@gmail.com wrote:
> Who's posting anonymously? I sign every post with "John", and a simple
> Google Groups search would reveal that I've made no secret that my last
> name is "Harrington".
OK. I have not kept up with your posting history, sorry.
> So: at the very least, I'm anonymous no more. For more than a
> decade, I've also, as a professional science writer with degrees in
> biochemistry and English literature, written literally dozens of
> manuals for a biotech company. And, to thwart your simple-minded
> arguments doesn't necessarily take brilliance, but I can see why it
> would seem that way to someone like you.
I'm not arguing, John. I tried to help you understand why,
stylistically, it's acceptable to capitalize a title, heading, or a
logo (I hope you understand that the logo capitalization rules are, if
anything, *more* liberal than the rules for titles and headings). It
doesn't really matter to me whether you agree with me. I'm sure your
goal was not to have intelligent discourse in any case.
Your claimed achievements should also have prepared you for social
interactions without profanity and personal attacks. They apparently
haven't. The way you have spoken so far is simply embarassing for
someone of your supposed experience and intelligence. But it's
entertaining, I assure you. Bye.
Ted
------------------------------
Date: Mon, 2 Oct 2006 17:31:04 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie syntax question -> and =>
Message-Id: <slrnei34p8.pqs.tadmc@magna.augustmail.com>
Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
> On 2006-10-02, usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
>>
>> In the example you gave, "=>" is really like a comma in an array
>> definition (it's called a 'fat comma').
>
> I've never heard that term, 'fat comma'. Does anybody know its origin?
No, I don't know where it originated.
> A quick google search didn't turn up much, nor did perldoc perlop.
It is documented in the "List value constructors" section of perldata,
but it is not named there...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 2 Oct 2006 16:07:04 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: newbie syntax question -> and =>
Message-Id: <pli8v3xhs.ln2@goaway.wombat.san-francisco.ca.us>
On 2006-10-02, Tad McClellan <tadmc@augustmail.com> wrote:
> Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>> On 2006-10-02, usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
>>>
>>> In the example you gave, "=>" is really like a comma in an array
>>> definition (it's called a 'fat comma').
>>
>> I've never heard that term, 'fat comma'. Does anybody know its origin?
>> A quick google search didn't turn up much, nor did perldoc perlop.
>
> It is documented in the "List value constructors" section of perldata,
> but it is not named there...
Well, => is documented in perlop, as well, just not the fat comma term,
which is all I was really interested in, since I already know all about =>.
The docs in perlop seem a little clearer in perlop than in perldata.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Mon, 02 Oct 2006 23:54:14 +0100
From: Justin C <justin.0610@purestblue.com>
Subject: OS X and perldoc
Message-Id: <justin.0610-1DCDA6.23541302102006@stigmata>
I've recently bought a Mac, my first, and I'm still finding my way
around it. I'm also still finding my way around Perl; while I don't have
a lot of chance to use it I read a lot here and hope to pick things up.
Quite often questions are posted and the OP is directed to perldoc and
out of interest I follow. That was all well and good on my Linux box;
it's not so good here. There was a recent reference to perldoc perlop,
I've not read it all and I was interested in the answer to the OP's
question. It seems that there is only a partial perldoc install on this
machine, "perldoc -f" works, perldoc -m works, perldoc perldoc and
perldoc perlop don't (I can't think of others to try ... not without
perldoc perldoc anyway!).
Where can I go for information on how to fix this install?
Thank you for any help you can give.
------------------------------
Date: Tue, 03 Oct 2006 00:30:57 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: OS X and perldoc
Message-Id: <efs7fi$jsr$1@gemini.csx.cam.ac.uk>
Justin C wrote:
> I've recently bought a Mac, my first, and I'm still finding my way
> around it. I'm also still finding my way around Perl; while I don't have
> a lot of chance to use it I read a lot here and hope to pick things up.
> Quite often questions are posted and the OP is directed to perldoc and
> out of interest I follow. That was all well and good on my Linux box;
> it's not so good here. There was a recent reference to perldoc perlop,
> I've not read it all and I was interested in the answer to the OP's
> question. It seems that there is only a partial perldoc install on this
> machine, "perldoc -f" works, perldoc -m works, perldoc perldoc and
> perldoc perlop don't (I can't think of others to try ... not without
> perldoc perldoc anyway!).
>
> Where can I go for information on how to fix this install?
>
> Thank you for any help you can give.
These two work just fine on my Mac (latest OS X). I didn't do anything
special to make that happen.
I have installed all the optional developer stuff (on my 1st
installation DVD), but I don't recall any Perl-specific stuff being
mentioned there.
DS
------------------------------
Date: Mon, 02 Oct 2006 16:51:05 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: OS X and perldoc
Message-Id: <021020061651059966%jgibson@mail.arc.nasa.gov>
In article <efs7fi$jsr$1@gemini.csx.cam.ac.uk>, David Squire
<David.Squire@no.spam.from.here.au> wrote:
> Justin C wrote:
> > I've recently bought a Mac, my first, and I'm still finding my way
> > around it. I'm also still finding my way around Perl; while I don't have
> > a lot of chance to use it I read a lot here and hope to pick things up.
> > Quite often questions are posted and the OP is directed to perldoc and
> > out of interest I follow. That was all well and good on my Linux box;
> > it's not so good here. There was a recent reference to perldoc perlop,
> > I've not read it all and I was interested in the answer to the OP's
> > question. It seems that there is only a partial perldoc install on this
> > machine, "perldoc -f" works, perldoc -m works, perldoc perldoc and
> > perldoc perlop don't (I can't think of others to try ... not without
> > perldoc perldoc anyway!).
> >
> > Where can I go for information on how to fix this install?
> >
> > Thank you for any help you can give.
>
> These two work just fine on my Mac (latest OS X). I didn't do anything
> special to make that happen.
>
> I have installed all the optional developer stuff (on my 1st
> installation DVD), but I don't recall any Perl-specific stuff being
> mentioned there.
They work fine on my Mac as well. If for some reason your Perl
distribution is incomplete or you want to have the absolute latest (Mac
OS X currently comes with 5.8.6, whereas 5.8.8 and 5.9.4 are out), go
to <http::www.cpan.org> and download the latest source distribution. If
you have installed the Mac OS X optional developer tools (XCode) that
came with your OS distribution (or downloaded the latest from
<http://www.apple.com/developer>), then you should be able to build and
install a complete Perl distribution. The developer tools include a
version of gcc for the Mac. There is a README.macosx file in the Perl
distribution with some information about Mac-flavored Perl.
------------------------------
Date: Mon, 2 Oct 2006 17:23:49 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl Async .10
Message-Id: <slrnei34bl.pqs.tadmc@magna.augustmail.com>
[ removed non-existent perl.beginners newsgroup.
Followups set.
]
Todd English <toddenglish@gmail.com> wrote:
> for (my $counter=0; $counter < 20; $counter++)
foreach my $counter ( 0 .. 19 )
[ snip TOFU. Please do not quote an entire post. ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 2 Oct 2006 16:48:57 -0700
From: "Todd English" <toddenglish@gmail.com>
Subject: Re: Perl Async .10
Message-Id: <1159832937.113286.45760@e3g2000cwe.googlegroups.com>
Tad,
Thank you for that constructive remark. I will not quote an entire post
in the future. I am not a Usenet wizard, but according to Google
perl.beginners is a highly active Usenet group
(http://groups.google.com/group/perl.beginners/about) so I am adding
them back into the thread.
Did you happen to have any insight into the Async issue?
-T
Tad McClellan wrote:
> [ removed non-existent perl.beginners newsgroup.
> Followups set.
> ]
>
>
> Todd English <toddenglish@gmail.com> wrote:
>
> > for (my $counter=0; $counter < 20; $counter++)
>
>
> foreach my $counter ( 0 .. 19 )
>
>
>
>
> [ snip TOFU. Please do not quote an entire post. ]
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Mon, 2 Oct 2006 19:45:00 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl Async .10
Message-Id: <slrnei3ckc.r1q.tadmc@magna.augustmail.com>
Todd English <toddenglish@gmail.com> wrote:
> Tad,
>
> Thank you for that constructive remark. I will not quote an entire post
> in the future.
But you will in the present?
> I am not a Usenet wizard, but according to Google
Google is not Usenet.
> perl.beginners is a highly active Usenet group
perl.beginners is not a Usenet newsgroup.
It is a mailing list (with a gateway to news that Google Groups
treats as if it was an actual newsgroup).
My news server will not accept posts to newsgroups that do not exist...
> (http://groups.google.com/group/perl.beginners/about) so I am adding
> them back into the thread.
... so I took it back out (of this post).
(That has no effect on the rest of the thread.)
> Did you happen to have any insight into the Async issue?
No, else I would have given one.
I don't have that module installed, and don't have the time to try it.
>> [ snip TOFU. Please do not quote an entire post. ]
[ snip TOFU again! Please do not quote an entire post. ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 2 Oct 2006 15:16:46 -0700
From: "Pam" <pamelapdh@aol.com>
Subject: Text::CSV_XS Trying to find empty field
Message-Id: <1159827406.057450.280020@m7g2000cwm.googlegroups.com>
Hello:
I was wondering if anyone could answer this question for me. I am
currently trying to pasre a comma sepearted file to search for empty
fields in a particluar column. I decided to parse using the
Text::CSV:XS
to check for this information since I am already parsing the text file.
The
text file loks like the one below.
"LIBkk03527","","FMOM198:JAVA MIDP
2.0_Quality_OPERATOR_5","N","2","1","", and etc.
I want to check for a ("",) in a particular column and then write
certain data to that column,
lets say column 11. The "", tell me that that field is empty, I am
already parsing the file but just to write and format it in an xls
format.
I have tried to check for empty cell such as with undef with the
paser module
I was able to find undef data but not able to do the manipulation I
needed to do, so I thought
parsing it this way would be my last hope. Can anyone help me!
This is what I am currently doing:
my $filename ='CCB.txt';
open(FILE,">$filename") || die("Cannot Open File $filename : $!" );
print FILE $query_result->content;
print "File open ";
close (FILE);
# Open the Comma Separated Variable file
open (CSVFILE, $filename) or die "$filename: $!";
# Create a new Excel workbook
my $workbook =
Spreadsheet::WriteExcel->new('3GSoftwareCCB_MeetingAgenda.xls');
my $worksheet = $workbook->add_worksheet();
my $format3 = $workbook->add_format();
$format3->set_text_wrap();
$format3->set_border();
$format3->set_bottom();
$format3->set_top();
$format3->set_left();
$format3->set_right();
# Create a new CSV parsing object
my $csv = Text::CSV_XS->new;
# Row and column are zero indexed
my $row = 0;
my $total;
my $count;
while (<CSVFILE>) {
if ($csv->parse($_)) {
my @Fld = $csv->fields;
my $col = 0;
foreach my $token (@Fld) {
$worksheet->write($row, $col, $token, $format3);
$col++;
}
$row++;
if ($row > 1){
$count = $count + 1;
$total = $count;
}
}
else {
my $err = $csv->error_input;
print "Text::CSV_XS parse() failed on argument: ", $err, "\n";
}
}
print "Adding sheet1\n";
Thanks,
Pam
------------------------------
Date: Mon, 02 Oct 2006 17:55:43 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Text::CSV_XS Trying to find empty field
Message-Id: <45219860$0$25775$815e3792@news.qwest.net>
Pam wrote:
> Hello:
>
> I was wondering if anyone could answer this question for me. I am
> currently trying to pasre a comma sepearted file to search for empty
> fields in a particluar column. I decided to parse using the
> Text::CSV:XS
Text::CSV_XS
> to check for this information since I am already parsing the text file.
> The text file loks like the one below.
>
> "LIBkk03527","","FMOM198:JAVA MIDP
> 2.0_Quality_OPERATOR_5","N","2","1","", and etc.
>
> I want to check for a ("",) in a particular column and then write
> certain data to that column,
> lets say column 11. The "", tell me that that field is empty, I am
> already parsing the file but just to write and format it in an xls
> format.
>
> I have tried to check for empty cell such as with undef with the
> paser module
It's not undefined, it's an empty string.
perldoc -f defined
> I was able to find undef data but not able to do the manipulation I
> needed to do, so I thought
> parsing it this way would be my last hope. Can anyone help me!
Please, simply post a short script that everyone can run.
The problem/question you have is with Text::CSV_XS, it doesn't seem to
be with Spreadsheet::WriteExcel, so we don't need/want to see anything
that uses it.
Based on your subject, it seems to be about trying to test for that
empty column/token. Providing an example would be quite short. e.g.:
use Text::CSV_XS;
my $data = '"LIBkk03527","","FMOM198:JAVA
MIDP2.0_Quality_OPERATOR_5","N","2","1",""';
my $csv = Text::CSV_XS->new();
if ($csv->parse($data)) {
my @Fld = $csv->fields;
foreach my $token (@Fld) {
if( $token eq '' ) { print "no value for token\n"; }
else { print "token = $token\n"; }
}
}
> perl ./tsttok.pl
token = LIBkk03527
no value for token
token = FMOM198:JAVA MIDP2.0_Quality_OPERATOR_5
token = N
token = 2
token = 1
no value for token
------------------------------
Date: Mon, 2 Oct 2006 22:56:50 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: XML::Parser Installation error: XML-Parser-2.34
Message-Id: <2ie8v3-plg.ln1@osiris.mauzo.dyndns.org>
[please don't top-post]
Quoth "Sean" <seanatpurdue@hotmail.com>:
> Jim Gibson wrote:
> > In article <1159813056.433524.132420@c28g2000cwb.googlegroups.com>,
> > Sean <seanatpurdue@hotmail.com> wrote:
> >
> > > Here is what I did and what errors I got:
> > >
> > > 4) XML-Parser-2.34$ make
> > > make[1]: Entering directory `/home/seany/local/XML-Parser-2.34/Expat'
> > > cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
> > > -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
> > > -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.34\" -DXS_VERSION=\"2.34\"
> > > -fPIC "-I/usr/lib/perl/5.8/CORE" Expat.c
> > > Expat.xs:12:19: error: expat.h: No such file or directory
> > > Expat.xs:60: error: syntax error before 'XML_Parser'
> >
> > Do you have the expat library installed? XML::Parser is a Perl wrapper
> > for using the expat C library. Try here: http://expat.sourceforge.net/
> >
> > In the meantime, you can try XML::SAX::PurePerl, but it will be much
> > slower than XML::Parser and expat.
>
> well, I think the C Expat library should be
ITYM 'I think it is' rather than 'I think it should be'? In any case, it
isn't. Did you read the README?
> self-contained in this perl
> XML-Parser module. Here is a 'try-to-prove'. I see a Expat.c there.
>
> XML-Parser-2.34$ cd Expat/
> Expat$ ls
> Expat.c Expat.pm Expat.xs Makefile Makefile.PL encoding.h
> pm_to_blib typemap
>
> So, the previous question was about why Expat.h was missing.
Expat.h ne expat.h. Filenames are case-sensitive under Unix.
expat is a lot more than one C file. That Expat.c is produced from
Expat.xs, and is part of the glue between Perl and expat.
Now, do you have expat installed somewhere weird so MakeMaker can't find
it, or do you not have it installed at all?
Ben
--
Raise your hand if you're invulnerable.
[benmorrow@tiscali.co.uk]
------------------------------
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 9792
***************************************