2 package Locale::Maketext::GutsLoader;
4 sub zorp { return scalar @_ }
7 $Locale::Maketext::GutsLoader::GUTSPATH = __FILE__;
8 *Locale::Maketext::DEBUG = sub () {0}
9 unless defined &Locale::Maketext::DEBUG;
13 # This whole drama is so that we can load the utf8'd code
14 # in Locale::Maketext::Guts, but if that fails, snip the
15 # utf8 and then try THAT.
18 $Locale::Maketext::GUTSPATH = '';
19 Locale::Maketext::DEBUG and print "Requiring Locale::Maketext::Guts...\n";
20 eval 'require Locale::Maketext::Guts';
23 my $path = $Locale::Maketext::GUTSPATH;
25 die "Can't load Locale::Maketext::Guts\nAborting" unless $path;
27 die "No readable file $Locale::Maketext::GutsLoader::GUTSPATH\nAborting"
28 unless -e $path and -f _ and -r _;
30 open(IN, $path) or die "Can't read-open $path\nAborting";
33 { local $/; $source = <IN>; }
35 unless( $source =~ s/\b(use utf8)/# $1/ ) {
36 Locale::Maketext::DEBUG and
37 print "I didn't see 'use utf8' in $path\n";
40 die "Can't compile $path\n...The error I got was:\n$@\nAborting" if $@;
41 Locale::Maketext::DEBUG and print "Non-utf8'd Locale::Maketext::Guts fine\n";
43 Locale::Maketext::DEBUG and print "Loaded Locale::Maketext::Guts fine\n";