Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Looking for a pure Perl CSV module

by Tux (Canon)
on Feb 02, 2022 at 09:01 UTC ( [id://11141053]=note: print w/replies, xml ) Need Help??


in reply to Looking for a pure Perl CSV module

What Fletch said also noted in the docs for Text::CSV:

CHOOSING BACKEND

This module respects an environmental variable called PERL_TEXT_CSV when it decides a backend module to use. If this environmental variable is not set, it tries to load Text::CSV_XS, and if Text::CSV_XS is not available, falls back on Text::CSV_PP;

If you always don't want it to fall back on Text::CSV_PP, set the variable like this (export may be setenv, set and the likes, depending on your environment):

$ export PERL_TEXT_CSV=Text::CSV_XS % setenv PERL_TEXT_CSV Text::CSV_XS

If you prefer Text::CSV_XS to Text::CSV_PP (default), then:

 $ export PERL_TEXT_CSV=Text::CSV_XS,Text::CSV_PP

You may also want to set this variable at the top of your test files, in order not to be bothered with incompatibilities between backends (you need to wrap this in BEGIN, and set before actually use-ing Text::CSV module, as it decides its backend as soon as it's loaded):

BEGIN { $ENV{PERL_TEXT_CSV} = "Text::CSV_PP"; } use Text::CSV;

Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141053]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found