Module-Extract-VERSION-1.119/0000755000076500000240000000000014777253375014507 5ustar brianstaffModule-Extract-VERSION-1.119/LICENSE0000644000076500000240000002170214777253374015515 0ustar brianstaffThe Module::Extract::VERSION module is licensed under the Artistic License 2.0. Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ******** This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions *********** "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution ******************************************************** (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version ****************************************************** (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source ********************************************************** (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified ****************************************************************** Versions without the Source *************************** (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package ********************************** (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version ******************************************************** (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions ****************** (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Module-Extract-VERSION-1.119/Changes0000644000076500000240000000341314777253374016002 0ustar brianstaffRevision history for Perl module Module::Extract::Version 1.119 2025-04-14T18:42:03Z * require a newer version.pm for v5.10.1 tests 1.118 2025-01-22T14:18:12Z * refresh dist 1.117 2024-02-11T07:18:52Z * refresh distro, update email address, move to BRIANDFOY 1.116 2022-10-25T12:36:09Z * Fix problem with Safe compartment. Don't import version:: since Safe already does that. Thanks to Graham Knopp (#16). 1.115 2022-01-08T23:56:54Z * No code changes. Fix link in README.pod. 1.114 2021-01-20T09:54:21Z * freshen distro, dump Travis CI, add Github Actions 1.113 2016-12-07T13:59:05Z * Fix a perl5.8 issue with Makefile.PL. It shouldn't use // ! Even though this module requires v5.10, I want the modulino Makefile.PL to work with tools that use earlier perls. 1.112 2016-12-05T19:39:04Z * Remove prereq.t test. I'll do that locally. * Hide some packages from PAUSE. 1.111 2016-10-18T01:54:39Z * Support v5.12 and v5.14 PACKAGE NAMESPACE VERSION BLOCK * Andrey Starodubtsev contributed the changes as part of Hacktoberfest. 1.01 - 2011-04-26 * Bump to a full release version. The module isn't going to change that much now. * Add an example to the synopsis. * Other than that, it's the same old code. :) 0.12 - 2008-09-16 * Moved everything to git * Added corpus to the no_index bit of META.yml by using the latest features of ExtUtils::MakeMaker 0.11 - 2008-08-09 * Bumping this to a release version * CPAN Testers seems to like it * If you find pathological cases, please let me know about them 0.10_01 - 2008-04-03 * This is the initial version of my module to extract module versions without running module code. I stole most of it from PAUSE's mldistwatch. 1.10_01 - 2011-11-29 * Use a safe compartment * Require Perl 5.10 so I can use named captures. Module-Extract-VERSION-1.119/corpus/0000755000076500000240000000000014777253374016021 5ustar brianstaffModule-Extract-VERSION-1.119/corpus/Dotted_5_14_braces.pm0000644000076500000240000000010214777253374021642 0ustar brianstaff#!/usr/bin/perl package Dotted_5_12_braces v0.10.01 { 1; } 1; Module-Extract-VERSION-1.119/corpus/Easy_5_14_braces.pm0000644000076500000240000000006014777253374021323 0ustar brianstaff#!/usr/bin/perl package Easy_5_14 3.01 { 1; } Module-Extract-VERSION-1.119/corpus/Underscore.pm0000644000076500000240000000004714777253374020471 0ustar brianstaff#!/usr/bin/perl $VERSION = "0.10_01";Module-Extract-VERSION-1.119/corpus/Easy.pm0000644000076500000240000000004114777253374017253 0ustar brianstaff#!/usr/bin/perl $VERSION = 3.01;Module-Extract-VERSION-1.119/corpus/RCSKeywords.pm0000644000076500000240000000014714777253374020540 0ustar brianstaff#!/usr/bin/perl print "Hello world!\n"; $VERSION = sprintf "%d.%02d", q$Revision: 1.23$ =~ m/(\d+)/g;Module-Extract-VERSION-1.119/corpus/Easy_5_12.pm0000644000076500000240000000005514777253374020006 0ustar brianstaff#!/usr/bin/perl package Easy_5_12 3.01; 1; Module-Extract-VERSION-1.119/corpus/Dotted_5_12.pm0000644000076500000240000000006314777253374020327 0ustar brianstaff#!/usr/bin/perl package Dotted_5_12 v0.10.01; 1; Module-Extract-VERSION-1.119/corpus/ToTk.pm0000644000076500000240000000657514777253374017255 0ustar brianstaff require 5; package Pod::Perldoc::ToTk; use strict; use warnings; use base qw(Pod::Perldoc::BaseTo); sub is_pageable { 1 } sub write_with_binmode { 0 } sub output_extension { 'txt' } # doesn't matter sub if_zero_length { } # because it will be 0-length! sub new { return bless {}, ref($_[0]) || $_[0] } # TODO: document these and their meanings... sub tree { shift->_perldoc_elem('tree' , @_) } sub tk_opt { shift->_perldoc_elem('tk_opt' , @_) } sub forky { shift->_perldoc_elem('forky' , @_) } use Pod::Perldoc (); use File::Spec::Functions qw(catfile); use Tk; die join '', __PACKAGE__, " doesn't work nice with Tk.pm verison $Tk::VERSION" if $Tk::VERSION eq '800.003'; BEGIN { eval { require Tk::FcyEntry; }; }; use Tk::Pod; # The following was adapted from "tkpod" in the Tk-Pod dist. sub parse_from_file { my($self, $Input_File) = @_; if($self->{'forky'}) { return if fork; # i.e., parent process returns } $Input_File =~ s{\\}{/}g if Pod::Perldoc::IS_MSWin32 or Pod::Perldoc::IS_Dos # and maybe OS/2 ; my($tk_opt, $tree); $tree = $self->{'tree' }; $tk_opt = $self->{'tk_opt'}; #require Tk::ErrorDialog; # Add 'Tk' subdirectories to search path so, e.g., # 'Scrolled' will find doc in 'Tk/Scrolled' if( $tk_opt ) { push @INC, grep -d $_, map catfile($_,'Tk'), @INC; } my $mw = MainWindow->new(); #eval 'use blib "/home/e/eserte/src/perl/Tk-App";require Tk::App::Debug'; $mw->withdraw; # CDE use Font Settings if available my $ufont = $mw->optionGet('userFont','UserFont'); # fixed width my $sfont = $mw->optionGet('systemFont','SystemFont'); # proportional if (defined($ufont) and defined($sfont)) { foreach ($ufont, $sfont) { s/:$//; }; $mw->optionAdd('*Font', $sfont); $mw->optionAdd('*Entry.Font', $ufont); $mw->optionAdd('*Text.Font', $ufont); } $mw->optionAdd('*Menu.tearOff', $Tk::platform ne 'MSWin32' ? 1 : 0); $mw->Pod( '-file' => $Input_File, (($Tk::Pod::VERSION >= 4) ? ('-tree' => $tree) : ()) )->focusNext; # xxx dirty but it works. A simple $mw->destroy if $mw->children # does not work because Tk::ErrorDialogs could be created. # (they are withdrawn after Ok instead of destory'ed I guess) if ($mw->children) { $mw->repeat(1000, sub { # ErrorDialog is withdrawn not deleted :-( foreach ($mw->children) { return if "$_" =~ /^Tk::Pod/ # ->isa('Tk::Pod') } $mw->destroy; }); } else { $mw->destroy; } #$mw->WidgetDump; MainLoop(); exit if $self->{'forky'}; # we were the child! so exit now! return; } 1; __END__ =encoding utf8 =head1 NAME Pod::Perldoc::ToTk - let Perldoc use Tk::Pod to render Pod =head1 SYNOPSIS perldoc -o tk Some::Modulename & =head1 DESCRIPTION This is a "plug-in" class that allows Perldoc to use Tk::Pod as a formatter class. You have to have installed Tk::Pod first, or this class won't load. =head1 SEE ALSO L, L =head1 AUTHOR Current maintainer: Adriano R. Ferreira Past contributions from: Sean M. Burke C, with significant portions copied from F in the Tk::Pod dist, by Nick Ing-Simmons, Slaven Rezic, et al. =cut Module-Extract-VERSION-1.119/MANIFEST0000644000076500000240000000107714777253375015645 0ustar brianstaffChanges corpus/Dotted_5_12.pm corpus/Dotted_5_14_braces.pm corpus/Easy.pm corpus/Easy_5_12.pm corpus/Easy_5_14_braces.pm corpus/RCSKeywords.pm corpus/ToTk.pm corpus/Underscore.pm examples/placeholder.pl INSTALL.SKIP lib/Module/Extract/VERSION.pm LICENSE Makefile.PL MANIFEST This list of files MANIFEST.SKIP README.pod SECURITY.md t/corpus.t t/load.t t/pod.t t/pod_coverage.t t/test_manifest xt/changes.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Module-Extract-VERSION-1.119/t/0000755000076500000240000000000014777253374014751 5ustar brianstaffModule-Extract-VERSION-1.119/t/pod.t0000644000076500000240000000020114777253374015711 0ustar brianstaffuse Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Module-Extract-VERSION-1.119/t/corpus.t0000644000076500000240000000146614777253374016460 0ustar brianstaffuse strict; use warnings; use File::Spec; use Test::More 0.95; use_ok( 'Module::Extract::VERSION' ); can_ok( 'Module::Extract::VERSION', qw(parse_version_safely) ); my %Corpus = ( 'Easy.pm' => 3.01, 'RCSKeywords.pm' => 1.23, 'Underscore.pm' => "0.10_01", 'ToTk.pm' => undef, ); if ($] >= 5.012) { $Corpus{ 'Easy_5_12.pm' } = '3.01'; $Corpus{ 'Dotted_5_12.pm' } = 'v0.10.01'; } if ($] >= 5.014) { $Corpus{ 'Easy_5_14_braces.pm' } = '3.01'; $Corpus{ 'Dotted_5_14_braces.pm' } = 'v0.10.01'; } foreach my $file ( sort keys %Corpus ) { my $path = File::Spec->catfile( 'corpus', $file ); ok( -e $path, "Corpus file [ $path ] exists" ); my $version = eval{ Module::Extract::VERSION->parse_version_safely( $path ) }; is( $version, $Corpus{$file}, "Works for $file" ); } done_testing(); Module-Extract-VERSION-1.119/t/load.t0000644000076500000240000000031214777253374016051 0ustar brianstaffBEGIN { @classes = qw(Module::Extract::VERSION); } use Test::More tests => scalar @classes; foreach my $class ( @classes ) { print "Bail out! $class did not compile\n" unless use_ok( $class ); } Module-Extract-VERSION-1.119/t/test_manifest0000644000076500000240000000004514777253374017540 0ustar brianstaffload.t pod.t pod_coverage.t corpus.t Module-Extract-VERSION-1.119/t/pod_coverage.t0000644000076500000240000000027114777253374017573 0ustar brianstaffuse Test::More; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; all_pod_coverage_ok(); Module-Extract-VERSION-1.119/xt/0000755000076500000240000000000014777253374015141 5ustar brianstaffModule-Extract-VERSION-1.119/xt/changes.t0000644000076500000240000000020314777253374016731 0ustar brianstaffuse Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); Module-Extract-VERSION-1.119/README.pod0000644000076500000240000001176314777253374016157 0ustar brianstaff=pod =encoding utf8 =for HTML =for HTML =for HTML =for HTML =for HTML Coverage Status =for HTML =for HTML =head1 The Module::Extract::VERSION module This is the I for the L Perl module. You're probably looking at this because you don't know where else to find what you're looking for. Read this once and you might never have to read one again for any Perl module. =head2 Documentation To read about L, look at the embedded documentation in the module itself. Inside the distribution, you can format it with L: % perldoc lib/Module/Extract/VERSION.pm If you have already installed the module, you can specify the module name instead of the file location: % perldoc Module::Extract::VERSION You can read the documentation and inspect the meta data on L. The standard module documentation has example uses in the SYNOPSIS section, but you can also look in the I directory (if it's there), or look at the test files in I. =head2 Installation You can install this module with a CPAN client, which will resolve and install the dependencies: % cpan Module::Extract::VERSION % cpanm Module::Extract::VERSION You can also install directly from the distribution directory, which will also install the dependencies: % cpan . % cpanm . You could install just this module manually: % perl Makefile.PL % make % make test % make install You probably don't want to do that unless you're fiddling with the module and only want to run the tests without installing anything. =head2 Source location The meta data, such as the source repository and bug tracker, is in I or the I files it creates. You can find that on those CPAN web interfaces, but you can also look at files directly in the source repository: L If you find a problem, file a ticket in the L. There are also backup repositories hosted on other services. These reflect the state of the main repo and exist only for redundancy: =over 4 =item * L =item * L =item * L =back =head2 GitHub Attestations This distribution now uses L, which allow you to verify that the archive file you have was made from the official repo. You need a GitHub account and the L. # download the distro file from GitHub, MetaCPAN, or a CPAN mirror $ gh auth login ...follow instructions... $ gh attestation verify Module-Extract-VERSION-1.23.tar.gz --owner briandfoy =head2 Getting help Although I'm happy to hear from module users in private email, that's the best way for me to forget to do something. Besides the issue trackers, you can find help at L or L, both of which have many competent Perlers who can answer your question, almost in real time. They might not know the particulars of this module, but they can help you diagnose your problem. You might like to read L. =head2 Copyright and License You should have received a I file, but the license is also noted in the module files. About the only thing you can't do is pretend that you wrote code that you didn't. =head2 Good luck! Enjoy, brian d foy, briandfoy@pobox.com =cut Module-Extract-VERSION-1.119/MANIFEST.SKIP0000644000076500000240000000233514777253374016407 0ustar brianstaff #!start included /usr/local/perls/perl-5.22.0/lib/5.22.0/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this \b_eumm/ # 7.05_05 and above # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # and Module::Build::Tiny generated files \b_build_params$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ \..*\.sw.?$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid prove files \B\.prove$ # Avoid MYMETA files ^MYMETA\. #!end included /usr/local/perls/perl-5.22.0/lib/5.22.0/ExtUtils/MANIFEST.SKIP \.?appveyor.yml \.releaserc \.lwpcookies \bMANIFEST\s\d \bChanges\s\d \.icloud$ \A\.github\b \.gitattributes\b Module-Extract-VERSION-1.119/examples/0000755000076500000240000000000014777253374016324 5ustar brianstaffModule-Extract-VERSION-1.119/examples/placeholder.pl0000644000076500000240000000013014777253374021135 0ustar brianstaff#!/usr/bin/perl # See the module synopsis until I can create some interesting examples Module-Extract-VERSION-1.119/META.yml0000664000076500000240000000160114777253375015760 0ustar brianstaff--- abstract: 'Extract a module version safely' author: - 'brian d foy ' build_requires: Test::More: '1' version: '0.86' configure_requires: ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Module-Extract-VERSION no_index: directory: - t - inc - corpus - t requires: Tie::Hash::NamedCapture: '0' perl: '5.010' version: '0' resources: bugtracker: https://github.com/briandfoy/module-extract-version/issues homepage: https://github.com/briandfoy/module-extract-version repository: https://github.com/briandfoy/module-extract-version version: '1.119' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Module-Extract-VERSION-1.119/lib/0000755000076500000240000000000014777253374015254 5ustar brianstaffModule-Extract-VERSION-1.119/lib/Module/0000755000076500000240000000000014777253374016501 5ustar brianstaffModule-Extract-VERSION-1.119/lib/Module/Extract/0000755000076500000240000000000014777253374020113 5ustar brianstaffModule-Extract-VERSION-1.119/lib/Module/Extract/VERSION.pm0000644000076500000240000000637314777253374021607 0ustar brianstaffrequire v5.10; package Module::Extract::VERSION; use strict; use warnings; no warnings; use Carp qw(carp); our $VERSION = '1.119'; =encoding utf8 =head1 NAME Module::Extract::VERSION - Extract a module version safely =head1 SYNOPSIS use Module::Extract::VERSION; my $version # just the version = Module::Extract::VERSION->parse_version_safely( $file ); my @version_info # extra info = Module::Extract::VERSION->parse_version_safely( $file ); =head1 DESCRIPTION This module lets you pull out of module source code the version number for the module. It assumes that there is only one C<$VERSION> in the file and the entire C<$VERSION> statement is on the same line. =cut =head2 Class methods =over 4 =item $class->parse_version_safely( FILE ); Given a module file, return the module version. This works just like C in PAUSE. It looks for the single line that has the C<$VERSION> statement, extracts it, evals it in a Safe compartment, and returns the result. In scalar context, it returns just the version as a string. In list context, it returns the list of: sigil fully-qualified variable name version value file name line number of $VERSION =cut sub parse_version_safely { # stolen from PAUSE's mldistwatch, but refactored my( $class, $file ) = @_; local $/ = "\n"; local $_; # don't mess with the $_ in the map calling this my $fh; unless( open $fh, "<", $file ) { carp( "Could not open file [$file]: $!\n" ); return; } my $in_pod = 0; my( $sigil, $var, $version, $line_number, $rhs ); while( <$fh> ) { $line_number++; chomp; $in_pod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $in_pod; next if $in_pod || /^\s*#/; # package NAMESPACE VERSION <-- we handle that # package NAMESPACE VERSION BLOCK next unless / (? [\$*] ) (? (? [\w\:\']* ) \b VERSION ) \b .*? \= (? .* ) /x || m/ \b package \s+ (? \w[\w\:\']* ) \s+ (? \S+ ) \s* [;{] /x; ( $sigil, $var, $rhs ) = @+{ qw(sigil var rhs) }; if ($sigil) { $version = $class->_eval_version( $_, @+{ qw(sigil var rhs) } ); } else { $version = $class->_eval_version( $_, '$', 'VERSION', qq('$rhs') ); } last; } $line_number = undef if eof($fh) && ! defined( $version ); close $fh; return wantarray ? ( $sigil, $var, $version, $file, $line_number ) : $version; } sub _eval_version { my( $class, $line, $sigil, $var, $rhs ) = @_; require Safe; require version; local $^W = 0; my $s = Safe->new; if (defined $Devel::Cover::VERSION) { $s->share_from('main', ['&Devel::Cover::use_file']); } $s->reval('$VERSION = ' . $rhs); my $version = $s->reval('$VERSION'); return $version; } =back =head1 SOURCE AVAILABILITY This code is in Github: https://github.com/briandfoy/module-extract-version.git =head1 AUTHOR brian d foy, C<< >> I stole the some of this code from C in the PAUSE code by Andreas König, but I've moved most of it around. Andrey Starodubtsev added code to handle the v5.12 and v5.14 C syntax. =head1 COPYRIGHT AND LICENSE Copyright © 2008-2025, brian d foy C<< >>. All rights reserved. You may redistribute this under the Artistic License 2.0. =cut 1; Module-Extract-VERSION-1.119/Makefile.PL0000644000076500000240000000544414777253374016467 0ustar brianstaffpackage Module::Extract::VERSION; use strict; use warnings; =encoding utf8 =head1 The build file for Module::Extract::VERSION This build file is a modulino; it works as both a build script and a module. To build the distribution, run this file normally: % perl Makefile.PL But, it's more interesting than that. You can load it with C and call C to get the data structure it passes to C: my $package = require '/path/to/Makefile.PL'; my $arguments = $package->arguments; Note that C-ing a file makes an entry in C<%INC> for exactly that name. If you try to C another file with the same name, even from a different path, C thinks it has already loaded the file. As such, I recommend you always require the full path to the file. The return value of the C is a package name (in this case, the name of the main module. Use that to call the C method. Even if this distribution needs a higher version of Perl, this bit only needs v5.8. You can play with the data structure with a primitive Perl. =cut use File::Spec::Functions qw(catfile); my $module = __PACKAGE__; ( my $dist = $module ) =~ s/::/-/g; my $github = 'https://github.com/briandfoy/module-extract-version'; my $main_file = catfile( 'lib', split /::/, "$module.pm" ); my %WriteMakefile = ( 'MIN_PERL_VERSION' => '5.010', 'NAME' => $module, 'ABSTRACT_FROM' => $main_file, 'VERSION_FROM' => 'lib/Module/Extract/VERSION.pm', 'LICENSE' => 'artistic2', 'AUTHOR' => 'brian d foy ', 'CONFIGURE_REQUIRES' => { 'ExtUtils::MakeMaker' => '6.64', 'File::Spec::Functions' => '0', }, 'BUILD_REQUIRES' => { }, 'TEST_REQUIRES' => { 'Test::More' => '1', 'version' => '0.86', }, 'PREREQ_PM' => { 'Tie::Hash::NamedCapture' => '0', # for named captures 'version' => '0', }, 'META_MERGE' => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'git', url => $github, web => $github, }, bugtracker => { web => "$github/issues", }, homepage => $github, }, no_index => { dir => [ "corpus", "t" ], }, }, clean => { FILES => "$dist-*" }, ); sub arguments { \%WriteMakefile } do_it() unless caller; sub do_it { require File::Spec; my $MM ='ExtUtils::MakeMaker'; my $MM_version = eval{ "$MM " . $WriteMakefile{'CONFIGURE_REQUIRES'}{'ExtUtils::MakeMaker'} } || "$MM 6.64"; eval "use $MM_version; 1" or die "Could not load $MM_version: $@"; eval "use Test::Manifest 1.21" if -e File::Spec->catfile( qw(t test_manifest) ); my $arguments = arguments(); my $minimum_perl = $arguments->{MIN_PERL_VERSION} || '5.008'; eval "require $minimum_perl;" or die $@; WriteMakefile( %$arguments ); } no warnings; __PACKAGE__; Module-Extract-VERSION-1.119/INSTALL.SKIP0000644000076500000240000000015614777253374016306 0ustar brianstaffREADME\.pod README.* # things that might be in local directories after fooling # around with them \.DS_Store Module-Extract-VERSION-1.119/SECURITY.md0000644000076500000240000000232114777253374016275 0ustar brianstaff# Security Policy for Module::Extract::VERSION ## Reporting security issues **Do not report security problems on public forums or in repository issues.** Privately report vulnerabilities to the maintainers listed at the end of this document. Include as many details as possible to reproduce the issue, including code samples or test cases. Check that your report does not expose any of your sensitive data, such as passwords, tokens, or other secrets. You do not need to have a solution or fix. Depending on the issue, CPANSec may be notified. Depending on the issue, CPANSec may be notified. You can also privately report issues to the CPAN Security Group (CPANSec) . This is especially important if you think a vulnerability is being actively exploited. CPANSec may report the issue to the relevant authorities. See [Report a Security Issue](https://security.metacpan.org/docs/report.html). ## Response to reports The maintainers aim to respond to all reports within one day, but this may be affected by life and other things that happen to people who maintain open source code. A new release will be provided as soon as possible. ## Maintainers * brian d foy, Module-Extract-VERSION-1.119/META.json0000664000076500000240000000305614777253375016136 0ustar brianstaff{ "abstract" : "Extract a module version safely", "author" : [ "brian d foy " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Module-Extract-VERSION", "no_index" : { "directory" : [ "t", "inc", "corpus", "t" ] }, "prereqs" : { "build" : { "requires" : {} }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.64", "File::Spec::Functions" : "0" } }, "runtime" : { "requires" : { "Tie::Hash::NamedCapture" : "0", "perl" : "5.010", "version" : "0" } }, "test" : { "requires" : { "Test::More" : "1", "version" : "0.86" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/briandfoy/module-extract-version/issues" }, "homepage" : "https://github.com/briandfoy/module-extract-version", "repository" : { "type" : "git", "url" : "https://github.com/briandfoy/module-extract-version", "web" : "https://github.com/briandfoy/module-extract-version" } }, "version" : "1.119", "x_serialization_backend" : "JSON::PP version 4.16" }