This file is indexed.

/usr/lib/perl5/Xacobeo/Conf.pm is in xacobeo 0.13-2build1.

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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package Xacobeo::Conf;

=head1 NAME

Xacobeo::Conf - Application's configuration.

=head1 SYNOPSIS

	use Xacobeo::Conf;
	
	my $conf = Xacobeo::Conf->get_conf;
	
	my $icon = $conf->share_file('images', 'xacobeo.png'); # /usr/share/images/xacobeo.png
	my $po_folder = $conf->share_folder('locale');         # /usr/share/locale

=head1 DESCRIPTION

Utility class that provides a way for accessing all configuration parameters
that are needed at runtime..

=head1 PROPERTIES

The following properties are defined:

=head2 dir

The root directory where the application has been installed.

=head1 METHODS

The following methods are available:

=cut

use strict;
use warnings;

use FindBin;
use File::Spec::Functions;
use File::BaseDir;

use Xacobeo::GObject;

Xacobeo::GObject->register_package('Glib::Object' =>
	properties => [
		Glib::ParamSpec->scalar(
			'dir',
			"Dir",
			"The root folder of the application's installation",
			['readable', 'writable', 'construct-only'],
		),
	],
);

my $XDG = File::BaseDir->new();
my $INSTANCE = __PACKAGE__->init();


=head2 get_conf

Returns the current configuration instance. This class is a singleton so there's
no constructor.

=cut

sub get_conf {
	return $INSTANCE;
}


sub init {
	my $class = shift;
	my ($dir) = @_;
	
	$dir ||= find_app_folder();

	$INSTANCE = $class->SUPER::new(dir => $dir);
}


=head2 share_dir

Returns the path of a folder in the application's I<share> directory.

Parameters:

=over

=item * @path

The path parts relative to the share directory.

=back

=cut

sub share_dir {
	my $self = shift;
	return catdir($self->dir, 'share', @_); 
}


=head2 share_file

Returns the path of a file in the application's I<share> directory.

Parameters:

=over

=item * @path

The path parts relative to the share directory.

=back

=cut

sub share_file {
	my $self = shift;
	return catfile($self->dir, 'share', @_); 
}


=head2 app_name

Returns the application's name.

=cut

sub app_name {
	return "Xacobeo";
}


=head2 plugin_folders

Returns the folders that are scanned for plugins.

=cut

sub plugin_folders {
	my $self = shift;
	my %seen;
	return map { $seen{$_}++ ? () : catdir($_, 'xacobeo', 'plugins') }
		$XDG->config_home,
		$XDG->config_dirs
	;
}


# Return the root folder of the application once installed. The 'root' folder is
# the one where the installation is done, the root folder hierarchy is as
# follows:
#
# (root)
# |-- bin
# |-- lib
# |   `-- perl5
# |       |-- Xacobeo
# |       `-- i486-linux-gnu-thread-multi
# |               `-- Xacobeo
# |           `-- auto
# |               `-- Xacobeo
# |-- man
# |   |-- man1
# |   `-- man3
# `-- share
#     |-- applications
#     |-- pixmaps
#     `-- xacobeo
sub find_app_folder {
	return catdir($FindBin::Bin, '..');
}


# A true value
1;


=head1 AUTHORS

Emmanuel Rodriguez E<lt>potyl@cpan.orgE<gt>.

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008,2009 by Emmanuel Rodriguez.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.

=cut