I have a couple files that are similar and I want them both to require
a third file in which I can keep the commonalities. The third file, however, needs to make use of the variables declared in the first two files. If I understand correctly, I should be able to declare them using our
in the first two files to be able to modify them in the third.
However, I don't even get that far. I don't seem to be able to require
correctly. It claims it "Can't locate" my relative path, even though it is relative to something in @INC that it lists immediately after. It even gives that error if I use an absolute path, which I'm not keen on anyway.
The file has the same permissions as its neighbours, and I can access it via the web browser (it doesn't print anything, but if I make it die() it dies properly, so I know Apache is able to access it, at least.) Nothing funny in the path: it matches =~ '^[0-9a-z_./]+$'
It's not a compile error because, in trying to debug this, I commented out everything besides the last line, which is the 1;
that require()
needs to succeed.
What might I be doing wrong?
Update per ikegami's request:
eval { require '../test/testform_common_source.pl' };
or
eval { require '/home/myappdev/test/testform_common_source.pl' };
both produce
Can't locate /home/myappdev/test/testform_common_source.pl in @INC (@INC contains: /home/myappdev/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd) at /home/myappdev/test/testform_step_2.pl line 75.
Update 2 per ikegami's request:
-rw-rw-r-- 1 chopper chopper 2090 Oct 28 12:34 testform_common_source.pl
-rw-rw-r-- 1 chopper chopper 5608 Oct 29 06:51 testform_step_2.pl