Config::Pit をインストールしたときのメモ(/var のオプション=noexec)

FreeBSD で怒られたので,未来の自分用のメモ.
普通に cpan で入りそうなんだけど,test んとこで怒られた.

$ cpan
cpan> look Config::Pit
$ make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl5.8.9 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t
t/00_compile.t ........... ok
t/01_basic.t ............. 1/17 Can't exec "/tmp/WOgfi4_6jF.pl": Permission denied at /home/XXXX/.cpan/build/Config-Pit-0.04-s5n3Yw/blib/lib/Config/Pit.pm line 58.
Cannot read from /tmp/ONNoXn4rt7.pl: No such file or directory at /home/XXXX/perl5/lib/perl5/i386-freebsd-64int/YAML/Syck.pm line 126.
# Looks like you planned 17 tests but ran 15.
# Looks like your test exited with 2 just after 15.
t/01_basic.t ............. Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/17 subtests
t/02_interoperability.t .. ok

Test Summary Report
-------------------
t/01_basic.t           (Wstat: 512 Tests: 15 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 17 tests but ran 15.
Files=3, Tests=19,  1 wallclock secs ( 0.02 usr  0.05 sys +  0.31 cusr  0.44 csys =  0.81 CPU)
Result: FAIL
Failed 1/3 test programs. 0/19 subtests failed.
*** Error code 255

Stop in /home/XXXX/.cpan/build/Config-Pit-0.04-s5n3Yw.

よく考えてみたら,そもそも /tmp (-> /var/tmp) はオプションに noexec が付いていた.

$ ls -l /tmp
lrwxr-xr-x  1 root  wheel  8 Mar 26  2009 /tmp@ -> /var/tmp
$ mount | egrep var
/dev/twed0s1f on /var (ufs, local, noexec, with quotas, soft-updates)
$ cat > /tmp/a.pl; chmod 700 /tmp/a.pl
#!/usr/bin/env perl
print("Hello\n");
^D
$ /tmp/a.pl
zsh: permission denied: /tmp/a.pl
[1]    3405 exit 126   /tmp/a.pl
$ ls -ln /tmp/a.pl
-rwx------  1 1177  0  38 Feb  2 13:08 /tmp/a.pl*

ということで,perldoc File::Temp (01_basic.t から)を見て,
TMPDIR 環境変数を指定すればよいことがわかったので,
適当に回避したらインストールできた.

$ env TMPDIR=$HOME/tmp cpan
cpan> install Config::Pit

参考