Tie::TextDir

Tie::TextDir is a Perl interface to directory of files.
Download

Tie::TextDir Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ken Williams
  • Publisher web site:
  • http://search.cpan.org/~kwilliams/Module-Build-0.2808/lib/Module/Build/Compat.pm

Tie::TextDir Tags


Tie::TextDir Description

Tie::TextDir is a Perl interface to directory of files. Tie::TextDir is a Perl interface to directory of files.SYNOPSIS use Tie::TextDir; tie %hash, 'Tie::TextDir', '/some_directory', 'rw'; # Open in read/write mode $hash{'one'} = "some text"; # Creates file /some_directory/one # with contents "some text" untie %hash; tie %hash, 'Tie::TextDir', '/etc'; # Defaults to read-only mode print $hash{'passwd'}; # Prints contents of /etc/passwd # Specify directory permissions explicitly tie %hash, 'Tie::TextDir', '/some_directory', 'rw', 0775;The Tie::TextDir module is a TIEHASH interface which lets you tie a Perl hash to a directory on the filesystem. Each entry in the hash represents a file in the directory.To use it, tie a hash to a directory: tie %hash, "/some_directory", 'rw'; # Open in read/write modeIf you pass 'rw' as the third parameter, you'll be in read/write mode, and any changes you make to the hash will create, modify, or delete files in the given directory. If you pass 'ro' (or nothing) as the third parameter, you'll be in read-only mode, and any changes you make to the hash won't have any effect in the given directory.The 'rw' and 'ro' modes are actually just shorthand for O_RDWR|O_CREAT and O_RDONLY, respectively, as defined by the Fcntl module. You may pass Fcntl bitmasks instead of their stringy names if you like that better. The O_RDWR flag means that you may create or delete files in the directory, and the O_CREAT flag means that if the directory itself doesn't exist Tie::TextDir will create it (or die trying).An optional fourth parameter specifies the permissions setting that should be used when creating the tied directory. It doesn't have any effect at this point on the permissions of the files inside the directory, though. If the directory already exists, the permissions setting will have no effect. The default permissions setting is 0775. Requirements: · Perl


Tie::TextDir Related Software