line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DMOSS::Oracle; |
2
|
|
|
|
|
|
|
# ABSTRACT: DMOSS file type oracle |
3
|
|
|
|
|
|
|
$DMOSS::Oracle::VERSION = '0.01_2'; |
4
|
3
|
|
|
3
|
|
22632
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
108
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
2727
|
use MIME::Types; |
|
3
|
|
|
|
|
28970
|
|
|
3
|
|
|
|
|
2079
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
2
|
|
|
2
|
1
|
640
|
my ($class) = @_; |
11
|
2
|
|
|
|
|
6
|
my $self = bless({}, $class); |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
8
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub type { |
17
|
0
|
|
|
0
|
1
|
|
my ($self, $file) = @_; |
18
|
0
|
|
|
|
|
|
my $type = ''; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# first, filter by extension |
21
|
0
|
|
|
|
|
|
$type = $self->type_by_extension($file); |
22
|
0
|
0
|
|
|
|
|
return $type if $type; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# second, some hand made RE |
25
|
0
|
0
|
|
|
|
|
return 'README' if ($file->basename =~ m/^read.*?me$/i); |
26
|
0
|
0
|
|
|
|
|
return 'LICENSE' if ($file->basename =~ m/^licen.e$/i); |
27
|
0
|
0
|
|
|
|
|
return 'INSTALL' if ($file->basename =~ m/^install$/i); |
28
|
0
|
0
|
|
|
|
|
return 'MAN' if ($file->path =~ m/\/man\//i); |
29
|
0
|
0
|
|
|
|
|
return 'MAKEFILE' if ($file->basename =~ m/^makefile$/i); |
30
|
0
|
0
|
|
|
|
|
return 'TEXT' if ($file->basename =~ m/\.txt$/i); |
31
|
0
|
0
|
|
|
|
|
return 'CHANGES' if ($file->basename =~ m/^changes*(log)*$/i); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# third, try to return mime type |
34
|
0
|
|
|
|
|
|
my $types = MIME::Types->new; |
35
|
0
|
|
|
|
|
|
my $mime = $types->mimeTypeOf($file->fullpath); |
36
|
0
|
0
|
|
|
|
|
return $mime if $mime; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# no type found |
39
|
0
|
|
|
|
|
|
return undef; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $extensions = { |
43
|
|
|
|
|
|
|
'ANT' => [qw/build.xml/], |
44
|
|
|
|
|
|
|
'ASM' => [qw/asm ASM s S A51 29[kK] [68][68][kKsSxX] [xX][68][68]/], |
45
|
|
|
|
|
|
|
'ASP' => [qw/asp asa/], |
46
|
|
|
|
|
|
|
'AWK' => [qw/awk gawk mawk/], |
47
|
|
|
|
|
|
|
'BASIC' => [qw/bas bi bb pb/], |
48
|
|
|
|
|
|
|
'BETA' => [qw/bet/], |
49
|
|
|
|
|
|
|
'C' => [qw/c/], |
50
|
|
|
|
|
|
|
'C++' => [qw/c++ cc cp cpp cxx h h++ hh hp hpp hxx C H/], |
51
|
|
|
|
|
|
|
'C#' => [qw/cs/], |
52
|
|
|
|
|
|
|
'COBOL' => [qw/cbl cob CBL COB/], |
53
|
|
|
|
|
|
|
'DOSBATCH' => [qw/bat cmd/], |
54
|
|
|
|
|
|
|
'EIFFEL' => [qw/e/], |
55
|
|
|
|
|
|
|
'ERLANG' => [qw/erl ERL hrl HRL/], |
56
|
|
|
|
|
|
|
'FLEX' => [qw/as mxml/], |
57
|
|
|
|
|
|
|
'FORTRAN' => [qw/f for ftn f77 f90 f95 F FOR FTN F77 F90 F95/], |
58
|
|
|
|
|
|
|
'GO' => [qw/go/], |
59
|
|
|
|
|
|
|
'HTML' => [qw/htm html/], |
60
|
|
|
|
|
|
|
'JAVA' => [qw/java/], |
61
|
|
|
|
|
|
|
'JAVASCRIPT' => [qw/js/], |
62
|
|
|
|
|
|
|
'LISP' => [qw/cl clisp el l lisp lsp/], |
63
|
|
|
|
|
|
|
'LUA' => [qw/lua/], |
64
|
|
|
|
|
|
|
'MAKE' => [qw/mak mk [Mm]akefile GNUmakefile/], |
65
|
|
|
|
|
|
|
'MATLAB' => [qw/m/], |
66
|
|
|
|
|
|
|
'OBJECTIVEC' => [qw/m h/], |
67
|
|
|
|
|
|
|
'OCAML' => [qw/ml mli/], |
68
|
|
|
|
|
|
|
'PASCAL' => [qw/p pas/], |
69
|
|
|
|
|
|
|
'PERL' => [qw/pl pm plx perl/], |
70
|
|
|
|
|
|
|
'PHP' => [qw/php php3 phtml/], |
71
|
|
|
|
|
|
|
'PYTHON' => [qw/py pyx pxd pxi scons/], |
72
|
|
|
|
|
|
|
'REXX' => [qw/cmd rexx rx/], |
73
|
|
|
|
|
|
|
'RUBY' => [qw/rb ruby/], |
74
|
|
|
|
|
|
|
'SCHEME' => [qw/SCM SM sch scheme scm sm/], |
75
|
|
|
|
|
|
|
'SH' => [qw/sh SH bsh bash ksh zsh/], |
76
|
|
|
|
|
|
|
'SLANG' => [qw/sl/], |
77
|
|
|
|
|
|
|
'SML' => [qw/sml sig/], |
78
|
|
|
|
|
|
|
'SQL' => [qw/sql/], |
79
|
|
|
|
|
|
|
'TCL' => [qw/tcl tk wish itcl/], |
80
|
|
|
|
|
|
|
'TEX' => [qw/tex/], |
81
|
|
|
|
|
|
|
'VERA' => [qw/vr vri vrh/], |
82
|
|
|
|
|
|
|
'VERILOG' => [qw/v/], |
83
|
|
|
|
|
|
|
'VHDL' => [qw/vhdl vhd/], |
84
|
|
|
|
|
|
|
'VIM' => [qw/vim/], |
85
|
|
|
|
|
|
|
'YACC' => [qw/y/], |
86
|
|
|
|
|
|
|
}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub type_by_extension { |
89
|
0
|
|
|
0
|
0
|
|
my ($self, $file) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
foreach (keys %$extensions) { |
92
|
0
|
|
|
|
|
|
foreach my $re (@{ $extensions->{$_} }) { |
|
0
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
return $_ if ($file->basename =~ m/\.$re$/); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return undef; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub group { |
101
|
0
|
|
|
0
|
0
|
|
my ($self, $group) = @_; |
102
|
0
|
0
|
|
|
|
|
return () unless ($group =~ m/^_/); |
103
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
if ($group eq '_DOC') { |
105
|
0
|
|
|
|
|
|
return qw/README INSTALL MAN TEXT/; |
106
|
|
|
|
|
|
|
} |
107
|
0
|
0
|
|
|
|
|
if ($group eq '_OTHER') { |
108
|
0
|
|
|
|
|
|
return qw/LICENSE MAKEFILE CHANGES/; |
109
|
|
|
|
|
|
|
} |
110
|
0
|
0
|
|
|
|
|
if ($group eq '_SOURCE') { |
111
|
0
|
|
|
|
|
|
return (keys %$extensions); |
112
|
|
|
|
|
|
|
} |
113
|
0
|
0
|
|
|
|
|
if ($group eq '_ALL') { |
114
|
0
|
|
|
|
|
|
return ( $self->group('_DOC'), $self->group('_OTHER'), $self->group('_SOURCE') ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |