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.
  • You can use $module->VERSION instead of ${"${module}::VERSION"};. And yes, it handles the case when package uses lowercase name of version variable.

    Ilya Martynov ( [])

    • That's handy to know :) ...and that makes things even tidier...
      (code below not yet tested...could have typos, etc)

      END {
          for my $k ( sort keys %INC ) {
              ( my $module = $k ) =~ s{[:/\\]}{::}g;
              $module =~ s{\.pm$}{};
              my $version = $module->VERSION;
              $version = defined $version
                  ? "\$${module}::VERSION = $version\n";