vishi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm using the Text::ANSITable module to create a table and populate it with some values. I'm using the Page here

http://search.cpan.org/~perlancar/Text-ANSITable-0.39/lib/Text/ANSITable.pm

to understand how the module works. However, I'm having a tough time understanding the section "Environment". Where and how I use this to set my options is quite confusing to me. I'm not very familiar with this setting. Can anyone help me understand how I should use this and the options in the Environment section in my code?

Replies are listed 'Best First'.
Re: Text::ANSITable Question
by Discipulus (Canon) on Feb 26, 2015 at 11:47 UTC
    the docs refer to Environment variable.

    Such variables are an OS thing. Perl lets you to access and modify them via the special variable %ENV as explained in perlvar.

    The module has many defaults that can be set via environment variables or directly.

    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Text::ANSITable Question
by Anonymous Monk on Feb 26, 2015 at 11:41 UTC

    Environment variables can be set in a number of ways*. However, a quick skim seems to show that in Text::ANSITable, the environment variables are simply default values for the attributes that you'd normally set via the constructor. Do you really need to do that?

    * e.g. in Perl, $ENV{ENVIRONMENT_VARIABLE_NAME} = "value";, in a *NIX shell usually (depending on the shell) something like export ENVIRONMENT_VARIABLE_NAME=value or on a per command basis like ENVIRONMENT_VARIABLE_NAME=value perl script.pl

Re: Text::ANSITable Question
by Anonymous Monk on Feb 26, 2015 at 11:39 UTC
    You export these variables in the shell before starting perl, like so:
    $ export ANSITABLE_STYLE_SETS='[["AltRow",{"odd_bgcolor":"003300"}]]' $ perl my_ansitable_script.pl