Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The one place I regularly forget to update is the META.yml. However, version strings in a META.yml get a little tricky as you need to change them in context of the distribution and modules versions and nothing else. Been thinking I need to automated that somehow ... when I have time ;)

    • But then, META.yml is dealt with by './Build dist' or 'make dist', so one shouldn't have to dabble with it, no?

      And this being said, based on a five second pre-morning coffee perusal of the way META.yml presents its stuff (i.e., I'm probably wrong but still too sleepy for it to stop me :-) ), I think that something looking like the following added to the perversionrc hash should do the trick:

      $h{META.yml} = [
          qr/ ^ name:    \s \S+   $
                vers

      • But then, META.yml is dealt with by './Build dist' or 'make dist', so one shouldn't have to dabble with it, no?

        I don't use M::B and EU::MM doesn't build a fully documented META.yml. As such I write all my META.yml files by hand, as that way I can be guaranteed to include all the details I want.

        Also the ordering is not guaranteed, so your regex may work in some cases but not all. That's why I said it was tricky ;) A good headstart mind :)

        • And here we go. I've updated the code such that you can now hook a subroutine ref in the perversionrc hash. E.g.:

          use YAML qw/ Load Dump /;

          sub do_meta {
              my ( $text, $version ) = @_;

              my $yaml = Load( $text );

              my @old;

              push @old, $yaml->{version};
              $yaml->{version} = $version;

              for ( values %{ $yaml->{provides} } ) {
                  push @old, $_->{version};
                  $_->{version} = $version;
              }

              return Dump( $yaml ), @old;
          }

          (
              'META.yml'=> \&do_meta,
          );

          Passing the old versions is not mandatory, but useful if you want the version verification functionality to work.