root/branches/release-40/extlib/Locale/Maketext/GutsLoader.pm @ 2594

Revision 2594, 1.3 kB (checked in by fumiakiy, 18 months ago)

Updating I18N::LangTags to version 0.35 and Locale::MakeText to version 1.13 for better support of Perl 5.10. BugId:80126

Line 
1package Locale::Maketext::GutsLoader;
2
3$VERSION = '1.13';
4
5use strict;
6sub zorp { return scalar @_ }
7
8BEGIN {
9    $Locale::Maketext::GutsLoader::GUTSPATH = __FILE__;
10    *Locale::Maketext::DEBUG = sub () {0}
11    unless defined &Locale::Maketext::DEBUG;
12}
13
14#
15# This whole drama is so that we can load the utf8'd code
16# in Locale::Maketext::Guts, but if that fails, snip the
17# utf8 and then try THAT.
18#
19
20$Locale::Maketext::GUTSPATH = '';
21Locale::Maketext::DEBUG and warn "Requiring Locale::Maketext::Guts...\n";
22eval 'require Locale::Maketext::Guts';
23
24if ($@) {
25    my $path = $Locale::Maketext::GUTSPATH;
26
27    die "Can't load Locale::Maketext::Guts\nAborting" unless $path;
28
29    die "No readable file $Locale::Maketext::GutsLoader::GUTSPATH\nAborting"
30    unless -e $path and -f _ and -r _;
31
32    open(IN, $path) or die "Can't read-open $path\nAborting";
33
34    my $source;
35    { local $/;  $source = <IN>; }
36    close(IN);
37    unless( $source =~ s/\b(use utf8)/# $1/ ) {
38        Locale::Maketext::DEBUG and
39        print "I didn't see 'use utf8' in $path\n";
40    }
41    eval $source;
42    die "Can't compile $path\n...The error I got was:\n$@\nAborting" if $@;
43    Locale::Maketext::DEBUG and warn "Non-utf8'd Locale::Maketext::Guts fine\n";
44}
45else {
46    Locale::Maketext::DEBUG and warn "Loaded Locale::Maketext::Guts fine\n";
47}
48
491;
Note: See TracBrowser for help on using the browser.