Slash Boxes
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.
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+   $

      • 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 :)

        • Something that could be done would be to pervert perversion a little bit more still. Instead of giving a regular expression as a value in the config hash, one could also pass references to a sub that would then be able to do whatever it wants with the file content... Including parsing its YAML, updating versions at the right places, and then spitting back the result. It shouldn't be much more than a few lines more. I might hack that in later on today, just for fun. :-)

        • 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} = $