App-Info

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.10  Wed Jun  5 23:58:54 2002
      - Added new error_level parameter to new(). This tells App::Info objects
        how to handle errors on an object-by-object basis. The new base class
        method error() is for subclasses to use for throwing errors, and
        last_error() is for client code to access the last error in non-fatal
        error modes. See App::Info for complete documentation. This is the
        major change the triggered the (mild) version number jump.
      - Reworked all application subclasses to use the new error() method.
      - Changed all application subclasses so that they're no longer singleton
        classes. Each new object construction looks for application metadata
        all over again.
      - Updated documentation on subclassing to reflect changes.
      - Added first_exe() and first_cat_exe() to App::Info::Util. Changed
        RDBMS::PostgreSQL, HTTP::Apache, and Lib::Iconv to use them.
      - Added more directories in which to search for the Apache server
        executable, thanks to work by Dave Rolsky.

0.06  Wed Jun  5 15:36:36 2002
      - Fixed all version tests in test scripts to check for definedness
        rather than truth, so that version numbers that are "0" will be

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


Note how this method only tries to find the version number once. Any
subsequent calls to C<version()> will return the same value that was returned
the first time it was called. Of course, thanks to the C<key> parameter in the
call to C<unknown()>, we could have have tried to enumerate the version number
every time, as C<unknown()> will return the same value every time it is called
(as, indeed, should C<_find_version()>. But by checking for the C<version> key
in C<$self> ourselves, we save some of the overhead.

But as I said before, every meta data method should make use of the
C<unknown()> method. Thus, the C<major()> method might looks something like
this:

  sub major {
      my $self = shift;

      unless (exists $self->{major}) {
          # Try to get the major version from the full version number.
          ($self->{major}) = $self->version =~ /^(\d+)\./;
          # Handle an unknown value.
          $self->{major} = $self->unknown( key      => 'major',

lib/App/Info/HTTPD/Apache.pm  view on Meta::CPAN

    my $option = lc $_[0];
    $self->{$option} = $self->unknown( key => "apache option $option" )
      unless defined $self->{$option};
    return $self->{$option};
}

##############################################################################

=head3 conf_file

Returns the full path to the Apache configuration file. C<conf_file()> looks
for the configuration file in a number of locations and under a number of
names. First it tries to use the file specified by the C<SERVER_CONFIG_FILE>
compile option (as returned by a call to C<compile_option()>) -- and if it's a
relative file name, it gets appended to the directory returned by
C<httpd_root()>. If that file isn't found, C<conf_file()> then looks for a
file with one of the names returned by C<search_conf_names()> in the F<conf>
subdirectory of the HTTPD root directory. Failing that, it searches for them
in each of the directories returned by C<search_conf_dirs()> until it finds a
match.

B<Events:>

=over 4

=item info

lib/App/Info/HTTPD/Apache.pm  view on Meta::CPAN

    return $self->{bin_dir};
}

##############################################################################

=head3 inc_dir

  my $inc_dir = $apache->inc_dir;

Returns the Apache include directory path. App::Info::HTTPD::Apache simply
looks for the F<include> or F<inc> directory under the F<httpd_root>
directory, as returned by C<httpd_root()>.

B<Events:>

=over 4

=item info

Executing `httpd -V`

lib/App/Info/HTTPD/Apache.pm  view on Meta::CPAN

    return $self->{inc_dir};
}

##############################################################################

=head3 lib_dir

  my $lib_dir = $apache->lib_dir;

Returns the Apache library directory path. App::Info::HTTPD::Apache simply
looks for the F<lib>, F<modules>, or F<libexec> directory under the HTTPD
root> directory, as returned by C<httpd_root()>.

B<Events:>

=over 4

=item info

Executing `httpd -V`

lib/App/Info/Lib/Iconv.pm  view on Meta::CPAN

    return $self->{inc_dir};
}

##############################################################################

=head3 lib_dir

  my $lib_dir = $iconv->lib_dir;

Returns the directory path in which a libiconv library was found. The search
looks for a file with a name returned by C<search_lib_names()> in a directory
returned by C<search_lib_dirs()>.

B<Events:>

=over 4

=item info

Searching for library directory

lib/App/Info/Lib/Iconv.pm  view on Meta::CPAN

    return $self->{lib_dir};
}

##############################################################################

=head3 so_lib_dir

  my $so_lib_dir = $iconv->so_lib_dir;

Returns the directory path in which a libiconv shared object library was
found. The search looks for a file with a name returned by
C<search_so_lib_names()> in a directory returned by C<search_lib_dirs()>.

Returns the directory path in which a libiconv shared object library was
found. App::Info::Lib::Iconv searches for these files:

<Events:>

=over 4

=item info

lib/App/Info/Util.pm  view on Meta::CPAN

The first argument to this method may be either a file or directory base name
(that is, a file or directory name without a full path specification), or a
reference to an array of file or directory base names. The remaining arguments
constitute a list of directory paths. C<first_cat_path()> processes each of
these directory paths, concatenates (by the method native to the local
operating system) each of the file or directory base names, and returns the
first one that exists on the file system.

For example, let us say that we were looking for a file called either F<httpd>
or F<apache>, and it could be in any of the following paths:
F</usr/local/bin>, F</usr/bin/>, F</bin>. The method call looks like this:

  my $httpd = $util->first_cat_path(['httpd', 'apache'], '/usr/local/bin',
                                    '/usr/bin/', '/bin');

If the OS is a Unix variant, C<first_cat_path()> will then look for the first
file that exists in this order:

=over 4

=item /usr/local/bin/httpd



( run in 0.428 second using v1.01-cache-2.11-cpan-64827b87656 )