This file is indexed.

/usr/share/perl5/Alzabo/Config.pm is in libalzabo-perl 0.92-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
package Alzabo::Config;

use File::Spec;

use vars qw($VERSION %CONFIG);

use strict;

$VERSION = 2.0;

%CONFIG = (
'root_dir' => undef,
);

my $curdir = File::Spec->curdir;
my $updir = File::Spec->updir;

sub root_dir
{
    $CONFIG{root_dir} = $_[0] if defined $_[0];
    return $CONFIG{root_dir};
}

sub schema_dir
{
    Alzabo::Exception->throw( error => "No Alzabo root directory defined" )
	unless defined $CONFIG{root_dir};

    return File::Spec->catdir( $CONFIG{root_dir}, 'schemas' );
}

sub available_schemas
{
    my $dirname = Alzabo::Config::schema_dir;

    local *DIR;
    opendir DIR, $dirname
        or Alzabo::Exception::System->throw( error =>  "can't open $dirname: $!\n" );

    my @s;
    foreach my $e (readdir DIR)
    {
        next if $e eq $curdir || $e eq $updir;

        my $dir = File::Spec->catdir( $dirname, $e );
        push @s, $e
            if -d $dir && -r _ && glob "$dir/*.alz";
    }

    closedir DIR
        or Alzabo::Exception::System->throw( error =>  "can't close $dirname: $!\n" );

    return @s;
}

__END__

=head1 NAME

Alzabo::Config - Alzabo configuration information

=head1 SYNOPSIS

  use Alzabo::Config

  print Alzabo::Config::schema_dir;

=head1 DESCRIPTION

This module contains functions related to Alzabo configuration
information.

=head1 FUNCTIONS

=head2 root_dir ($root)

If a value is passed to this method then the root is temporarily
changed.  This change lasts as long as your application remains in
memory.  However, since changes are not written to disk it will have
to be changed again.

Returns the root directory for your Alzabo installation.

=head2 schema_dir

If no root_dir is defined, this function throws an exception.

Returns the directory under which Alzabo schema objects are stored in
serialized form.

=head2 available_schemas

If no root_dir is defined, this function throws an exception.

Returns a list containing the names of the available schemas.  There
will be one directory for each schema under the directory returned.
Directories which cannot be read will not be included in the list.

Throws: L<C<Alzabo::Exception::System>|Alzabo::Exceptions>

=cut