dagolden/Test-DiagINC — pull request #4 by ribasushi (2014-02-07 13:02:54+00:00)
Title: Stuffz+

This is an alternative implementation to stuffz (https://github.com/dagolden/Test-DiagINC/pull/2). Everything said in https://github.com/dagolden/Test-DiagINC/pull/2#issuecomment-34402926 applies, with the difference being how we obtain the Cwd:

```
$ git diff gh/stuffz gh/stuffz+

diff --git a/lib/Test/DiagINC.pm b/lib/Test/DiagINC.pm
index ef31c4d..ecaf3f3 100644
--- a/lib/Test/DiagINC.pm
+++ b/lib/Test/DiagINC.pm
@@ -19,23 +19,15 @@ sub _max_length {
return $max;
}

-# Get our CWD *without* loading anything. The original idea by xdg++ was to
-# invoke a with an -e snippet, and not worry about quoting, but it seemed too
-# fragile. doing this trick instead (we know we can load ourselves):
-BEGIN {
- if ($^C) {
- require Cwd;
- require POSIX;
- $|++;
- print Cwd::getcwd() . "\n";
- POSIX::_exit(0);
- }
-}
-chomp( my $REALPATH_CWD = do {
- local $ENV{PATH};
- my ($perl) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?!
- `$perl -c @{[ __FILE__ ]}`;
-});
+# Get our CWD *without* loading anything. Original idea by xdg++
+# ribasushi thinks this is fragile and will break sooner rather than
+# later, but adding it as is because haarg and xdg both claim it's fine
+my $REALPATH_CWD = do {
+ local $ENV{PATH};
+ my ($perl) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?!
+ `$perl -MCwd -e print+getcwd`;
+};
+
my $ORIGINAL_PID = $$;

END {

```