The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

CatalystX::Usul::FileSystem - File system related methods

Version

0.6.$Revision: 1165 $

Synopsis

   package CatalystX::Usul::Model::FileSystem;

   use CatalystX::Usul::FileSystem;

   1;

   package YourApp::Model::FileSystem;

   use base qw(CatalystX::Usul::Model::FileSystem);

   1;

   package YourApp::Controller::Foo;

   sub bar {
      my ($self, $c) = @_;

      $c->model( q(FileSystem) )->list_subdirectory( { dir => q(/path) } );
      return;
   }

Description

This model provides methods for manipulating files and directories

Subroutines/Methods

new

Constructor defines logsdir; the location of the applications log files and no_thrash; the length of time to wait between test for the existence of a file to avoid a spin loop

archive

Archives a file by prepending the $self-postfix>, which defaults to A_

file_in_use

Uses the system fuser command if it is available to determine if a file is in use

get_file_systems

Parses the output from the system mount command to produce a list of file systems

get_perms

Returns the -rw-rw-r-- style permission string for a given octal mode

list_subdirectory

Generates the table data for a directory listing. The data is used by the table subclass of HTML::FormWidgets

purge_tree

Archive old files and delete even older ones from a given directory

rotate

Issues a sequence a move commands to rename file to file.0, file.0 to file.1, file.1 to file.2 and so on

rotate_log

Calls "rotate". Will also touch a new logfile into existence and optionally signal a process

rotate_logs

Calls "rotate_log" on all of the .log files in the given directory, which defaults to the logs directory

unarchive

Reverse out the effect of calling "archive"

wait_for

Wait for a given file to exist. Polls at given intervals file a configurable period before throwing a time out error if the file does not show up

Diagnostics

None

Configuration and Environment

None

Dependencies

CatalystX::Usul
CatalystX::Usul::Constants
CatalystX::Usul::Table

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2011 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE