r75289 - in /trunk/libregexp-reggrp-perl: ./ debian/ inc/Module/ inc/Module/Install/ lib/Regexp/ lib/Regexp/RegGrp/ t/
jotamjr-guest at users.alioth.debian.org
jotamjr-guest at users.alioth.debian.org
Thu Jun 9 03:53:03 UTC 2011
Author: jotamjr-guest
Date: Thu Jun 9 03:52:26 2011
New Revision: 75289
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75289
Log:
New upstream release
Added:
trunk/libregexp-reggrp-perl/META.yml
- copied unchanged from r75288, branches/upstream/libregexp-reggrp-perl/current/META.yml
trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp/
- copied from r75288, branches/upstream/libregexp-reggrp-perl/current/lib/Regexp/RegGrp/
trunk/libregexp-reggrp-perl/t/01-data.t
- copied unchanged from r75288, branches/upstream/libregexp-reggrp-perl/current/t/01-data.t
trunk/libregexp-reggrp-perl/t/02-reggrp.t
- copied unchanged from r75288, branches/upstream/libregexp-reggrp-perl/current/t/02-reggrp.t
trunk/libregexp-reggrp-perl/t/03-io.t
- copied unchanged from r75288, branches/upstream/libregexp-reggrp-perl/current/t/03-io.t
Removed:
trunk/libregexp-reggrp-perl/t/01-io.t
Modified:
trunk/libregexp-reggrp-perl/Changes
trunk/libregexp-reggrp-perl/MANIFEST
trunk/libregexp-reggrp-perl/Makefile.PL
trunk/libregexp-reggrp-perl/README
trunk/libregexp-reggrp-perl/debian/changelog
trunk/libregexp-reggrp-perl/inc/Module/Install.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Base.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Can.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Fetch.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Makefile.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Metadata.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/Win32.pm
trunk/libregexp-reggrp-perl/inc/Module/Install/WriteAll.pm
trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp.pm
trunk/libregexp-reggrp-perl/t/00-load.t
Modified: trunk/libregexp-reggrp-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/Changes?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/Changes (original)
+++ trunk/libregexp-reggrp-perl/Changes Thu Jun 9 03:52:26 2011
@@ -1,4 +1,14 @@
Revision history for Regexp-RegGrp
+
+1.002 2011-05-18
+ - Changed version number.
+
+1.001_002 2011-04-14
+ - Fixed tests for perl > 5.13.5
+
+1.001_001 2011-04-05
+ - Splited up RegGrp.pm.
+ - Added tests.
1.000001 2011-02-27
- Fixed "undefined submatches bug" (Thanks to Dan Thomas).
Modified: trunk/libregexp-reggrp-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/MANIFEST?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/MANIFEST (original)
+++ trunk/libregexp-reggrp-perl/MANIFEST Thu Jun 9 03:52:26 2011
@@ -10,9 +10,13 @@
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/Regexp/RegGrp.pm
+lib/Regexp/RegGrp/Data.pm
Makefile.PL
MANIFEST
+META.yml
README
t/00-load.t
-t/01-io.t
+t/01-data.t
+t/02-reggrp.t
+t/03-io.t
t/pod.t
Modified: trunk/libregexp-reggrp-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/Makefile.PL?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/Makefile.PL (original)
+++ trunk/libregexp-reggrp-perl/Makefile.PL Thu Jun 9 03:52:26 2011
@@ -7,4 +7,6 @@
test_requires 'Test::More' => 0;
repository 'http://github.com/nevesenin/regexp-reggrp-perl';
+bugtracker 'http://github.com/nevesenin/regexp-reggrp-perl/issues';
+
WriteAll();
Modified: trunk/libregexp-reggrp-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/README?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/README (original)
+++ trunk/libregexp-reggrp-perl/README Thu Jun 9 03:52:26 2011
@@ -18,6 +18,9 @@
You can also look for information at:
+ github
+ http://github.com/nevesenin/regexp-reggrp-perl
+
RT, CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Regexp-RegGrp
Modified: trunk/libregexp-reggrp-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/debian/changelog?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/debian/changelog (original)
+++ trunk/libregexp-reggrp-perl/debian/changelog Thu Jun 9 03:52:26 2011
@@ -1,3 +1,9 @@
+libregexp-reggrp-perl (1.002-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Jotam Jr. Trejo <jotamjr at debian.org.sv> Wed, 08 Jun 2011 21:30:58 -0600
+
libregexp-reggrp-perl (1.000001-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install.pm Thu Jun 9 03:52:26 2011
@@ -31,7 +31,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.00';
+ $VERSION = '1.01';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -467,4 +467,4 @@
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Base.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Base.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Base.pm Thu Jun 9 03:52:26 2011
@@ -4,7 +4,7 @@
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
}
# Suspend handler for "redefined" warnings
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Can.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Can.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Can.pm Thu Jun 9 03:52:26 2011
@@ -9,7 +9,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Fetch.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Fetch.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Fetch.pm Thu Jun 9 03:52:26 2011
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Makefile.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Makefile.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Makefile.pm Thu Jun 9 03:52:26 2011
@@ -8,7 +8,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Metadata.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Metadata.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Metadata.pm Thu Jun 9 03:52:26 2011
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -515,6 +515,7 @@
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
+ 'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
@@ -550,9 +551,9 @@
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
- \Qhttp://rt.cpan.org/\E[^>]+|
- \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
- \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ https?\Q://rt.cpan.org/\E[^>]+|
+ https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+ https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/Win32.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/Win32.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/Win32.pm Thu Jun 9 03:52:26 2011
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
Modified: trunk/libregexp-reggrp-perl/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/inc/Module/Install/WriteAll.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/inc/Module/Install/WriteAll.pm (original)
+++ trunk/libregexp-reggrp-perl/inc/Module/Install/WriteAll.pm Thu Jun 9 03:52:26 2011
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.01';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp.pm?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp.pm (original)
+++ trunk/libregexp-reggrp-perl/lib/Regexp/RegGrp.pm Thu Jun 9 03:52:26 2011
@@ -4,6 +4,7 @@
use warnings;
use strict;
use Carp;
+use Regexp::RegGrp::Data;
BEGIN {
if ( $] < 5.010000 ) {
@@ -21,25 +22,27 @@
# =========================================================================== #
-our $VERSION = '1.000001';
+our $VERSION = '1.002';
sub new {
my ( $class, $in_ref ) = @_;
my $self = {};
+ bless( $self, $class );
+
if ( ref( $in_ref ) ne 'HASH' ) {
carp( 'First argument must be a hashref!' );
- return undef;
+ return;
}
unless ( exists( $in_ref->{reggrp} ) ) {
carp( 'Key "reggrp" does not exist in input hashref!' );
- return undef;
+ return;
}
if ( ref( $in_ref->{reggrp} ) ne 'ARRAY' ) {
carp( 'Value for key "reggrp" must be an arrayref!' );
- return undef;
+ return;
}
if (
@@ -47,74 +50,49 @@
ref( $in_ref->{restore_pattern} ) ne 'Regexp'
) {
carp( 'Value for key "restore_pattern" must be a scalar or regexp!' );
- return undef;
+ return;
}
my $no = 0;
map {
$no++;
- if (
- (
- ref( $_->{regexp} ) and
- ref( $_->{regexp} ) ne 'Regexp'
- ) or
- not length( $_->{regexp} ) or
- (
- ref( $_->{replacement} ) and
- ref( $_->{replacement} ) ne 'CODE'
- ) or
- (
- ref( $_->{store} ) and
- ref( $_->{store} ) ne 'CODE'
- ) or
- (
- ref( $_->{modifier} )
- )
- ) {
- carp( 'RegGrp No ' . $no . ' in arrayref is malformed!' );
- return undef;
- }
-
- push(
- @{$self->{reggrp}},
+
+ my $reggrp_data = Regexp::RegGrp::Data->new(
{
- regexp => $_->{regexp},
- replacement => defined( $_->{store} ) ? (
- $in_ref->{restore_pattern} ? $_->{replacement} : sub {
- return sprintf( "\x01%d\x01", $_[0]->{store_index} );
- }
- ) : $_->{replacement},
- store => $_->{store},
- modifier => defined( $_->{modifier} ) ? $_->{modifier} : ( ref( $_->{regexp} ) ? undef : 'sm' )
+ regexp => $_->{regexp},
+ replacement => $_->{replacement},
+ store => $_->{store},
+ modifier => $_->{modifier},
+ restore_pattern => $in_ref->{restore_pattern}
}
);
+
+ unless ( $reggrp_data ) {
+ carp( 'RegGrp No ' . $no . ' in arrayref is malformed!' );
+ return;
+ }
+
+ $self->reggrp_add( $reggrp_data );
} @{$in_ref->{reggrp}};
my $restore_pattern = $in_ref->{restore_pattern} || qr~\x01(\d+)\x01~;
- $self->{restore_pattern} = qr/$restore_pattern/;
-
- $self->{store_data} = [];
+ $self->{_restore_pattern} = qr/$restore_pattern/;
my $offset = 1;
my $midx = 0;
# In perl versions < 5.10 hash %+ doesn't exist, so we have to initialize it
- $self->{re_str} = ( ( $] < 5.010000 ) ? '(?{ %+ = (); })' : '' ) . join(
+ $self->{_re_str} = ( ( $] < 5.010000 ) ? '(?{ %+ = (); })' : '' ) . join(
'|',
map {
- my $re = $_->{regexp};
+ my $re = $_->regexp();
# Count backref brackets
$re =~ s/${\(ESCAPE_CHARS)}//g;
$re =~ s/${\(ESCAPE_BRACKETS)}//g;
my @nparen = $re =~ /${\(BRACKETS)}/g;
- if ( defined( $_->{modifier} ) ) {
- $_->{regexp} =~ s/^\(\?[\^dlupimsx-]+:(.*)\)$/$1/si;
- $_->{regexp} = sprintf( '(?%s:%s)', $_->{modifier}, $_->{regexp} );
- }
-
- $re = $_->{regexp};
+ $re = $_->regexp();
my $backref_pattern = '\\g{%d}';
@@ -140,13 +118,81 @@
$ret;
- } @{$self->{reggrp}}
+ } $self->reggrp_array()
);
- bless( $self, $class );
-
return $self;
}
+
+# re_str methods
+
+sub re_str {
+ my $self = shift;
+
+ return $self->{_re_str};
+}
+
+# /re_str methods
+
+# restore_pattern methods
+
+sub restore_pattern {
+ my $self = shift;
+
+ return $self->{_restore_pattern};
+}
+
+# /restore_pattern methods
+
+# store_data methods
+
+sub store_data_add {
+ my ( $self, $data ) = @_;
+
+ push( @{$self->{_store_data}}, $data );
+}
+
+sub store_data_by_idx {
+ my ( $self, $idx ) = @_;
+
+ return $self->{_store_data}->[$idx];
+}
+
+sub store_data_count {
+ my $self = shift;
+
+ return scalar( @{$self->{_store_data} || []} );
+}
+
+sub flush_stored {
+ my $self = shift;
+
+ $self->{_store_data} = [];
+}
+
+# /store_data methods
+
+# reggrp methods
+
+sub reggrp_add {
+ my ( $self, $reggrp ) = @_;
+
+ push( @{$self->{_reggrp}}, $reggrp );
+}
+
+sub reggrp_array {
+ my $self = shift;
+
+ return @{$self->{_reggrp}};
+}
+
+sub reggrp_by_idx {
+ my ( $self, $idx ) = @_;
+
+ return $self->{_reggrp}->[$idx];
+}
+
+# /reggrp methods
sub exec {
my ( $self, $input, $opts ) = @_;
@@ -176,7 +222,7 @@
$to_process = $input;
}
- ${$to_process} =~ s/$self->{re_str}/$self->_process( { match_hash => \%+, opts => $opts } )/eg;
+ ${$to_process} =~ s/${\$self->re_str()}/$self->_process( { match_hash => \%+, opts => $opts } )/eg;
# Return a scalar if requested by context
return ${$to_process} if ( $cont eq 'scalar' );
@@ -192,39 +238,41 @@
my ( $midx ) = $match_key =~ /^_(\d+)$/;
my $match = $match_hash{$match_key};
- my @submatches = $match =~ $self->{reggrp}->[$midx]->{regexp};
+ my $reggrp = $self->reggrp_by_idx( $midx );
+
+ my @submatches = $match =~ $reggrp->regexp();
map { $_ .= ''; } @submatches;
my $ret = $match;
+ my $replacement = $reggrp->replacement();
+
if (
- defined( $self->{reggrp}->[$midx]->{replacement} ) and
- not ref( $self->{reggrp}->[$midx]->{replacement} )
+ defined( $replacement ) and
+ not ref( $replacement )
) {
- $ret = $self->{reggrp}->[$midx]->{replacement};
- }
- else {
- if ( ref( $self->{reggrp}->[$midx]->{replacement} ) eq 'CODE' ) {
- $ret = $self->{reggrp}->[$midx]->{replacement}->(
- {
- match => $match,
- submatches => \@submatches,
- opts => $opts,
- store_index => scalar( @{$self->{store_data}} )
- }
- );
+ $ret = $replacement;
+ }
+ elsif ( ref( $replacement ) eq 'CODE' ) {
+ $ret = $replacement->(
+ {
+ match => $match,
+ submatches => \@submatches,
+ opts => $opts,
+ store_index => $self->store_data_count()
+ }
+ );
+ }
+
+ my $store = $reggrp->store();
+
+ if ( $store ) {
+ my $tmp_match = $match;
+ if ( not ref( $store ) ) {
+ $tmp_match = $store;
}
- }
-
- if (
- defined( $self->{reggrp}->[$midx]->{store} )
- ) {
- my $store = $match;
- if ( not ref( $self->{reggrp}->[$midx]->{store} ) ) {
- $store = $self->{reggrp}->[$midx]->{store};
- }
- elsif ( ref( $self->{reggrp}->[$midx]->{store} ) eq 'CODE' ) {
- $store = $self->{reggrp}->[$midx]->{store}->(
+ elsif ( ref( $store ) eq 'CODE' ) {
+ $tmp_match = $store->(
{
match => $match,
submatches => \@submatches,
@@ -233,7 +281,7 @@
);
}
- push( @{$self->{store_data}}, $store );
+ $self->store_data_add( $tmp_match );
}
return $ret;
@@ -261,8 +309,8 @@
}
# Here is a while loop, because there could be recursive replacements
- while ( ${$to_process} =~ /$self->{restore_pattern}/ ) {
- ${$to_process} =~ s/$self->{restore_pattern}/$self->{store_data}->[$1]/egsm;
+ while ( ${$to_process} =~ /${\$self->restore_pattern()}/ ) {
+ ${$to_process} =~ s/${\$self->restore_pattern()}/$self->store_data_by_idx( $1 )/egsm;
}
$self->flush_stored();
@@ -271,12 +319,6 @@
return ${$to_process} if ( $cont eq 'scalar' );
}
-sub flush_stored {
- my $self = shift;
-
- $self->{store_data} = [];
-}
-
1;
__END__
@@ -287,7 +329,7 @@
=head1 VERSION
-Version 1.000001
+Version 1.002
=head1 DESCRIPTION
@@ -502,16 +544,14 @@
=head1 BUGS
-Please report any bugs or feature requests to
-C<bug-javascript-packer at rt.cpan.org>, or through the web interface at
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Regexp-RegGrp>.
+Please report any bugs or feature requests through the web interface at
+L<http://github.com/nevesenin/regexp-reggrp-perl/issues>.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Regexp::RegGrp
-
=head1 COPYRIGHT & LICENSE
Modified: trunk/libregexp-reggrp-perl/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libregexp-reggrp-perl/t/00-load.t?rev=75289&op=diff
==============================================================================
--- trunk/libregexp-reggrp-perl/t/00-load.t (original)
+++ trunk/libregexp-reggrp-perl/t/00-load.t Thu Jun 9 03:52:26 2011
@@ -1,8 +1,9 @@
#!perl -T
-use Test::More tests => 1;
+use Test::More tests => 2;
BEGIN {
+ use_ok( 'Regexp::RegGrp::Data' );
use_ok( 'Regexp::RegGrp' );
}
More information about the Pkg-perl-cvs-commits
mailing list