#!/usr/bin/env perl
our
(
$mydir
,
$myname
);
BEGIN {
my
$location
= (-l $0) ? abs_path($0) : $0;
$location
=~ /(.*?)([^\/]+?)_?\z/s or
die
"?"
;
(
$mydir
,
$myname
) = ($1, $2);
}
sub
usage {
print
STDERR
map
{
"$_\n"
}
@_
if
@_
;
print
"
$myname
Update the autogenerated POD parts in some of the modules.
";
exit
(
@_
? 1 : 0);
}
our
$verbose
= 0;
GetOptions(
"verbose"
=> \
$verbose
,
"help"
=>
sub
{usage},
) or
exit
1;
usage
if
@ARGV
;
my
$newpart
= FunctionalPerl::export_desc2pod;
sub
is_see_also {
$_
[0] =~ /^=head1 SEE ALSO/
}
sub
is_head1 {
$_
[0] =~ /^=head1 /
}
my
$file
=
"lib/FunctionalPerl.pm"
;
xfile_replace_lines
$file
,
sub
{
my
(
$lines
) =
@_
;
my
(
$top
,
$rest
)
= Keep(
$lines
)->take_while_and_rest(complement \
&is_see_also
);
$rest
->
ref
(2) eq
"This is the list of supported import tags and the modules and other tags that they import:\n"
or
die
"no match"
;
my
(
$top2
,
$rest2
) =
$rest
->split_at(4);
$top2
->
last
eq
"\n"
or
die
"no match"
;
my
(
$_drop
,
$remainder
)
=
$rest2
->take_while_and_rest(complement \
&is_head1
);
my
$res
= stream_append(
$top
,
$top2
, cons
$newpart
,
$remainder
);
$res
};