line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################# |
2
|
|
|
|
|
|
|
## Name: InitLib.pm |
3
|
|
|
|
|
|
|
## Purpose: LibZip::InitLib |
4
|
|
|
|
|
|
|
## Author: Graciliano M. P. |
5
|
|
|
|
|
|
|
## Modified by: |
6
|
|
|
|
|
|
|
## Created: 2004-06-06 |
7
|
|
|
|
|
|
|
## RCS-ID: |
8
|
|
|
|
|
|
|
## Copyright: (c) 2004 Graciliano M. P. |
9
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or |
10
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself |
11
|
|
|
|
|
|
|
############################################################################# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package LibZip::CORE ; |
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
|
2
|
|
67
|
BEGIN { $INC{'LibZip/CORE.pm'} = 1 if !$INC{'LibZip/CORE.pm'} ;} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '0.01' ; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
11
|
no warnings ; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
1085
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
########## |
22
|
|
|
|
|
|
|
# IMPORT # |
23
|
|
|
|
|
|
|
########## |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub import { |
26
|
6
|
|
|
6
|
|
12
|
shift ; |
27
|
6
|
|
|
|
|
16
|
my $caller = caller ; |
28
|
6
|
|
|
|
|
15
|
my @EXPORT = qw(find_file save cat); |
29
|
6
|
|
|
|
|
10
|
my @exp = @_ ; |
30
|
6
|
50
|
|
|
|
24
|
if ( !@_ ) { @exp = @EXPORT ;} |
|
6
|
|
|
|
|
18
|
|
31
|
6
|
|
|
|
|
12
|
foreach my $exp_i ( @exp ) { *{"$caller\::$exp_i"} = \&{$exp_i} ;} |
|
18
|
|
|
|
|
22
|
|
|
18
|
|
|
|
|
9150
|
|
|
18
|
|
|
|
|
41
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
############# |
35
|
|
|
|
|
|
|
# FIND_FILE # |
36
|
|
|
|
|
|
|
############# |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub find_file { |
39
|
4
|
|
|
4
|
0
|
18
|
my ( $pack , @LIB ) = @_ ; |
40
|
4
|
|
|
|
|
7
|
my @pack_fl ; |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
12
|
foreach my $LIB_i ( @INC , @LIB ) { |
43
|
100
|
100
|
|
|
|
174
|
if ( ref($LIB_i) ) { next ;} |
|
8
|
|
|
|
|
14
|
|
44
|
92
|
|
|
|
|
154
|
my $fl = "$LIB_i/$pack" ; |
45
|
92
|
100
|
|
|
|
1867
|
if (-e $fl) { push(@pack_fl , $fl) ;} |
|
6
|
|
|
|
|
17
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
4
|
50
|
|
|
|
93
|
return( @pack_fl ) if wantarray ; |
49
|
4
|
|
|
|
|
22
|
return $pack_fl[0] ; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
######## |
53
|
|
|
|
|
|
|
# SAVE # |
54
|
|
|
|
|
|
|
######## |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub save { |
57
|
0
|
|
|
0
|
0
|
|
my $fh ; |
58
|
0
|
|
|
|
|
|
open ($fh,">$_[0]") ; binmode($fh) ; |
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
print $fh $_[1] ; |
60
|
0
|
|
|
|
|
|
close ($fh) ; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
####### |
64
|
|
|
|
|
|
|
# CAT # |
65
|
|
|
|
|
|
|
####### |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub cat { |
68
|
0
|
|
|
0
|
0
|
|
my ($fh , $buffer) ; |
69
|
0
|
|
|
|
|
|
open ($fh,$_[0]) ; binmode($fh) ; |
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
1 while( read($fh, $buffer , 1024*4 , length($buffer) ) ) ; |
71
|
0
|
|
|
|
|
|
close ($fh) ; |
72
|
0
|
|
|
|
|
|
return $buffer ; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
####### |
76
|
|
|
|
|
|
|
# END # |
77
|
|
|
|
|
|
|
####### |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|