App-Env

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    * bash exports shell functions via special environment variables
      with nominally illegal names. when dumping the environment for
      bash, appexec will translate those variables into function
      definitions instead of simply passing along the bogus variable
      names, which causes bash to barf.

0.29  2016-03-16T13:37:06-0400

  [BUG FIX]

    * exceptions caught by App::Env were stringified when rethrown,
      breaking calling code which might expect an exception object.

0.28  2015-05-21T10:55:07-0400

  [BUILD]

    * missing semicolon in Makefile.PL caused incomplete META.* files
      to be written.

0.27  2015-05-20T17:22:12-0400

Changes  view on Meta::CPAN

      previously it was optional, which led to its grabbing
      the environment name if --env wasn't used. bad form.

0.11  2008-06-16T12:27:20-0400

    * new setenv() method allows changing an environment.

0.10  2008-06-15T23:26:29-0400

    * new SysFatal option which will cause system/qexec/capture object
      methods to throw an exception on error.  Uses
      IPC::System::Simple in this case.

    * Default option values may now be changed.

 0.09  2008-03-22T22:44:32-0400

    * lowercase aliasing failed if Site was not set.

0.08  2008-03-22T22:03:47-0400

README.mkdn  view on Meta::CPAN


        A unique name for the environment. See ["Environment Caching"](#environment-caching) for more information.

        When used as a shared option for multiple applications, this will be
        used to identify the merged environment.  If set to the string
        `AppID`, the full module name will be used as the cache id (ignoring
        the contents of the **AppOpts** option hash).

    - SysFatal _boolean_

        If true, the **system**, **qexec**, and **capture** object methods will throw
        an exception if the passed command exits with a non-zero error.

    - Temp _boolean_

        If true, and the requested environment does not exist in the cache,
        create it but do not cache it (this overrides the **Cache** option).
        If the requested environment does exist in the cache, return an
        non-cached clone of it.  The following options are updated in
        the cloned environment:

README.mkdn  view on Meta::CPAN

- system

        $env->system( $command, @args );

    This runs the passed command in the environment defined by **$env**.
    It has the same argument and returned value convention as the core
    Perl **system** command.

    If the **SysFatal** flag is set for this environment,
    **IPC::System::Simple::system** is called, which will cause this method
    to throw an exception if the command returned a non-zero exit value.
    It also avoid invoking a shell to run the command if possible.

- exec

        $env->exec( $command, @args );

    This execs the passed command in the environment defined by **$env**.
    It has the same argument and returned value convention as the core
    Perl **exec** command.

README.mkdn  view on Meta::CPAN

        $output = $env->qexec( $command, @args );
        @lines = $env->qexec( $command, @args );

    This acts like the **qx{}** Perl operator.  It executes the passed
    command in the environment defined by **$env** and returns its
    (standard) output.  If called in a list context the output is
    split into lines.

    If the **SysFatal** flag is set for this environment,
    **IPC::System::Simple::capture** is called, which will cause this
    method to throw an exception if the command returned a non-zero exit
    value.  It also avoid invoking a shell to run the command if possible.

- capture

        $stdout = $env->capture( $command, @args );
        ($stdout, $stderr) = $env->capture( $command, @args );

    Execute the passed command in the environment defined by **$env** and
    returns content of its standard output and (optionally) standard error
    streams.

    If the **SysFatal** flag is set for this environment,
    **IPC::System::Simple::capture** is called, which will cause this
    method to throw an exception if the command returned a non-zero exit
    value.  It also avoid invoking a shell to run the command if possible.

- which

        $path = $env->which( $command );
        @paths = $env->which( $command );

    Return the path (or paths in list mode) of the passed command using
    [File::Which](https://metacpan.org/pod/File::Which).  It returns `undef` or an empty list if the command
    is not found.

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


A unique name for the environment. See L</Environment Caching> for more information.

When used as a shared option for multiple applications, this will be
used to identify the merged environment.  If set to the string
C<AppID>, the full module name will be used as the cache id (ignoring
the contents of the B<AppOpts> option hash).

=item SysFatal I<boolean>

If true, the B<system>, B<qexec>, and B<capture> object methods will throw
an exception if the passed command exits with a non-zero error.

=item Temp I<boolean>

If true, and the requested environment does not exist in the cache,
create it but do not cache it (this overrides the B<Cache> option).
If the requested environment does exist in the cache, return an
non-cached clone of it.  The following options are updated in
the cloned environment:

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

=item system

  $env->system( $command, @args );

This runs the passed command in the environment defined by B<$env>.
It has the same argument and returned value convention as the core
Perl B<system> command.

If the B<SysFatal> flag is set for this environment,
B<IPC::System::Simple::system> is called, which will cause this method
to throw an exception if the command returned a non-zero exit value.
It also avoid invoking a shell to run the command if possible.

=item exec

  $env->exec( $command, @args );

This execs the passed command in the environment defined by B<$env>.
It has the same argument and returned value convention as the core
Perl B<exec> command.

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

  $output = $env->qexec( $command, @args );
  @lines = $env->qexec( $command, @args );

This acts like the B<qx{}> Perl operator.  It executes the passed
command in the environment defined by B<$env> and returns its
(standard) output.  If called in a list context the output is
split into lines.

If the B<SysFatal> flag is set for this environment,
B<IPC::System::Simple::capture> is called, which will cause this
method to throw an exception if the command returned a non-zero exit
value.  It also avoid invoking a shell to run the command if possible.

=item capture

  $stdout = $env->capture( $command, @args );
  ($stdout, $stderr) = $env->capture( $command, @args );

Execute the passed command in the environment defined by B<$env> and
returns content of its standard output and (optionally) standard error
streams.

If the B<SysFatal> flag is set for this environment,
B<IPC::System::Simple::capture> is called, which will cause this
method to throw an exception if the command returned a non-zero exit
value.  It also avoid invoking a shell to run the command if possible.

=item which

  $path = $env->which( $command );
  @paths = $env->which( $command );

Return the path (or paths in list mode) of the passed command using
L<File::Which>.  It returns C<undef> or an empty list if the command
is not found.



( run in 0.339 second using v1.01-cache-2.11-cpan-496ff517765 )