AFS-Command
view release on metacpan or search on metacpan
lib/AFS/Command/Base.pod view on Meta::CPAN
This document covers general programming with the API, and the details
of the specific wrapper classes are documented separately
(eg. AFS::Command::VOS).
=head1 CLASS METHODS
=head2 new
All of the AFS::Command subclasses use this inherited method as an
object constructor. In its simplest usage, it can be called with no
arguments, but there are several which control global behavior of the
commands, simplifying subsequent coding a bit.
=over
=item command
This key has the pathname to the command to be used for execution. By
default, this is the simple command name "vos", "bos", etc, and the
command will simply be found in your $PATH by exec().
lib/AFS/Command/Base.pod view on Meta::CPAN
);
If the path given is invalid, then expect the API to implode on itself
when it can't be found, or it isn't an AFS vos command.
=item localauth, noauth, encrypt
All of these arguments correspond to command line arguments common
across the entire command line suite. Typically, if an application
uses this flag once, it will be using it for B<all> subsequent calls as
well. Therefore, the state of these flags can be set globally by
setting them when creating the command object.
my $vos = AFS::Command::VOS->new
(
localauth => 1,
encrypt => 1,
);
NOTE: The encrypt option is only available in more recent versions of
AFS, and may be unsupported by the underlying commands.
lib/AFS/Command/Base.pod view on Meta::CPAN
=head2 setCarp
This class method configures the carp and/or croak subroutines used
throughout the API. By default, the obviously sensible thing is done:
the carp an croak subroutines exported by the Carp module are used.
These normally print output to stderr, and this method provides a
mechanism for trapping these errors and redirecting them elsewhere.
For example, stderr in a system daemon may be entirely ignored, and
syslog may be a more appropriate destination. In this case, the
setCarp method may be used to configure this, globally, for the entire
API.
AFS::Command->setCarp
(
carp => sub {
my ($lines) = @_;
foreach my $line ( split(/\n+/,$lines) ) {
syslog('warning',$line);
}
( run in 0.528 second using v1.01-cache-2.11-cpan-49f99fa48dc )