File: MockPatchlevel.pm

package info (click to toggle)
libcpan-reporter-perl 1.2020-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,752 kB
  • sloc: perl: 5,440; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package MockPatchlevel;

# With XSConfig is readonly, so workaround that.

if ($Config::Config{perl_patchlevel}) {
  if (exists &Config::KEYS) {     # compiled Config
    *Config_FETCHorig = \&Config::FETCH;
    no warnings 'redefine';
    *Config::FETCH = sub {
      if ($_[0] and $_[1] eq 'patchlevel') {
        return '';
      } else {
        return Config_FETCHorig(@_);
      }
    }
  } else {
    tied(%Config)->{perl_patchlevel} = '';    # uncompiled Config
  }
}

1;