summaryrefslogtreecommitdiff
path: root/lib/Automake/XFile.pm
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-10-18 10:00:28 +0200
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-10-18 12:34:24 +0200
commit2517914f0a62b8fd21d827bb1401157eb02e2d00 (patch)
treec50fc1fa3c8b982adcca990eecc9771ea0018e88 /lib/Automake/XFile.pm
parenta6a7834f03248dc3b1da1d70b40fcaf37967b4ab (diff)
downloadautomake-2517914f0a62b8fd21d827bb1401157eb02e2d00.tar.gz
Pod coverage for Perl modules.
* lib/Automake/ChannelDefs.pm (parse_warnings): Fix typo in Pod documentation. * lib/Automake/Condition.pm: Add a couple of missing `=back' lines. (_has): Renamed from ... (has): ... this, as this is an internal method. (strip, false, true_when): Adjust callers. * lib/Automake/Configure_ac.pm: Add Pod `Functions' section with documentation for find_configure_ac and require_configure_ac. * lib/Automake/Location.pm: Fix typo in Pod. Add `Methods' section, document methods. * lib/Automake/RuleDef.pm: New `Methods' Pod section. * lib/Automake/VarDef.pm: Document `raw_value'. * lib/Automake/Wrap.pm (_tab_length): Rename from ... (tab_length): ... this, as this is an internal method. (wrap): Adjust callers. * lib/Automake/XFile.pm: Reorganize Pod a bit, add `Methods' section. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'lib/Automake/XFile.pm')
-rw-r--r--lib/Automake/XFile.pm109
1 files changed, 70 insertions, 39 deletions
diff --git a/lib/Automake/XFile.pm b/lib/Automake/XFile.pm
index f99a00ae4..b67e2517a 100644
--- a/lib/Automake/XFile.pm
+++ b/lib/Automake/XFile.pm
@@ -68,18 +68,6 @@ methods C<close>, C<lock> (corresponding to C<flock>), C<new>,
C<open>, C<seek>, and C<truncate>. It also overrides the C<getline>
and C<getlines> methods to translate C<\r\n> to C<\n>.
-=head1 SEE ALSO
-
-L<perlfunc>,
-L<perlop/"I/O Operators">,
-L<IO::File>
-L<IO::Handle>
-L<IO::Seekable>
-
-=head1 HISTORY
-
-Derived from IO::File.pm by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
-
=cut
require 5.000;
@@ -113,9 +101,16 @@ eval {
# Used in croak error messages.
my $me = basename ($0);
-################################################
-## Constructor
-##
+=head2 Methods
+
+=over
+
+=item C<$fh = new Automake::XFile ([$expr, ...]>
+
+Constructor a new XFile object. Additional arguments
+are passed to C<open>, if any.
+
+=cut
sub new
{
@@ -129,9 +124,12 @@ sub new
$fh;
}
-################################################
-## Open
-##
+=item C<$fh-E<gt>open ([$file, ...])>
+
+Open a file, passing C<$file> and further arguments to C<IO::File::open>.
+Die if opening fails. Store the name of the file. Use binmode for writing.
+
+=cut
sub open
{
@@ -156,9 +154,11 @@ sub open
binmode $fh if $file =~ /^\s*>/;
}
-################################################
-## Close
-##
+=item C<$fh-E<gt>close>
+
+Close the file, handling errors.
+
+=cut
sub close
{
@@ -172,9 +172,12 @@ sub close
}
}
-################################################
-## Getline
-##
+=item C<$line = $fh-E<gt>getline>
+
+Read and return a line from the file. Ensure C<\r\n> is translated to
+C<\n> on input files.
+
+=cut
# Some Win32/perl installations fail to translate \r\n to \n on input
# so we do that here.
@@ -187,9 +190,11 @@ sub getline
return $_;
}
-################################################
-## Getlines
-##
+=item C<@lines = $fh-E<gt>getlines>
+
+Slurp lines from the files.
+
+=cut
sub getlines
{
@@ -199,9 +204,11 @@ sub getlines
return @res;
}
-################################################
-## Name
-##
+=item C<$name = $fh-E<gt>name>
+
+Return the name of the file.
+
+=cut
sub name
{
@@ -209,9 +216,13 @@ sub name
return ${*$fh}{'autom4te_xfile_file'};
}
-################################################
-## Lock
-##
+=item C<$fh-E<gt>lock>
+
+Lock the file using C<flock>. If locking fails for reasons other than
+C<flock> being unsupported, then error out if C<$ENV{'MAKEFLAGS'}> indicates
+that we are spawned from a parallel C<make>.
+
+=cut
sub lock
{
@@ -243,9 +254,11 @@ sub lock
}
}
-################################################
-## Seek
-##
+=item C<$fh-E<gt>seek ($position, [$whence])>
+
+Seek file to C<$position>. Die if seeking fails.
+
+=cut
sub seek
{
@@ -258,9 +271,11 @@ sub seek
}
}
-################################################
-## Truncate
-##
+=item C<$fh-E<gt>truncate ($len)>
+
+Truncate the file to length C<$len>. Die on failure.
+
+=cut
sub truncate
{
@@ -272,6 +287,22 @@ sub truncate
}
}
+=back
+
+=head1 SEE ALSO
+
+L<perlfunc>,
+L<perlop/"I/O Operators">,
+L<IO::File>
+L<IO::Handle>
+L<IO::Seekable>
+
+=head1 HISTORY
+
+Derived from IO::File.pm by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
+
+=cut
+
1;
### Setup "GNU" style for perl-mode and cperl-mode.