updated git and svn scripts
[xrzperl.git] / tucan-extract-log
blob3137ad56ba368dec709880b9afc56e48657c88a1
1 #!/usr/bin/perl -w
2 # $Id: script_template 17 2010-10-08 17:47:31Z xiaoranzzz $
3 use strict;
4 require v5.10.0;
5 our $VERSION = 'v0.1';
7 BEGIN
9 my $PROGRAM_DIR = $0;
10 $PROGRAM_DIR =~ s/[^\/\\]+$//;
11 $PROGRAM_DIR = "./" unless($PROGRAM_DIR);
12 unshift @INC,
13 map "$PROGRAM_DIR$_",qw{modules lib ../modules ..lib};
16 my %OPTS;
17 my @OPTIONS = qw/help|h|? version|ver edit-me manual|man/;
19 my @logfile;
20 if(@ARGV)
22 require Getopt::Long;
23 require MyPlace::Usage;
24 Getopt::Long::GetOptions(\%OPTS,@OPTIONS);
25 MyPlace::Usage::Process(\%OPTS,$VERSION);
26 @logfile = @ARGV;
28 else
30 @logfile = ( $ENV{HOME} . "/.tucan/tucan.log*");
33 my %URLS;
34 foreach(@logfile) {
35 #print STDERR "$_:\n";
36 foreach my $file (glob($_)) {
37 #print STDERR "\t$file\n";
38 if(-f $file) {
39 open FI,"<",$file or die("$!\n");
40 while(<FI>) {
41 chomp;
42 if(m/:\s+(http:\/\/[^\s]+)/) {
43 $URLS{$1} = 1;
46 close FI;
51 print join("\n",keys %URLS),"\n";
53 __END__
55 =pod
57 =head1 NAME
59 tucan-extract-log - PERL script
61 =head1 SYNOPSIS
63 tucan-extract-log [options] ...
65 =head1 OPTIONS
67 =over 12
69 =item B<--version>
71 Print version infomation.
73 =item B<-h>,B<--help>
75 Print a brief help message and exits.
77 =item B<--manual>,B<--man>
79 View application manual
81 =item B<--edit-me>
83 Invoke 'editor' against the source
85 =back
87 =head1 DESCRIPTION
89 ___DESC___
91 =head1 CHANGELOG
93 2010-10-26 xiaoranzzz <xiaoranzzz@myplace.hell>
95 * file created.
97 =head1 AUTHOR
99 xiaoranzzz <xiaoranzzz@myplace.hell>
101 =cut
103 # vim:filetype=perl