viewer.pm

来自「本文件为Web-FTP的实现源代码 是cgi编程 使用perl为主 本软件适用于」· PM 代码 · 共 49 行

PM
49
字号
#!/usr/bin/perlpackage viewer;sub new {    my %self;    shift;    %self = @_;    $_ = bless \%self;    return $_;}sub new_file {    my $self = shift;}sub EDITMAIN {    my $self = shift;    $self->{conf}{CURRENTEDIT} =~ /([^\.]+)$/;    my $ext = $1;    if($ext && -f $self->{conf}{mimefile}) {	open(MIME, $self->{conf}{mimefile}) or return;	while(<MIME>) {	    next if /^[\#\s]/;	    next unless /\b\Q$ext\E\b/i;	    $self->{contenttype} = ((split /\s+/, $_, 2)[0]);	    $self->{contenttype} =~ s|^text/.*|text/plain|;	    last;	}    }    unless($self->{contenttype}) {	if($self->{conf}{EDITDATA} =~ /[\x80-\xff]/) {	    $self->{contenttype} = "Application/Octet-Stream";	} else {	    $self->{contenttype} = 'text/plain';	}    }    $self->{conf}{specialheader} = "Connection: close\n";    $self->{conf}{specialheader} .= qq`Content-Type: $self->{contenttype};name="$self->{conf}{CURRENTEDIT}"\n`;    $self->{conf}{specialheader} .= qq`Content-Disposition: attachment;filename="$self->{conf}{CURRENTEDIT}"\n\n`;    return \$self->{conf}{EDITDATA};}1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?