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


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

Index


Code Index:

Name

Top

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

Version

Top

0.3.$Revision: 576 $

Synopsis

Top

   package MyApp::Model::FileSystem;

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

   1;

   package MyApp::Controller::Foo;

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

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

Description

Top

This model provides methods for manipulating files and directories

Subroutines/Methods

Top

build_per_context_instance

Creates an instance of CatalystX::Usul::Filesystem

get_file_systems

Returns the file systems on the local host

list_subdirectory

Returns the contents of the selected directory as a CatalystX::Usul::Table object

view_file

Stash the data used by HTML::FormWidgets to view a file of a given type

Diagnostics

Top

None

Configuration and Environment

Top

None

Dependencies

Top

CatalystX::Usul::Model
CatalystX::Usul::FileSystem

Incompatibilities

Top

There are no known incompatibilities in this module

Bugs and Limitations

Top

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

Author

Top

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

License and Copyright

Top


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

# @(#)$Id: FileSystem.pm 576 2009-06-09 23:23:46Z pjf $

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

use strict;
use warnings;
use version; our $VERSION = qv( sprintf '0.3.%d', q$Rev: 576 $ =~ /\d+/gmx );
use parent qw(CatalystX::Usul::Model);

use CatalystX::Usul::FileSystem;
use Class::C3;

__PACKAGE__->mk_accessors( qw(domain_model) );

sub build_per_context_instance {
   my ($self, $c, @rest) = @_; my $s = $c->stash; my $args;

   my $new = $self->next::method( $c, @rest );

   $args->{debug  } = $s->{debug};
   $args->{lang   } = $s->{lang};
   $args->{fs_type} = $s->{os}->{fs_type}->{value};
   $args->{fuser  } = $s->{os}->{fuser  }->{value};

   $new->domain_model( CatalystX::Usul::FileSystem->new( $c, $args ) );
   return $new;
}

sub get_file_systems {
   return shift->domain_model->get_file_systems( @_ );
}

sub list_subdirectory {
   return shift->domain_model->list_subdirectory( @_ );
}

sub view_file {
   my ($self, $subtype, $id) = @_;

   return unless ($id);

   my $path = $subtype eq q(source) ? $self->find_source( $id ) : $id;

   $self->add_field(  { path    => $path,
                        subtype => $subtype, type => q(file) } );
   $self->add_append( { text    => $self->loc( 'Viewing [_1]', $path ),
                        type    => q(label) } );
   return;
}

1;

__END__

# Local Variables:
# mode: perl
# tab-width: 3
# End: