| 1 | package File::Catalog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.010; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings FATAL => 'all'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Cwd qw(abs_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use File::Basename qw(dirname basename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Fcntl ':mode'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Digest::MD5::File qw(file_md5_hex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Log::Log4perl qw(:easy); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Term::ProgressBar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use UI::Dialog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Data::Dumper qw(Dumper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use File::Catalog::Env qw(nom_local); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use File::Catalog::DB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 NAME | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | File::Catalog - The great new File::Catalog! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | Version 0.003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | our $VERSION = '0.003'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # timeout pour operations systeme | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | #my $timeout_court = 30; # secondes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | #my $timeout_long = 300; # secondes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # repertoires ignores | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | my @exclusions_rep = qw(.git .svn CVS _no_ktl RECYCLER $RECYCLE.BIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | my @exclusions_fic = qw(Thumbs.db sync.ffs_db); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | =head1 SYNOPSIS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Quick summary of what the module does. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Perhaps a little code snippet. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | use File::Catalog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | my $foo = File::Catalog->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =head1 EXPORT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | A list of functions that can be exported. You can delete this section | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | if you don't export anything, such as for a purely object-oriented module. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | =head1 SUBROUTINES/METHODS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head2 initialiser | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub initialiser { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initialiser: not called CC=17 SCAR=57.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my ($class, %options) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $self = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | bless $self, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->{i} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->{moi} = basename($0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # init log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | my $opt_debug = (exists $options{debug}) ? $options{debug} : undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | Log::Log4perl->easy_init(($opt_debug) ? $DEBUG : $INFO); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | DEBUG "debug: ON"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # taille max en kio pour calcul md5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # (juste plus grand qu'une photo) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->{no_md5} = (exists $options{no_md5}) ? $options{no_md5} : 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $self->{taille_limite_md5} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | (exists $options{taille_limite_md5}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ? $options{taille_limite_md5} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | : 1024 * 10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # rep tmp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | $self->{tmp} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | (exists $options{tmp} and defined $options{tmp}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ? $options{tmp} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | : File::Catalog::Env::tmp(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $options{"tmp"} and defined $options{"tmp"}
MC/DC0%0/2
exists $options{"tmp"} and defined $options{"tmp"}
exists $options{"tmp"}
defined $options{"tmp"}
Truth table0%0/3
A and B
A= exists $options{"tmp"}B= defined $options{"tmp"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | DEBUG "tmp: $self->{tmp}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # archives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $self->{archives} = (exists $options{archives}) ? $options{archives} : 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | DEBUG "archives: $self->{archives}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ($self->{archives}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # saisie du mot de passe si besoin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | my $opt_pwd = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | (exists $options{password}) ? $options{password} : undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (defined($opt_pwd) and !$opt_pwd) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $opt_pwd and not $opt_pwd
MC/DC0%0/2
defined $opt_pwd and not $opt_pwd
defined $opt_pwd
not $opt_pwd
Truth table0%0/3
A and not(B)
A= defined $opt_pwdB= not $opt_pwd
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | my $d = new UI::Dialog( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | backtitle => $self->{moi}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | title => 'Mot de passe' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $opt_pwd = $d->password(text => 'Tu peux taper ton mot de passe. Je ne regarde pas...'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->{password} = $opt_pwd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | DEBUG "password: $self->{password}" if $opt_pwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # 7zip | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->{exe7z} = File::Catalog::Env::exe7z(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $self->{opt7z} = (defined $opt_pwd) ? "-p$opt_pwd" : ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | DEBUG "exe7z: $self->{exe7z}" if $opt_pwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # bd par defaut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #my $serveur = File::Catalog::Env::serveur(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my $fic_bd = (exists $options{bd}) ? $options{bd} : undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | $fic_bd = ".ktl.sqlite" unless defined $fic_bd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{fic_bd} = $fic_bd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | DEBUG "fic_bd: $self->{fic_bd}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $self->{db} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | File::Catalog::DB->connect($self->{fic_bd}, $options{extension}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # contexte archive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->{ctx_arch} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # retour | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | =head2 terminer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # fermeture | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub terminer { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminer: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{db}->disconnect(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | =head2 parcourir_repertoire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # parcours | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub parcourir_repertoire { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parcourir_repertoire: not called CC=5 SCAR=34.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my ($self, $repertoire, $volume) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $err = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # volume courant | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if (!defined $volume) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | chomp($volume = `df -P $repertoire | tail -n 1`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $volume =~ s|.+%\s+||; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # (re)initialisation de la liste des fichiers catalogues | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $self->{repficcat} = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | DEBUG "$volume: $repertoire"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # listage repertoire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if (opendir my $fh_rep, $repertoire) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my @lst_fic = grep { !/^\.\.?$/ } readdir $fh_rep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | closedir $fh_rep or die "Pb fermeture repertoire $repertoire !\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # analyse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | foreach my $entree (@lst_fic) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $err = $self->analyser_entree("$repertoire/$entree", $volume); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | WARN "Echec ouverture repertoire $repertoire !\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | =head2 analyser_entree | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # analyse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub analyser_entree { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
analyser_entree: not called CC=27 SCAR=66.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my ($self, $entree, $volume, $force_archive) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $rep_tmp = $self->{tmp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | (my $repfic = $entree) =~ s|^$rep_tmp/||; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $rep = dirname $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $fic = basename $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | return 0 if $fic ~~ @exclusions_fic; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $archive = ($fic =~ /\.(gz|tar|tgz|zip|bz2|tbz2|7z)$/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my @stat = lstat $entree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $inode = $stat[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $volinode = "$volume/$inode"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $rows; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $err = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | #--- table Fichier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | $rows = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $self->{db}->execute('lister_volinodes', $repfic)->fetchall_arrayref(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if (my $row = shift @$rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # si maj volinode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | if ($row->[0] ne $volinode) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # maj table Fichier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $self->{db}->execute('updateF', $volinode, $repfic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | push @{ $self->{repficcat} }, $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | DEBUG "$repfic deja vu"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # insertion table Fichier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | DEBUG "insertF: " . $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my @autres_infos = $self->{db}->{trigger}->($fic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $ok_trigger = shift @autres_infos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($ok_trigger) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $self->{db}->execute('insertF', $repfic, $rep, $fic, $volinode, @autres_infos); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | push @{ $self->{repficcat} }, $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $volinode = undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | #--- table Inode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $md5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $majmd5 = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if ($volinode) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $rows = $self->{db}->execute('lire_volinode', $volinode)->fetchall_arrayref(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if (my $row = shift @$rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # si maj infos | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | if ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$row->[3] != $stat[2] or $row->[4] != $stat[7] or $row->[6] != $stat[9] or $row->[7] != $stat[10]
$row->[3] != $stat[2] or $row->[4] != $stat[7] or $row->[6] != $stat[9]
$row->[3] != $stat[2] or $row->[4] != $stat[7]
MC/DC0%0/4
$row->[3] != $stat[2] or $row->[4] != $stat[7] or $row->[6] != $stat[9] or $row->[7] != $stat[10]
$row->[3] != $stat[2]
$row->[4] != $stat[7]
$row->[6] != $stat[9]
$row->[7] != $stat[10]
Truth table0%0/5
A or B or C or D
A= $row->[3] != $stat[2]B= $row->[4] != $stat[7]C= $row->[6] != $stat[9]D= $row->[7] != $stat[10]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | $row->[3] != $stat[2] # mode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | or $row->[4] != $stat[7] # taille | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | #or $row->[5] != $stat[8] # acces | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | or $row->[6] != $stat[9] # modif | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | or $row->[7] != $stat[10] # creation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $old_md5 = $row->[8]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # maj table Inode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | $md5 = $self->md5sum($entree, \@stat) unless $self->{no_md5}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | $self->{db} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ->execute("updateI", $stat[2], $stat[7], $stat[8], $stat[9], $stat[10], $archive, $md5, $volinode); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | $majmd5 = (defined $md5 and ($old_md5 ne $md5)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $md5 && $old_md5 ne $md5
MC/DC0%0/2
defined $md5 && $old_md5 ne $md5
defined $md5
$old_md5 ne $md5
Truth table0%0/3
A && B
A= defined $md5B= $old_md5 ne $md5
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | DEBUG "majmd5: " . $majmd5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | DEBUG "inode $inode deja vu"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # insertion table Inode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $md5 = $self->md5sum($entree, \@stat) unless $self->{no_md5}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | DEBUG "insertI: " . $volinode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | $self->{db}->execute( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | 'insertI', $volinode, $volume, $inode, $stat[2], $stat[7], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $stat[8], $stat[9], $stat[10], $archive, $md5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $majmd5 = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | #--- progression | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ( S_ISREG($stat[2]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
S_ISREG($stat[2]) and defined $self->{"barre"} and not $self->{"ctx_arch"}
S_ISREG($stat[2]) and defined $self->{"barre"}
MC/DC0%0/3
S_ISREG($stat[2]) and defined $self->{"barre"} and not $self->{"ctx_arch"}
S_ISREG($stat[2])
defined $self->{"barre"}
not $self->{"ctx_arch"}
Truth table0%0/4
A and B and not(C)
A= S_ISREG($stat[2])B= defined $self->{"barre"}C= not $self->{"ctx_arch"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | and defined($self->{barre}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | and !$self->{ctx_arch}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $self->{barre}->update(++$self->{nbfic}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | #--- archive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if ($md5 and ($self->{archives} or $force_archive) and $archive) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$md5 and $self->{"archives"} || $force_archive and $archive
$md5 and $self->{"archives"} || $force_archive
$self->{"archives"} or $force_archive
MC/DC0%0/4
$md5 and $self->{"archives"} || $force_archive and $archive
$md5
$self->{"archives"}
$force_archive
$archive
Truth table0%0/6
A and B or C and D
A= $md5B= $self->{"archives"}C= $force_archiveD= $archive
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | DEBUG "archive: " . $md5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # nb occurrences md5sum | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my $count = $self->{db}->nb_occurrences_md5sum($md5); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | DEBUG "count = $count"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if ($count > 1 or !$majmd5) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$count > 1 or not $majmd5
MC/DC0%0/2
$count > 1 or not $majmd5
$count > 1
not $majmd5
Truth table0%0/3
A or not(B)
A= $count > 1B= not $majmd5
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | DEBUG "archive $fic deja analysee"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | #INFO "analyse archive $fic"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | #DEBUG "timeout: $timeout_court"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | #ZZZ essayer de trouver la taille necessaire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | #ZZZ pour eviter de saturer l'espace temporaire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | #my $err = timeout $timeout_court => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my $entree7z = nom_local($entree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $cmd = "$self->{exe7z} $self->{opt7z} t \"$entree7z\" > $rep_tmp/$md5.log 2>&1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $err = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | #}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | #if ($@) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | #WARN "[PB] test timed-out : $entree"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | #$err = 5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | #} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | if ($err) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | WARN "[PB] archive non reconnue ($err) : $entree"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my @log = `cat $rep_tmp/$md5.log`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | foreach (@log) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ERROR $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $err = $self->analyser_archive($entree, $md5); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # fin si repertoire exclu | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | return $err if $fic ~~ @exclusions_rep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # repertoire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | $err = $self->parcourir_repertoire($entree, $volume) if S_ISDIR $stat[2]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | return $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | =head2 lister_resultat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # liste des fichiers catalogues | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # par la commande precedente | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub lister_resultat { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lister_resultat: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return $self->{repficcat}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | =head2 analyser_archive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | sub analyser_archive { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
analyser_archive: not called CC=10 SCAR=47.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my ($self, $archive, $md5) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $err = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # debut contexte archive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $self->{ctx_arch}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # md5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if (!$md5) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my @stat = lstat $archive; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $md5 = $self->md5sum($archive, \@stat); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # tar, zip, bz2, 7z : 7za x -o{Directory} + rm -rf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # tgz, tar.gz : gunzip -c + 7za x -o{Directory} + rm -rf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # tbz2, tar.bz2 : bunzip2 -c + 7za x -o{Directory} + rm -rf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $archive7z = nom_local($archive); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $rep_tmp = $self->{tmp}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $reptmp = "$rep_tmp/$md5"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $reptmp7z = nom_local($reptmp); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | #INFO "analyse sous $reptmp"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # extraction | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if ($archive =~ /\.(tar\.gz|tgz|tar\.bz2|tbz2)$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # cas d'une archive (b|g)zippee | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | my $dec = ($archive =~ /\.t?gz$/) ? "gunzip" : "bunzip2"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my $cmd = "$dec -c \"$archive\" > $reptmp.tar 2>$reptmp.log"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $err = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if ($err) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ERROR "[PB] gunzip ($err) : $archive"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # extraction avec tar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | mkdir $reptmp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $cmd = "tar xf $reptmp7z.tar -C $reptmp7z > $reptmp.log 2>&1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $err = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # extraction avec 7zip | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $cmd = "$self->{exe7z} $self->{opt7z} x -y -o\"$reptmp7z\" \"$archive7z\" > $reptmp.log 2>&1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $err = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if (!-d $reptmp) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # cas reptmp inexistant | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ERROR "[PB] repertoire $reptmp inexistant ($archive) !"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | if ($err or !-d $reptmp) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err or not -d $reptmp
MC/DC0%0/2
$err or not -d $reptmp
$err
not -d $reptmp
Truth table0%0/3
A or not(B)
A= $errB= not -d $reptmp
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # affichage du log en cas d'erreur | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ERROR "[PB] extraction archive ($err) : $archive"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my @log = `cat $reptmp.log`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | foreach (@log) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ERROR $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # parcours de l'arborescence temporaire | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $self->parcourir_repertoire($reptmp, $md5); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # nettoyage | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my $cmd = "rm -rf $reptmp*"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $cr = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # fin contexte archive | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $self->{ctx_arch}--; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # retour | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | return $err || $cr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$err || $cr
MC/DC0%0/2
$err || $cr
$err
$cr
Truth table0%0/3
A || B
A= $errB= $cr
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | =head2 purger_entree | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # purge d'une entree du catalogue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # les fichiers et leur inode sont supprimes du catalogue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # les fichiers ne sont pas supprimes du disque | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # on n'accede a aucun moment au disque | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub purger_entree { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
purger_entree: not called CC=5 SCAR=34.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my ($self, $entree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | DEBUG "purge: $entree"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # recherche de l'entree dans le catalogue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | my $lst = $self->{db}->lister_fichiers($entree); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | foreach my $elt (@$lst) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my ($md5sum, $type, $repfic) = @{$elt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | # volinode de ce repfic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | my ($volinode, $archive) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | @{ $self->{db}->lire_volinode_archive($repfic) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | # nombre de fichiers supplementaires pour ce volinode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $nbfic = $self->{db}->nb_occurrences_volinode($volinode) - 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | DEBUG sprintf "autres occurrences de ce fichier = %d", $nbfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # si nbfic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | if ($nbfic) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | INFO sprintf("%s ! reste %d occurrence%s de ce fichier", $md5sum, $nbfic, ($nbfic > 1) ? "s" : ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # alors supprimer enregistrement table Inode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | DEBUG "deleteI: " . $volinode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | $self->{db}->execute('deleteI', $volinode); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # delete repfic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # supprimer enregistrement table Fichier | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | DEBUG "deleteF: " . $repfic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $self->{db}->execute('deleteF', $repfic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # progression | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | if (defined $self->{barre}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $self->{barre}->update(++$self->{nbfic}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # archive : TODO ... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | =head2 md5sum | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # calcul du md5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | sub md5sum { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
md5sum: not called CC=4 SCAR=30.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my ($self, $fic, $refStat) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if (!$refStat) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my @stat = lstat($fic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $refStat = \@stat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | my $md5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | if (S_ISREG $refStat->[2]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | if ($refStat->[7] < $self->{taille_limite_md5} * 1024) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # taille inferieure a la limite | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | $md5 = file_md5_hex($fic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # taille bornee a la limite | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | my $tmp = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $self->{tmp} . "/" . $self->{moi} . "_" . $$ . "_" . $self->{i}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $cmd = "dd if=\"$fic\" of=$tmp bs=1024 count=$self->{taille_limite_md5} 2>/dev/null"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | DEBUG $cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $err = system($cmd) >> 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $md5 = file_md5_hex($tmp); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | unlink $tmp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | return $md5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | =head1 AUTHOR | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | Patrick Hingrez, C<< <info-perl at phiz.fr> >> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | =head1 BUGS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | Please report any bugs or feature requests to C<bug-file-catalog at rt.cpan.org>, or through | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Catalog>. I will be notified, and then you'll | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | automatically be notified of progress on your bug as I make changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | =head1 SUPPORT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | You can find documentation for this module with the perldoc command. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | perldoc File::Catalog | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | You can also look for information at: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | =over 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | =item * RT: CPAN's request tracker (report bugs here) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Catalog> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | =item * AnnoCPAN: Annotated CPAN documentation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | L<http://annocpan.org/dist/File-Catalog> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | =item * CPAN Ratings | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | L<http://cpanratings.perl.org/d/File-Catalog> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | =item * Search CPAN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | L<http://search.cpan.org/dist/File-Catalog/> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | =back | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | =head1 ACKNOWLEDGEMENTS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | =head1 LICENSE AND COPYRIGHT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | Copyright 2015 Patrick Hingrez. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | This program is free software; you can redistribute it and/or modify it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | under the terms of the the Artistic License (2.0). You may obtain a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | copy of the full license at: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | L<http://www.perlfoundation.org/artistic_license_2_0> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | Any use, modification, and distribution of the Standard or Modified | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | Versions is governed by this Artistic License. By using, modifying or | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | distributing the Package, you accept this license. Do not use, modify, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | or distribute the Package, if you do not accept this license. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | If your Modified Version has been derived from a Modified Version made | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | by someone other than you, you are nevertheless required to ensure that | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | your Modified Version complies with the requirements of this license. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | This license does not grant you the right to use any trademark, service | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | mark, tradename, or logo of the Copyright Holder. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | This license includes the non-exclusive, worldwide, free-of-charge | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | patent license to make, have made, use, offer to sell, sell, import and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | otherwise transfer the Package with respect to any patent claims | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | licensable by the Copyright Holder that are necessarily infringed by the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | Package. If you institute patent litigation (including a cross-claim or | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | counterclaim) against any party alleging that the Package constitutes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | direct or contributory patent infringement, then this Artistic License | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | to you shall terminate on the date that such litigation is filed. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 2 | 1; # End of File::Catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||