#!/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;