On 13-07-11 04:26 AM, M Jemmeson via RT wrote:
Show quoted text> Firstly, thanks for the plugin, very useful.
Music to my ears. :-)
Show quoted text> However, it doesn't work with a __DATA__ section - would you consider a patch to insert the POD prior to any __DATA__ block?
>
> I'm not yet aware of any modules to parse pm files, so had just been
> splitting on __DATA__, I don't know if you know of a better way?
Oh, yes, true.
Fortunately, I think it's going to be very easy to solve. As you pointed
out, I think the fix is as simple as doing:
sub munge_file {
my ( $self, $file ) = @_;
return unless $file->name =~ /\.pm$/;
( my $podname = $file->name ) =~ s/\.pm$/.pod/;
my ( $podfile ) = grep { $_->name eq $podname }
@{ $self->zilla->files } or return;
my @content = split /(^__DATA__$)/m, $file->content;
# inject the pod
splice @content, 1, 0, $podfile->content;
$file->content( join '', @content );
$self->zilla->prune_file($podfile);
}
I'll patch the module and make sure it doesn't break anything. Expect a
new release coming out real soon. :-)
Thanks!
`/anick