This file is indexed.

/usr/share/perl5/Spoon/Config.pm is in libspoon-perl 0.24-2.

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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package Spoon::Config;
use Spoon::Base -Base;

const class_id => 'config';

sub all {
    return %$self;
}

sub default_configs { return }

sub new() {
    my $class = shift;
    my $self = bless {}, $class;
    my (@configs) = map {
        /\*/ ? (sort glob) : ($_)
    } @_ ? @_ : $self->default_configs;
    $self->add_config($self->default_config, 1);
    for my $config (@configs) {
        $self->rebless($self->add_config($config));
    }
    $self->init;
    return $self;
}

sub add_field {
    my ($field, $default) = @_;
    field $field => $default;
}

sub add_config {
    my $config = shift;
    my $hash = ref $config
    ? $config
    : $self->hash_from_file($config);
    for my $key (keys %$hash) {
        field $key;
        $self->{$key} = $hash->{$key};
    }
    return $hash;
}

sub rebless {
    my $hash = shift;
    if (defined (my $config_class = $hash->{config_class})) {
        eval qq{ require $config_class }; die $@ if $@;
        bless $self, $config_class;
    }
}

sub hash_from_file {
    my $config = shift;
    die "Invalid name for config file '$config'\n"
      unless $config =~ /\.(\w+)$/;
    my $extension = lc("$1"); # quotes fix 5.8.0 perl bug
    my $method = "parse_${extension}_file";
    -f $config ? $self->$method($config) : {};
}

sub parse_file {
    $self->parse_yaml_file(@_);
}

sub parse_yaml_file {
    my $file = shift;
    $self->parse_yaml(io($file)->utf8->all);
}

sub parse_yaml {
    my $yaml = shift;
    my $hash = {};
    my $latest_key = '';
    for (split /\n/, $yaml) {
        next if (/^#/);
        if (/^-\s*(.*)$/) {
            $hash->{$latest_key} = [] unless ref $hash->{$latest_key};
            push @{$hash->{$latest_key}}, $1;
        }
        elsif (/(.*?)\s*:\s+(.*?)\s*$/ or /(.*?):()\s*$/) {
            $hash->{$1} = $2;
            $latest_key = $1;
        }
    }
    return $hash;
}

sub default_config {
    +{
        $self->default_classes,
        plugin_classes => [$self->default_plugin_classes],
    }
}

sub default_classes {
    (
        cgi_class => 'Spoon::CGI',
        config_class => 'Spoon::Config',
        formatter_class => 'Spoon::Formatter',
        headers_class => 'Spoon::Headers',
        hooks_class => 'Spoon::Hooks',
        hub_class => 'Spoon::Hub',
        main_class => 'Spoon',
        registry_class => 'Spoon::Registry',
        template_class => 'Spoon::Template',
    )
}

sub default_plugin_classes { () }

__END__

=head1 NAME 

Spoon::Config - Spoon Configuration Base Class

=head1 SYNOPSIS

=head1 DESCRIPTION

=head1 AUTHOR

Brian Ingerson <INGY@cpan.org>

=head1 COPYRIGHT

Copyright (c) 2004. Brian Ingerson. All rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

=cut