Env-ShellWords

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


     # Tie Interface
     use Env::ShellWords;
     tie my @CFLAGS,  'Env::ShellWords', 'CFLAGS';
     tie my @LDFLAGS, 'Env::ShellWords', 'LDFLAGS';
    
     # same thing with import interface:
     use Env::ShellWords qw( @CFLAGS @LDFLAGS );
    
     # usage:
     $ENV{CFLAGS} = '-DBAR=1';
     unshift @CFLAGS, '-I/foo/include';
     push @CFLAGS, '-DFOO=Define With Spaces';
     
     # now:
     # $ENV{CFLAGS} = '-I/foo/include -DBAR=1 -DFOO=Define\\ With\\ Spaces';
     
     unshift @LDFLAGS, '-L/foo/lib';
     push @LDFLAGS, '-lfoo';

DESCRIPTION

    This module provides an array like interface to environment variables
    that contain flags. For example Autoconf can uses the environment
    variables like CFLAGS or LDFLAGS, and this allows you to manipulate
    those variables without doing space quoting and other messy mucky

lib/Env/ShellWords.pm  view on Meta::CPAN


 # Tie Interface
 use Env::ShellWords;
 tie my @CFLAGS,  'Env::ShellWords', 'CFLAGS';
 tie my @LDFLAGS, 'Env::ShellWords', 'LDFLAGS';

 # same thing with import interface:
 use Env::ShellWords qw( @CFLAGS @LDFLAGS );

 # usage:
 $ENV{CFLAGS} = '-DBAR=1';
 unshift @CFLAGS, '-I/foo/include';
 push @CFLAGS, '-DFOO=Define With Spaces';
 
 # now:
 # $ENV{CFLAGS} = '-I/foo/include -DBAR=1 -DFOO=Define\\ With\\ Spaces';
 
 unshift @LDFLAGS, '-L/foo/lib';
 push @LDFLAGS, '-lfoo';

=head1 DESCRIPTION

This module provides an array like interface to environment variables
that contain flags.  For example Autoconf can uses the environment
variables like C<CFLAGS> or C<LDFLAGS>, and this allows you to manipulate
those variables without doing space quoting and other messy mucky stuff.



( run in 0.268 second using v1.01-cache-2.11-cpan-8d75d55dd25 )