7 { # keep all the code in an external template to keep it easy to update
9 open my $FROM, '<', '__Storable__.pm' or die $!;
11 close $FROM or die $!;
17 $Config{'d_fcntl_can_lock'} ||
22 my $CAN_FLOCK = CAN_FLOCK();
24 # populate the sub and preserve it if used outside
25 $template =~ s{^sub CAN_FLOCK;.*$}{sub CAN_FLOCK { ${CAN_FLOCK} } # computed by Storable.pm.PL}m;
26 # alternatively we could remove the sub
27 #$template =~ s{^sub CAN_FLOCK;.*$}{}m;
28 # replace local function calls to hardcoded value
29 $template =~ s{&CAN_FLOCK}{${CAN_FLOCK}}g;
32 open my $OUT, '>', 'Storable.pm' or die $!;
33 print {$OUT} $template or die $!;