Leser: 3
![]() |
|< 1 2 3 >| | ![]() |
21 Einträge, 3 Seiten |
GwenDragon+2009-01-29 12:02:46--Unknown encoding 'charset-das-es-nicht-gibt' at X:\www\cgi-bin\script.pl line 10
burnersk+2009-01-29 12:56:46--Wenn ich croak weglasse steht die erste immer noch da!! Der Text der ersten Fehlermeldung (eigentlich $@) soll in das croak rein. Aber es ist in $@ nix drin.
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
$ cat Foo.pm
use strict;
use warnings;
package Foo;
use Carp qw/ croak /;
sub foo {
eval {
Baz::bar();
};
my $e = $@;
print "\$\@ = '$e'\n";
$e =~ s/(.*) at .*\n/$1/;
croak $e;
}
package Baz;
sub bar {
die "blubb";
}
1;
$ perl -wle'
use Foo;
Foo::foo();'
$@ = 'blubb at Foo.pm line 19.
'
blubb at -e line 3
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/perl
use strict;
use warnings;
use Encode;
eval{
encode('mein_utf','test');
};
print '$@ ist nicht leer' if $@;
burnersk+2009-01-29 13:12:25--2. Ich habe ein rep. Script gepostet und es funktioniert bei mir genau wie ich gesagt hatte - nicht wie gewollt. $@ ist leer!
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
package module; use strict; use warnings; use Carp qw( croak carp ); use Encode; sub new { my ( $class, @args ) = @_; my $self = {}; bless $self, ref( $class ) || $class; return $self; } sub foo { my ( $self ) = @_; if ( !eval { encode( 'utf-no', 'text' ) } ) { croak( "Laenge der Meldung: " . length($@), "\nMeldung: " . $@ ); } } 1;
1 2 3 4 5 6 7 8
#!/usr/bin/perl use strict; use warnings; use module; my $mod = module->new; $mod->foo();
1
2
3
Laenge der Meldung: 47
Meldung: Unknown encoding 'utf-no' at module.pm line 17
at script.pl line 8
![]() |
|< 1 2 3 >| | ![]() |
21 Einträge, 3 Seiten |