Thread Encode::encode in eval abfangen
(20 answers)
Opened by burnersk at 2009-01-29 12:03
module.pm
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #!/usr/bin/perl use strict; use warnings; package module; use Carp qw(carp croak); use Encode; sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; my $self = {}; bless($self, $class); return($self); } sub test { if (!eval { encode('charset-das-es-nicht-gibt', 'text') }) { croak($@); } } 1; script.pl Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 #!/usr/bin/perl -wT use strict; use warnings; use lib '.'; use module; my $module = new module; $module->test(); 1; Return Code: (dl
)
1 Unknown encoding 'charset-das-es-nicht-gibt' at module.pm line 18 |