in reply to Telling require "I've handled it"

As I understand the require-docs, returning undef as first parameter will automatically lead to continuation of @INC inspection:

If an empty list, undef, or nothing that matches the first 3 values above is returned, then require looks at the remaining elements of @INC

You should either give it a file handle as first parameter, or no first parameter at all

Replies are listed 'Best First'.
Re^2: Telling require "I've handled it"
by dsheroh (Monsignor) on Nov 01, 2010 at 10:22 UTC
    Please expand on how you would go about returning a second parameter with "no first parameter at all". As far as I can tell, (undef, ...) is identical to (but more convenient than) creating an empty array and setting its second element while leaving the first untouched:
    #!/usr/bin/env perl use Data::Dumper; my @a1 = (undef, 'second'); my @a2; @a2[1] = 'second'; print Dumper(\@a1, \@a2); __END__ Outputs: $VAR1 = [ undef, 'second' ]; $VAR2 = [ undef, 'second' ];
      Ah yes, I should have been more exact. What I meant was giving the subroutine pointer as first parameter, leaving out the nominal first paramter, the filehandle, completely. In other words no undef at all and the subroutine reference is promoted to first parameter.