in reply to Re^3: Creating Reports
in thread Creating Reports

Are you saying that Text::ParseWords can handle every case that Text::xSV can? Why hasn't anyone ever mentioned this module? As in I've read nearly every node to do with parsing on this site for the past 3 years and I've never heard of it.

Would I be correct in thinking that the following are equivalent?

use Text::ParseWords; my @lines = do { open FH, $filename; <FH> }; foreach my $line (@lines) { my @parsed_out = quotewords(',', undef, $line); # Do stuff here } --------------- use Text::CSV; my $parser = Text::CSV->new; my @lines = do { open FH, $filename; <FH> }; foreach my $line (@lines) { $parser->parse( $line ); my @parsed_out = $parser->fields; # Do stuff here } --------------- use Text::xSV; my $parser = Text::xSV->new; $parser->open_file( $filename ); while (my $parsed_out = $parser->get_row) { # Do stuff here }

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re^5: Creating Reports
by davorg (Chancellor) on Jul 27, 2004 at 12:53 UTC
    Why hasn't anyone ever mentioned this module? As in I've read nearly every node to do with parsing on this site for the past 3 years and I've never heard of it.

    A quick check with Super Search shows that it has been mentioned here before.

    Would I be correct in thinking that the following are equivalent?

    To be honest I'm not 100% sure. I expect that there are corner cases where Text::ParseWords doesn't do the right thing and one of the other modules does. But I've never come across one of these cases.

    I should point out that in DMP I discussed Text::CSV and not Text::ParseWords because, like you, I hadn't seen Text::ParseWords at that time. It seems to be a very underused module.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg