|< 1 2 >| | 16 Einträge, 2 Seiten |
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
sub work_with_tmp_line { my ($message) = @_; if ( $message =~ /socketException/ ) { return 'NullPointerException'; } elsif ( $message =~ /ArrayIndexOutOfBoundsException/ ) { return 'ArrayIndexOutOfBoundsException'; } elsif ( $message =~ /NullPointerException/ ) { return 'NullPointerException'; } elsif ( $message =~ /LockedPinException/ ) { return 'LockedPinException'; } elsif ( $message =~ /AuthenticationException/ ) { return 'AuthenticationException'; } elsif ( $message =~ /BusinessServiceException/ ) { return 'BusinessServiceException'; } elsif ( $message =~ /IllegalStateException/ ) { return 'IllegalStateException'; } elsif ( $message =~ /NumberFormatException/ ) { return 'NumberFormatException'; } elsif ( $message =~ /Exception/ ) { return 'Exception'; } elsif ( $message =~ /NoSuchElementException/ ) { return 'NoSuchElementException'; } elsif ( $message =~ /RemoteException/ ) { return 'RemoteException'; } elsif ( $message =~ /SQLException/ ) { return 'SQLException'; } elsif ( $message =~ /IOException/ ) { return 'IOException'; } elsif ( $message =~ /FileNotFoundException/ ) { return 'FileNotFoundException'; } else { return 'No Exception'; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
my @strings = qw ( abc def der ); my $string = join ("|", @strings); my $test = "defined"; if ($test =~ m/$string/i){ print "GEFUNDEN! ($&)\a\a\a\a"; } <>;
1 2 3 4 5
sub work_with_tmp_line { my ($message) = @_; $message =~ /(\w+)(Exception)/ and return "$1$2"; return 'No Exception'; }
1 2 3
sub work_with_tmp_line { return (shift() =~ /(\w+Exception)/)?$1:'No Exception'; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
sub work_with_tmp_line { my $typ=join('|',qw(socket ArrayIndexOutOfBounds NullPointer LockedPin Authentication BusinessService IllegalState NumberFormat NoSuchElement Remote SQL IO FileNotFound)); return (shift() =~ /((?:$typ)?Exception)/)?$1:'No Exception'; }
1 2 3
sub work_with_tmp_line { return (shift() =~ /(\w*Exception)/)?$1:'No Exception'; }
mr-sansibar+2008-01-03 21:02:16--Code (perl): (dl )1 2 3 4 5 6 7 8 9 10 11 12sub work_with_tmp_line { my ($message) = @_; if ( $message =~ /socketException/ ) { return 'NullPointerException'; } ... elsif ( $message =~ /Exception/ ) { return 'Exception'; } ... }
#Kein Kommentar+2008-01-03 21:26:08--du könntest die meldungen alle einem array speichern, macht das dann alles wartbarer.
kleines beispiel:
Code (perl): (dl )1 2 3 4 5 6 7 8 9 10 11 12 13 14my @strings = qw ( abc def der ); my $string = join ("|", @strings); my $test = "defined"; if ($test =~ m/$string/i){ print "GEFUNDEN! ($&)\a\a\a\a"; } <>;
my $ENDE_mit_einem_Return_schliesst_das_skript = <STDIN>;
|< 1 2 >| | 16 Einträge, 2 Seiten |