{ no warnings 'redefine'; sub compile_mode { *::_ = sub { i18n::String->new(@_) }; } sub run_mode { *::_ = sub { $i18n::Current_Lang->maketext(@_) }; } } BEGIN { compile_mode(); } #### sub i18n_require { my $original = my $path = shift; i18n::compile_mode(); $path=~s{::}{/}g; my $error; eval {require $path.'.pm'} or $error = $@ || 'Unknown error'; i18n::run_mode(); die( sprintf( "Error loading '%s' at %s line %d:\n%s\n", $original, (caller)[ 1, 2 ], $error ) ) if $error; return $INC{$path}; }