P
Peter Michael
Hi,
can anyone please explain to me why subroutines resulting
from constants imported with Exporter are not considered
to be defined?
perl -MFcntl -le 'print &F_SETLK'
shows that a subroutine F_SETLK can be called. But
perl -MFcntl -le 'print "defined" if defined &F_SETLK'
shows that it is not considered to be defined.
The consequence is that a constant imported this way can
accidentely be overridden by a 'require "fcntl.ph"'. The
..ph contains (on Linux)
eval 'sub F_SETLK () {6;}' unless defined(&F_SETLK);
but &F_SETLK is not considered to be defined after the use()age
of Fcntl and is thus overridden.
Thanks for any explanations.
Peter
can anyone please explain to me why subroutines resulting
from constants imported with Exporter are not considered
to be defined?
perl -MFcntl -le 'print &F_SETLK'
shows that a subroutine F_SETLK can be called. But
perl -MFcntl -le 'print "defined" if defined &F_SETLK'
shows that it is not considered to be defined.
The consequence is that a constant imported this way can
accidentely be overridden by a 'require "fcntl.ph"'. The
..ph contains (on Linux)
eval 'sub F_SETLK () {6;}' unless defined(&F_SETLK);
but &F_SETLK is not considered to be defined after the use()age
of Fcntl and is thus overridden.
Thanks for any explanations.
Peter