diff options
author | Utkarsh Gupta <guptautkarsh2102@gmail.com> | 2019-07-26 09:15:56 +0530 |
---|---|---|
committer | Utkarsh Gupta <guptautkarsh2102@gmail.com> | 2019-07-26 09:15:56 +0530 |
commit | c529a89ac461d847cb6a7eef90c1478c8ef97bab (patch) | |
tree | b815aeb3aa07bead1da653a6a6f162b9f3b12bf6 | |
parent | d0a66419f146e57bf1a4f92469e7f832dc155a68 (diff) |
New upstream version 0.16
-rw-r--r-- | Build.PL | 7 | ||||
-rw-r--r-- | Changes | 10 | ||||
-rw-r--r-- | LICENSE | 6 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | META.json | 15 | ||||
-rw-r--r-- | META.yml | 8 | ||||
-rw-r--r-- | Makefile.PL | 15 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | lib/String/Tagged.pm | 14 | ||||
-rw-r--r-- | lib/String/Tagged/Formatting.pod | 16 | ||||
-rw-r--r-- | t/06tags-substr.t | 13 |
11 files changed, 71 insertions, 37 deletions
@@ -7,13 +7,14 @@ my $build = Module::Build->new( module_name => 'String::Tagged', requires => { }, - build_requires => { + configure_requires => { + 'Module::Build' => '0.4004', # test_requires + }, + test_requires => { 'Test::Identity' => 0, 'Test::More' => '0.88', # done_testing }, - auto_configure_requires => 0, # Don't add M::B to configure_requires license => 'perl', - create_makefile_pl => 'traditional', create_license => 1, create_readme => 1, ); @@ -1,5 +1,15 @@ Revision history for String-Tagged +0.16 2019-04-12 16:03:33 + [CHANGES] + * Print a more helpful message when ->sprintf encounters undef + * A few docs improvements + * Render linefeed as "." in ->debug_sprintf so line wrapping works + + [BUGFIXES] + * Ensure ->substr preserves tags that are anchored both before and + after + 0.15 2017-10-02 16:09:35 [CHANGES] * Added ->from_sprintf constructor and ->sprintf convenience wrapper @@ -1,4 +1,4 @@ -This software is copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>. +This software is copyright (c) 2019 by Paul Evans <leonerd@leonerd.org.uk>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>. +This software is Copyright (c) 2019 by Paul Evans <leonerd@leonerd.org.uk>. This is free software, licensed under: @@ -272,7 +272,7 @@ That's all there is to it! --- The Artistic License 1.0 --- -This software is Copyright (c) 2017 by Paul Evans <leonerd@leonerd.org.uk>. +This software is Copyright (c) 2019 by Paul Evans <leonerd@leonerd.org.uk>. This is free software, licensed under: @@ -4,7 +4,6 @@ examples/demo-show.pl lib/String/Tagged.pm lib/String/Tagged/Formatting.pod LICENSE -Makefile.PL MANIFEST This list of files META.json META.yml @@ -4,7 +4,7 @@ "Paul Evans <leonerd@leonerd.org.uk>" ], "dynamic_config" : 1, - "generated_by" : "Module::Build version 0.422", + "generated_by" : "Module::Build version 0.4224", "license" : [ "perl_5" ], @@ -14,7 +14,12 @@ }, "name" : "String-Tagged", "prereqs" : { - "build" : { + "configure" : { + "requires" : { + "Module::Build" : "0.4004" + } + }, + "test" : { "requires" : { "Test::Identity" : "0", "Test::More" : "0.88" @@ -24,7 +29,7 @@ "provides" : { "String::Tagged" : { "file" : "lib/String/Tagged.pm", - "version" : "0.15" + "version" : "0.16" } }, "release_status" : "stable", @@ -33,6 +38,6 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.15", - "x_serialization_backend" : "JSON::PP version 2.94" + "version" : "0.16", + "x_serialization_backend" : "JSON::PP version 4.00" } @@ -5,8 +5,10 @@ author: build_requires: Test::Identity: '0' Test::More: '0.88' +configure_requires: + Module::Build: '0.4004' dynamic_config: 1 -generated_by: 'Module::Build version 0.422, CPAN::Meta::Converter version 2.150010' +generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -15,8 +17,8 @@ name: String-Tagged provides: String::Tagged: file: lib/String/Tagged.pm - version: '0.15' + version: '0.16' resources: license: http://dev.perl.org/licenses/ -version: '0.15' +version: '0.16' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/Makefile.PL b/Makefile.PL deleted file mode 100644 index eff4946..0000000 --- a/Makefile.PL +++ /dev/null @@ -1,15 +0,0 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.4220 -use ExtUtils::MakeMaker; -WriteMakefile -( - 'NAME' => 'String::Tagged', - 'VERSION_FROM' => 'lib/String/Tagged.pm', - 'PREREQ_PM' => { - 'Test::Identity' => 0, - 'Test::More' => '0.88' - }, - 'INSTALLDIRS' => 'site', - 'EXE_FILES' => [], - 'PL_FILES' => {} -) -; @@ -138,6 +138,9 @@ CONSTRUCTOR plain string instead of a code reference, it gives the new name for the tag, and will be applied with its existing value. + If only_tags is being used too, then the source names of any tags to + be converted must also be listed there, or they will not be copied. + clone (instance) $new = $orig->clone( %args ) diff --git a/lib/String/Tagged.pm b/lib/String/Tagged.pm index 9e0c325..5fd5c0a 100644 --- a/lib/String/Tagged.pm +++ b/lib/String/Tagged.pm @@ -8,7 +8,7 @@ package String::Tagged; use strict; use warnings; -our $VERSION = '0.15'; +our $VERSION = '0.16'; use Scalar::Util qw( blessed ); @@ -210,6 +210,9 @@ As a further convenience, if the value for a given tag name is a plain string instead of a code reference, it gives the new name for the tag, and will be applied with its existing value. +If C<only_tags> is being used too, then the source names of any tags to be +converted must also be listed there, or they will not be copied. + =back =head2 clone (instance) @@ -338,6 +341,11 @@ sub from_sprintf $precision = shift @args if defined $precision and $precision eq "*"; my $arg = shift @args; + defined $arg or do { + warnings::warnif( uninitialized => "Use of ininitialized value in String::Tagged->from_sprintf" ); + $arg = ""; + }; + if( defined $precision ) { if( blessed $arg and $arg->isa( __PACKAGE__ ) ) { $arg = $arg->substr( 0, $precision ); @@ -463,7 +471,7 @@ sub substr $ts = -1 if $ts < 0 or $tf & FLAG_ANCHOR_BEFORE; $te = -1 if $te > $end or $tf & FLAG_ANCHOR_AFTER; - $ret->apply_tag( $ts, $te - $ts, $tn => $tv ); + $ret->apply_tag( $ts, $te == -1 ? -1 : $te - $ts, $tn => $tv ); } return $ret; @@ -1652,7 +1660,7 @@ sub debug_sprintf my $maxnamelen = 0; - my $ret = " $str\n"; + my $ret = " " . ( $str =~ s/\n/./gr ) . "\n"; $self->iter_tags( sub { my ( undef, undef, $name, undef ) = @_; diff --git a/lib/String/Tagged/Formatting.pod b/lib/String/Tagged/Formatting.pod index 7d74e66..ae06468 100644 --- a/lib/String/Tagged/Formatting.pod +++ b/lib/String/Tagged/Formatting.pod @@ -74,12 +74,20 @@ map should be able to implement this in most cases. =over 4 -=item * C<String::Tagged::IRC> +=item * -=item * C<Net::Async::Matrix::Utils> +L<Net::Async::Matrix::Utils> - Contains a pair of functions to convert a +formatted I<Matrix> message body to and from this format. -Contains a pair of functions to convert a formatted I<Matrix> message body to -and from this format. +=item * + +L<String::Tagged::IRC> - parse or build IRC formatted messages and convert +bidirectionally to this format. + +=item * + +L<String::Tagged::Terminal> - build terminal control sequences for message +formatting and convert bidirectionally to this format. =back diff --git a/t/06tags-substr.t b/t/06tags-substr.t index bc568d8..01a24e9 100644 --- a/t/06tags-substr.t +++ b/t/06tags-substr.t @@ -107,4 +107,17 @@ is_deeply( \@tags, is( $e->length, 3, 'two tag length is 3' ); } +# ->substr can keep both-edge anchored tags +{ + my $str = String::Tagged->new( "one two three" ) + ->apply_tag( -1, -1, wholestring => 1 ); + + my $sub = $str->substr( 4, 3 ); + ok( my $e = $sub->get_tag_extent( 1, "wholestring" ), 'sub has wholestring tag' ); + if( $e ) { + is( $e->start, 0, 'wholestring tag starts at 0' ); + is( $e->length, 3, 'wholestring tag is 3 long' ); + }; +} + done_testing; |