/[gentoo-perl]/g-cpan/trunk/lib/Gentoo/Config.pm
Gentoo

Diff of /g-cpan/trunk/lib/Gentoo/Config.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 89 Revision 90
5use warnings; 5use warnings;
6 6
7require Exporter; 7require Exporter;
8 8
9our @ISA = qw(Exporter); 9our @ISA = qw(Exporter);
10our @EXPORT = qw(getParamFromFile getFileContents getValue ); 10our @EXPORT = qw(getParamFromFile getFileContents getValue);
11 11
12our $VERSION = '0.01'; 12our $VERSION = '0.02';
13 13
14sub new { 14sub new {
15 my $self = shift; 15 my $self = shift;
16 my $class = ref($self) || $self; 16 my $class = ref($self) || $self;
17 return bless {}, $class; 17 return bless {}, $class;
126# Returnvalue is the content of the given file. 126# Returnvalue is the content of the given file.
127# $filecontent = getFileContents($file); 127# $filecontent = getFileContents($file);
128sub getFileContents { 128sub getFileContents {
129 my $content = ""; 129 my $content = "";
130 130
131 {
132 local $/ = undef;
131 open( FH, "<" . $_[0] ) || die( "Cannot open file " . $_[0] ); 133 open( FH, "<" . $_[0] ) || die( "Cannot open file " . $_[0] );
132 while (<FH>) { $content .= $_; } 134 $content = <FH>;
133 close(FH); 135 close(FH);
136 }
134 return $content; 137 return $content;
135} 138}
136 139
137sub getValue { 140sub getValue {
138 my $self = shift; 141 my $self = shift;
162 165
1631; 1661;
164 167
165__END__ 168__END__
166 169
167=pod 170=pod
168 171
169=head1 NAME 172=head1 NAME
170 173
171Gentoo::Config - Pull general Gentoo config information 174Gentoo::Config - Pull general Gentoo config information
172 175
189 192
190=item my $obj = Gentoo::Config->new(); 193=item my $obj = Gentoo::Config->new();
191 194
192Create a new Gentoo Config object. 195Create a new Gentoo Config object.
193 196
194=item my $var = $obj->($PORTVAR); 197=item my $var = $obj->getValue($PORTVAR);
195 198
196Get the defined portage variable. Returns a string. 199Get the defined portage variable. Returns a string.
197 200
198=back 201=back
199 202
200=head1 SEE ALSO 203=head1 SEE ALSO
201 204
202See L<make.conf> for an overview of the variables that are availble for 205See L<make.conf> for an overview of the variables that are available for
203extraction from portage. 206extraction from portage.
204 207
205=cut 208=cut
206 209

Legend:
Removed from v.89  
changed lines
  Added in v.90

  ViewVC Help
Powered by ViewVC 1.1.20