NAME KA::Tie::Dir - Access file system via a Perl hash SYNOPSIS use KA::Tie::Dir; use Data::Dumper; my %data; tie %data, "KA::Tie::Dir", ( 'dir' => "/" ); print Dumper($data{'etc'}{'passwd'}); DESCRIPTION KA::Tie::Dir represents file system as a Perl hash. Each hash key corresponds to name of a directory or a file. For example, for a file "/etc/passwd" it will be $data{'etc'}{'passwd'}. Con- tents of the file "/etc/passwd" becomes a value corresponding to the $data{'etc'}{'passwd'}. Standard handling procedure for directories is to store a list- ing of files in the directory as keys. Standard procedure for files is to store a contents of the file in the scalar value. For certain files with known structure it is possible to define subroutines for special handling. "KA::Tie::Dir::System" defines subroutines for handling system files and, for starters, has 'passwd' handling subroutine. "/etc/passwd" can be represented asa hash with following structure: $data{'etc'}{'passwd'}{$user- name}{$field}. Options tie %data, "KA::Tie::Dir", ( 'dbg' => 0, 'buf_size' => 10, 'dir' => "/" ); 'dbg' - level of debug output 0 - 'SILENT', default # No output at all, ERRORs are sup- pressed 1 - 'ERROR' # ERRORs are printed to STDERR 2 - 'WARNING' # WARNINGs are printed to STDERR 3 - 'INFO' # Information messages 4 - 'D:IN/OUT' # Important variables 5 - 'D:LOGIC' # Logical desicions 6 - 'D:VARS' # Variables 'buf_size' - buffer limit for file reading 'dir' - directory to tie to Public Methods None. PLATFORMS Debian 3.1, Perl, v5.8.8. Windows XP, ActiveState Perl, v5.8.8. CAVEATS The module is read only and does not permit overwrite or delete files. Under Windows '/' corresponds to 'C:'. If you try to tie hash %data to '/' and then print Dumper(%data), module will traverse the entire file system on demand! BUGS None known. AUTHOR Vadim V. Kouevda, initdotd@gmail.com LICENSE and COPYRIGHT Copyright (c) 2003-2007, Vadim V. Kouevda, "KAITS, Inc." This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. These terms are your choice of any of (1) the Perl Artistic Licence, or (2) version 2 of the GNU General Public License as published by the Free Software Foundation, or (3) any later ver- sion of the GNU General Public License. This library 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 library program; it should be in the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA For licensing inquiries, contact the author atinitdotd@gmail.com WARRANTY Module comes with ABSOLUTELY NO WARRANTY. For details, see the license. AVAILABILITY The latest version can be obtained from CPAN SEE ALSO KA::Tie::Dir::System(3), Tie::File(3)