7 Einträge, 1 Seite |
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main;
use strict;
use Data::Dumper;
open F, "<dirs" || die qq($!);
my @builds = <F>;
close F;
foreach my $dir (@builds)
{
chomp $dir;
my $build = MyPackage->new($dir);
print Dumper($build);
$build->scan_resultfiles();
print Dumper($build);
}
package MyPackage;
use strict;
use File::Basename;
use File::Spec;
use Cwd;
sub new
{
my $proto = shift;
my $class = ref ($proto) || $proto;
my $ptr = {};
bless ($ptr, $class);
$ptr->init(@_);
return $ptr;
}
sub init($$)
{
my ($this, $path) = @_;
$this->{root} = $path;
opendir DIR, File::Spec->catdir($path, qw(lint\msg));
@{$this->{errorfiles}->{lint}} = grep /\.txt$/, readdir DIR;
closedir DIR;
}
sub scan_resultfiles($)
{
my $this = shift;
foreach (@{$this->{errorfiles}->{lint}})
{
$this->parse_file(File::Spec->catfile(File::Spec->catdir($this->{root}, qw(lint\msg)), $_));
}
}
sub parse_file($$)
{
my ($this, $errfile) = @_;
open FILE, "<$errfile" || die qq($!);
while (<FILE>)
{
chomp;
# ...
}
close FILE;
}
1;
1
2
3
4
5
6
7
8
9
10
11
12
13
...
sub scan_resultfiles($)
{
my $this = shift;
foreach my $entry (@{$this->{errorfiles}->{lint}})
{
$this->parse_file(File::Spec->catfile(File::Spec->catdir($this->{root}, qw(lint\msg)), $entry));
}
}
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;
use Data::Dumper;
my @list = qw/uhu1 uhu2 uhu3/;
print Dumper(\@list);
foreach (@list) { foo($_); }
print Dumper(\@list);
sub foo {
while (<DATA>) {
print "$_";
}
}
__DATA__
hutzel
putzel
ultimo
1
2
3
4
5
6
7
8
use Data::Dumper;
my @list = qw/uhu1 uhu2 uhu3/;
print Dumper(\@list);
foreach (@list) { foo($_); }
print Dumper(\@list);
sub foo { $_ = undef; }
1
2
3
4
5
6
7
8
use Data::Dumper;
my @list = qw/uhu1 uhu2 uhu3/;
print Dumper(\@list);
foreach (@list) { foo($_); }
print Dumper(\@list);
sub foo { local $_; $_ = undef; }
7 Einträge, 1 Seite |