=head2 ($pkg, $version, $ext) = $cb->_split_package_string( package => PACKAGE_STRING );
-Splits the name of a CPAN package string up in it's package, version
+Splits the name of a CPAN package string up into its package, version
and extension parts.
For example, C<Foo-Bar-1.2.tar.gz> would return the following parts:
)*
/xi;
- my $ver_re = qr/[a-z]*\d+[a-z]* # contains a digit and possibly letters
- (?:
+ my $ver_re = qr/[a-z]*\d*?[a-z]* # contains a digit and possibly letters
+ (?: # however, some start with a . only :(
[-._] # followed by a delimiter
[a-z\d]+ # and more digits and or letters
)*?
### composed regex for CPAN packages
my $full_re = qr/
^
- ($pkg_re+) # package
- (?:
- $del_re # delimiter
- $ver_ext_re # version + extension
- )?
+ ( # the whole thing
+ ($pkg_re+) # package
+ (?:
+ $del_re # delimiter
+ $ver_ext_re # version + extension
+ )?
+ )
$
/xi;
my $perl = PERL_CORE;
my $perl_re = qr/
^
- ($perl) # package name for 'perl'
- (?:
- $ver_ext_re # version + extension
- )?
+ ( # the whole thing
+ ($perl) # package name for 'perl'
+ (?:
+ $ver_ext_re # version + extension
+ )?
+ )
$
/xi;
### try the next if the match fails
$str =~ $re or next;
- my $pkg = $1 || '';
- my $ver = $2 || '';
- my $ext = $3 || '';
+ my $full = $1 || '';
+ my $pkg = $2 || '';
+ my $ver = $3 || '';
+ my $ext = $4 || '';
### this regex resets the capture markers!
### strip the trailing delimiter
### strip the .pm package suffix some authors insist on adding
$pkg =~ s/\.pm$//i;
- return ($pkg, $ver, $ext );
+ return ($pkg, $ver, $ext, $full );
}
return;