nr_free_pages 4157985
nr_alloc_batch 796
nr_inactive_anon 37881
nr_active_anon 134218
nr_inactive_file 338339
nr_active_file 556451
nr_unevictable 14411
nr_mlock 14411
nr_anon_pages 70115
nr_mapped 34208
nr_file_pages 958462
nr_dirty 11
nr_writeback 0
nr_slab_reclaimable 50904
nr_slab_unreclaimable 8697
nr_page_table_pages 4697
nr_kernel_stack 510
nr_unstable 0
nr_bounce 0
nr_vmscan_write 0
nr_vmscan_immediate_reclaim 0
nr_writeback_temp 0
nr_isolated_anon 0
nr_isolated_file 0
nr_shmem 62708
nr_dirtied 585927
nr_written 550145
numa_hit 381215763
numa_miss 0
numa_foreign 0
numa_interleave 25341
numa_local 381215763
numa_other 0
workingset_refault 0
workingset_activate 0
workingset_nodereclaim 0
nr_anon_transparent_hugepages 103
nr_free_cma 0
      nr_free_pages 4157985
nr_alloc_batch 796
nr_inactive_anon 37881
nr_active_anon 134218
nr_inactive_file 338339
nr_active_file 556451
nr_unevictable 14411
nr_mlock 14411
nr_anon_pages 70115
nr_mapped 34208
nr_file_pages 958462
nr_dirty 11
nr_writeback 0
nr_slab_reclaimable 50904
nr_slab_unreclaimable 8697
nr_page_table_pages 4697
nr_kernel_stack 510
nr_unstable 0
nr_bounce 0
nr_vmscan_write 0
nr_vmscan_immediate_reclaim 0
nr_writeback_temp 0
nr_isolated_anon 0
nr_isolated_file 0
nr_shmem 62708
nr_dirtied 585927
nr_written 550145
numa_hit 381215763
numa_miss 0
numa_foreign 0
numa_interleave 25341
numa_local 381215763
numa_other 0
workingset_refault 0
workingset_activate 0
workingset_nodereclaim 0
nr_anon_transparent_hugepages 103
nr_free_cma 0
 _    # Copyright (C) 2001-2012 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Written by Akim Demaille <akim@freefriends.org>.

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to automake-patches@gnu.org.         #
###############################################################

package Autom4te::XFile;

=head1 NAME

Autom4te::XFile - supply object methods for filehandles with error handling

=head1 SYNOPSIS

    use Autom4te::XFile;

    $fh = new Autom4te::XFile;
    $fh->open ("< file");
    # No need to check $FH: we died if open failed.
    print <$fh>;
    $fh->close;
    # No need to check the return value of close: we died if it failed.

    $fh = new Autom4te::XFile "> file";
    # No need to check $FH: we died if new failed.
    print $fh "bar\n";
    $fh->close;

    $fh = new Autom4te::XFile "file", "r";
    # No need to check $FH: we died if new failed.
    defined $fh
    print <$fh>;
    undef $fh;   # automatically closes the file and checks for errors.

    $fh = new Autom4te::XFile "file", O_WRONLY | O_APPEND;
    # No need to check $FH: we died if new failed.
    print $fh "corge\n";

    $pos = $fh->getpos;
    $fh->setpos ($pos);

    undef $fh;   # automatically closes the file and checks for errors.

    autoflush STDOUT 1;

=head1 DESCRIPTION

C<Autom4te::XFile> inherits from C<IO::File>.  It provides the method
C<name> returning the file name.  It provides dying versions of the
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>.

=cut

use 5.006;
use strict;
use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA);
use Carp;
use Errno;
use IO::File;
use File::Basename;
use Autom4te::ChannelDefs;
use Autom4te::Channels qw(msg);
use Autom4te::FileUtils;

require Exporter;
require DynaL