ensure the default . is removed from @INC when attempting to load
optional modules:
- file format modules loaded by read(), write() etc and the
%formats tie code
- Affix::Infix2Postfix loaded by transform()
- Parse::RecDescent loaded by Imager::Expr
else {
local $SIG{__DIE__};
my $loaded = eval {
else {
local $SIG{__DIE__};
my $loaded = eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
++$attempted_to_load{$file};
require $file;
return 1;
++$attempted_to_load{$file};
require $file;
return 1;
if ( $opts{'xexpr'} and $opts{'yexpr'} ) {
if (!$I2P) {
if ( $opts{'xexpr'} and $opts{'yexpr'} ) {
if (!$I2P) {
- eval ("use Affix::Infix2Postfix;");
- print $@;
+ {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ eval ("use Affix::Infix2Postfix;");
+ }
+
if ( $@ ) {
$self->{ERRSTR}='transform: expr given and Affix::Infix2Postfix is not avaliable.';
return undef;
if ( $@ ) {
$self->{ERRSTR}='transform: expr given and Affix::Infix2Postfix is not avaliable.';
return undef;
# - something for Module::ScanDeps to analyze
# https://rt.cpan.org/Ticket/Display.html?id=6566
local $@;
# - something for Module::ScanDeps to analyze
# https://rt.cpan.org/Ticket/Display.html?id=6566
local $@;
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
eval { require Imager::File::GIF };
eval { require Imager::File::JPEG };
eval { require Imager::File::PNG };
eval { require Imager::File::GIF };
eval { require Imager::File::JPEG };
eval { require Imager::File::PNG };
use strict;
use vars qw($VERSION);
use strict;
use vars qw($VERSION);
@ISA = qw(Imager::Expr);
use Imager::Regops qw(%Attr $MaxOperands);
@ISA = qw(Imager::Expr);
use Imager::Regops qw(%Attr $MaxOperands);
-
-eval "use Parse::RecDescent;";
-__PACKAGE__->register_type('expr') if !$@;
+{
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ eval "use Parse::RecDescent;";
+ __PACKAGE__->register_type('expr') if !$@;
+}
# I really prefer bottom-up parsers
my $grammar = <<'GRAMMAR';
# I really prefer bottom-up parsers
my $grammar = <<'GRAMMAR';