Apache-FileManager
view release on metacpan or search on metacpan
FileManager.pm view on Meta::CPAN
also be /web/project/htdocs/newroot. The directory `newroot` must exist.
# Specify different document root in apache conf file
<Location /FileManager>
SetHandler perl-script
PerlHandler Apache::FileManager
PerlSetVar DOCUMENT_ROOT /web/project/htdocs/newroot
</Location>
# Or specify different document root in your own mod_perl script
use Apache::FileManager;
my $obj = Apache::FileManager->new({
DOCUMENT_ROOT => '/web/project/htdocs/newroot'
});
$obj->print();
=head1 SUBCLASSING Apache::FileManager
# Create a new file with the following code:
package MyProject::MyFileManager;
use strict;
use Apache::FileManager;
our @ISA = ('Apache::FileManager');
#Add your own methods here
1;
The best way to subclass the filemanager would be to copy the methods you want
to overload from the Apache::FileManager file to your new subclass. Then change
the methods to your liking.
=head1 BUGS
There is a bug in File::NCopy that occurs when trying to paste an empty
directory. The directory is copied but reports back as 0 directories pasted.
The author is in the process of fixing the problem.
=head1 AUTHOR
Apache::FileManager was written by Philip Collins
E<lt>pmc@cpan.orgE<gt>.
=cut
use strict;
#use warnings;
use IO::File;
use Apache::Request;
use Apache::Util qw(escape_html);
use Apache::File;
use File::NCopy qw(copy);
use File::Copy qw(move);
use File::Remove qw(remove);
use File::stat;
use Archive::Any;
use POSIX qw(strftime);
use CGI::Cookie;
use Apache::Constants ':common';
#use Data::Dumper;
require 5.005_62;
our $VERSION = '0.19';
sub r { return Apache::Request->instance( Apache->request ); }
# ---------- Object Constructor -----------------------------------------
sub new {
my $package = shift;
my $attribs = shift || {};
my $o = bless $attribs, $package;
$o->intialize();
$o->execute_cmds();
return $o;
}
# ---- If this was called directly via a perl content handler by apache -------
sub handler {
return DECLINED if defined r->param('nossi');
my $package = __PACKAGE__;
my $obj = $package->new();
r->send_http_header('text/html');
r->print("<HTML><HEAD><TITLE>".r->server->server_hostname." File Manager $VERSION</TITLE></HEAD>");
$obj->print();
r->print("</HTML>");
return OK;
}
# ---- Call the view ----------------------------------------------
sub print {
my $o = shift;
my $view = "view_".$$o{'view'};
$o->$view();
}
# ------------ Intialize object -----------------------------------------
sub intialize {
my $o = shift;
$$o{MESSAGE} = "";
$$o{JS} = "";
$o->{EDIT_COLS} ||= 75;
$o->{EDIT_ROWS} ||= 22;
# Is this filemanager rsync capable?
$$o{'RSYNC_TO'} ||= r->dir_config('RSYNC_TO') || undef;
#set some defaults (for warnings sake)
r->param('FILEMANAGER_cmd' => "")
unless defined r->param('FILEMANAGER_cmd');
r->param('FILEMANAGER_arg' => "")
( run in 1.194 second using v1.01-cache-2.11-cpan-39bf76dae61 )