Leser: 6
|< 1 2 3 4 ... 6 >| | 54 Einträge, 6 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use warnings; use HTML::Template::Compiled; # musst du wahrscheinlich noch installieren my @files = qw(file1 file2); # wird bei Dir durch File::Find gefuellt my $content = do{ local $/; <DATA> }; my $tmpl = HTML::Template::Compiled->new( scalarref => \$content ); my @links = map{ {HREF => $_, TITLE => $_ } }@files; $tmpl->param( LINKS => \@links ); print $tmpl->output; __DATA__ <html> <body> <ul> <%LOOP LINKS %><li><a href="<%= HREF ESCAPE=URL %>"><%= TITLE ESCAPE=HTML %></a></li> <%/LOOP %> </ul> </body> </html>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#! /usr/bin/perl -w eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell use strict; use File::Find (); # Set the variable $File::Find::dont_use_nlink if you're using AFS, # since AFS cheats. # for the convenience of &wanted calls, including -eval statements: use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; sub wanted; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, '.'); exit; sub wanted { /^.*\.pdf\z/s && print("$name\n"); }
my @files = qw(file1 file2);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/usr/bin/perl use strict; use warnings; use HTML::Template::Compiled; # musst du wahrscheinlich noch installieren use File::Find; my @files; find( \&wanted, '.' ); my $content = do{ local $/; <DATA> }; my $tmpl = HTML::Template::Compiled->new( scalarref => \$content ); my @links = map{ {HREF => $_, TITLE => $_ } }@files; $tmpl->param( LINKS => \@links ); print $tmpl->output; sub wanted{ push @files, $_ if /\.pdf$/; } __DATA__ <html> <body> <ul> <%LOOP LINKS %><li><a href="<%= HREF ESCAPE=URL %>"><%= TITLE ESCAPE=HTML %></a></li> <%/LOOP %> </ul> </body> </html>
http://localhost/~user/skript.pl
use CGI;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#!/usr/bin/perl use strict; use warnings; use HTML::Template::Compiled; # musst du wahrscheinlich noch installieren use File::Find; use CGI; my @files; find( \&wanted, '.' ); my $cgih = new CGI; print $cgih->header(); my $content = do{ local $/; <DATA> }; my $tmpl = HTML::Template::Compiled->new( scalarref => \$content ); my @links = map{ {HREF => $_, TITLE => $_ } }@files; $tmpl->param( LINKS => \@links ); print $tmpl->output; sub wanted{ push @files, $_ if /\.pdf$/; } __DATA__ <html> <body> <ul> <%LOOP LINKS %><li><a href="<%= HREF ESCAPE=URL %>"><%= TITLE ESCAPE=HTML %></a></li> <%/LOOP %> </ul> </body> </html>
http://localhost/~user/skript.pl
|< 1 2 3 4 ... 6 >| | 54 Einträge, 6 Seiten |