Thread Shell-Error durchs benutzen von `` (36 answers)
Opened by FlorianL at 2008-01-21 15:12

renee
 2008-01-23 13:36
#105046 #105046
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
aus
Code: (dl )
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
50: my @diff = <TMP>;
51:
52: sub calcdiff {
53: my $old = shift;
54: my $new = shift;
55: if ($new > $old) {
56: my $ergebniss_1 = ($new - $old);
57: return($ergebniss_1);
58: }
59: elsif ($old > $new) {
60: my $ergebniss_2 = ($old - $new);
61: return ($ergebniss_2);
62: }
63: }
64:
65: my @order;
66: while( my $line = @diff ){
67: if ( $line =~ m/^(.+):\s+\/.+:$/) {
68: push @order, [$1."\n"];
69: }
70: elsif ( $line =~ m/(^\d+)\s+(.+)\s+(.)\s+(\d+)\s+(.+)\s+$/ ) {
71: if ($3 eq "\|") {
72: push @{ $order[-1] },"\t$2\t$1\t$4\t" . "Diff: " . &calcdiff("$1","$4") . "\n";
73: }
74: elsif ($3 eq "\<") {
75: push @{ $order[-1] }, "\tNew File:\t$5\tSize: $4\n";
76: }
77: elsif ($3 eq "\>") {
78: push @{ $order[-1] },"\tFile deleted:\t$5\n";
79: }
80: }
81: }


mach
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
my @order;
while( my $line  = <TMP> ){
   if ( $line =~ m/^(.+):\s+\/.+:$/) {
      push @order, [$1."\n"];
   }
   elsif ( $line =~ m/(^\d+)\s+(.+)\s+(.)\s+(\d+)\s+(.+)\s+$/ ) {
      if ($3 eq "\|") {
         push @{ $order[-1] },"\t$2\t$1\t$4\t" . "Diff: " . abs($1 - $4) . "\n";
      }
      elsif ($3 eq "\<") {
         push @{ $order[-1] }, "\tNew File:\t$5\tSize: $4\n";
      }
      elsif ($3 eq "\>") {
         push @{ $order[-1] },"\tFile deleted:\t$5\n";
      }
   }
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Shell-Error durchs benutzen von ``