?? fig11_10.pl
字號(hào):
#!perl
# Fig 11.10: fig11_10.pl
# Website update-page creator
use strict;
use warnings;
use CGI qw( :standard );
our $indent = "|" . ( " " x 5 );
our $root = "I:/Apache/cgi-bin/"; #"C:/Program Files/Apache Group/Apache/cgi-bin/"; # our $root = "/Inetpub/wwwRoot/";
chdir( $root );
our @colors = qw( red orange green );
our @fileTypes = qw( html perl dir );
print( header(), start_html( -title => 'Update Page' ),
'<font size = "+1">' );
print( "$root:<br/>\n" );
search( "", 1 );
print( "</font>" );
print( end_html() );
sub search
{
my ( $directory, $offset ) = @_;
opendir( DIR, $root . $directory )
or die( "Error opening : $!" );
foreach ( readdir( DIR ) ) {
my $file = $directory . $_;
printFile( 0, $file, $_, $offset ) if ( m/\.html/ );
printFile( 1, $file, $_, $offset ) if ( m/\.pl/ );
if ( -d $file && /[A-Za-z]/ ) {
printFile( 2, $file, $_ . '/', $offset );
search( $file . '/', $offset + 1 );
print( "$indent" ) for ( 2 .. $offset );
print( br(), "\n" );
next;
}
}
}
sub printFile
{
my ( $type, $file, $name, $offset ) = @_;
my $full = $root . $file;
print( "$indent" ) for ( 2 .. $offset );
print( "|----" );
my $color = $colors[ $type ];
my $extension = $fileTypes[ $type ];
print( "<font color = \"$color\">$extension: " );
print( "$_</font>\n" );
print( em( strong( "brand" ) ) ) if ( -M $full < 7 );
print( strong( "new!" ), "\n" ) if ( -M $full < 30 );
print( br(), "\n" );
}
###########################################################################
# (C) Copyright 2001 by Deitel & Associates, Inc. and Prentice Hall. #
# All Rights Reserved. #
# #
# DISCLAIMER: The authors and publisher of this book have used their #
# best efforts in preparing the book. These efforts include the #
# development, research, and testing of the theories and programs #
# to determine their effectiveness. The authors and publisher make #
# no warranty of any kind, expressed or implied, with regard to these #
# programs or to the documentation contained in these books. The authors #
# and publisher shall not be liable in any event for incidental or #
# consequential damages in connection with, or arising out of, the #
# furnishing, performance, or use of these programs. #
###########################################################################
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -