Subject: | Patch for the hack with __FILE__ in Language.pm |
Date: | Thu, 26 Apr 2007 22:10:36 +0200 |
To: | bug-Curses-UI [...] rt.cpan.org |
From: | fagga <fagga [...] gmx.de> |
Hello,
I had problems packaging a Curses::UI application into a PAR package,
because __FILE__ does resolves different depending on being inside a
PAR package or not.
I reported this as a bug in PAR and got, ironically, great help to
create a patch for Curses::UI::Language. It now uses the __PACKAGE__
literal instead of __FILE__ and works quite well for me. I added the
few diff lines to the end.
Greetings,
Benjamin
87,91c87,88
< # Create a filehandle to the __DATA__ section
< # of the language package.
< my $l_namespace = __PACKAGE__."::$lang";
< eval("require $l_namespace;") or die "Can't open $l_namespace: $!";
< local *LANG_DATA = $l_namespace."::DATA";
---
Show quoted text
> # Determine filename for the language package.
> (my $l_file = __FILE__) =~ s/\.pm$/\/$lang\.pm/;
95a93,101
Show quoted text> # Create a filehandle to the __DATA__ section
> # of the language package.
> local *LANG_DATA;
> open(LANG_DATA, "< $l_file") or die "Can't open $l_file: $!";
>
> while (<LANG_DATA>) {
> last if /^\s*__DATA__$/;
> }
>