commit perl-Switch for openSUSE:Factory
Hello community, here is the log from the commit of package perl-Switch for openSUSE:Factory checked in at 2014-09-17 17:24:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Switch (Old) and /work/SRC/openSUSE:Factory/.perl-Switch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Switch" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Switch/perl-Switch.changes 2011-09-23 12:38:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Switch.new/perl-Switch.changes 2014-09-17 17:24:35.000000000 +0200 @@ -1,0 +2,10 @@ +Mon Sep 15 15:44:32 UTC 2014 - coolo@suse.com + +- updated to 2.17 + - tests fixed + - patch by Father Chrysostomos + - many warnings + - recommendation to use given/when +- removed upstreamed Switch-2.16-perl514.patch + +------------------------------------------------------------------- Old: ---- Switch-2.16-perl514.patch Switch-2.16.tar.gz New: ---- Switch-2.17.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Switch.spec ++++++ --- /var/tmp/diff_new_pack.xrVZyn/_old 2014-09-17 17:24:36.000000000 +0200 +++ /var/tmp/diff_new_pack.xrVZyn/_new 2014-09-17 17:24:36.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Switch # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,22 +16,21 @@ # - Name: perl-Switch -Version: 2.16 -Release: 4 -License: GPL-1.0+ or Artistic-1.0 +Version: 2.17 +Release: 0 %define cpan_name Switch -Summary: A switch statement for Perl -Url: http://search.cpan.org/dist/Switch/ +Summary: A switch statement for Perl, do not use if you can use given/when +License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl -Source: http://www.cpan.org/authors/id/R/RG/RGARCIA/%{cpan_name}-%{version}.tar.gz -# PATCH-FIX-UPSTREAM Switch-2.16-perl514.patch idoenmez@suse.de -- Fix test failures with Perl 5.14, RT #60380 -Patch1: Switch-2.16-perl514.patch +Url: http://search.cpan.org/dist/Switch/ +Source: http://www.cpan.org/authors/id/C/CH/CHORNY/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros +BuildRequires: perl(Text::Balanced) >= 2 +Requires: perl(Text::Balanced) >= 2 %{perl_requires} %description @@ -47,9 +46,63 @@ (including the 'case' statement described below). The block is unconditionally executed once the switch value has been cached. +A 'case' statement takes a single scalar argument (in mandatory parentheses +if it's a variable; otherwise the parens are optional) and selects the +appropriate type of matching between that argument and the current switch +value. The type of matching used is determined by the respective types of +the switch value and the 'case' argument, as specified in Table 1. If the +match is successful, the mandatory block associated with the 'case' +statement is executed. + +In most other respects, the 'case' statement is semantically identical to +an 'if' statement. For example, it can be followed by an 'else' clause, and +can be used as a postfix statement qualifier. + +However, when a 'case' block has been executed control is automatically +transferred to the statement after the immediately enclosing 'switch' +block, rather than to the next statement within the block. In other words, +the success of any 'case' statement prevents other cases in the same scope +from executing. But see the "Allowing fall-through" manpage below. + +Together these two new statements provide a fully generalized case +mechanism: + + use Switch; + + # AND LATER... + + %special = ( woohoo => 1, d'oh => 1 ); + + while (<>) { + chomp; + switch ($_) { + case (%special) { print "homer\n"; } # if $special{$_} + case /[a-z]/i { print "alpha\n"; } # if $_ =~ /a-z/i + case [1..9] { print "small num\n"; } # if $_ in [1..9] + case { $_[0] >= 10 } { print "big num\n"; } # if $_ >= 10 + print "must be punctuation\n" case /\W/; # if $_ ~= /\W/ + } + } + +Note that 'switch'es can be nested within 'case' (or any other) blocks, and +a series of 'case' statements can try different types of matches -- hash +membership, pattern match, array intersection, simple equality, etc. -- +against the same switch value. + +The use of intersection tests against an array reference is particularly +useful for aggregating integral cases: + + sub classify_digit + { + switch ($_[0]) { case 0 { return 'zero' } + case [2,4,6,8] { return 'even' } + case [1,3,5,7,9] { return 'odd' } + case /[A-F]/i { return 'hex' } + } + } + %prep %setup -q -n %{cpan_name}-%{version} -%patch1 -p1 %build %{__perl} Makefile.PL INSTALLDIRS=vendor @@ -63,9 +116,6 @@ %perl_process_packlist %perl_gen_filelist -%clean -%{__rm} -rf %{buildroot} - %files -f %{name}.files %defattr(-,root,root,755) %doc Changes README ++++++ Switch-2.16.tar.gz -> Switch-2.17.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/Changes new/Switch-2.17/Changes --- old/Switch-2.16/Changes 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/Changes 2014-03-18 13:21:21.000000000 +0100 @@ -119,3 +119,8 @@ 2.16 Fri Oct 23 2009 - For Perl 5.11+, install into 'site', not 'perl' +2.17 2014-03-18 + - tests fixed + - patch by Father Chrysostomos + - many warnings + - recommendation to use given/when diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/MANIFEST new/Switch-2.17/MANIFEST --- old/Switch-2.16/MANIFEST 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/MANIFEST 2014-03-18 13:28:27.000000000 +0100 @@ -7,3 +7,4 @@ t/nested.t t/switch.t META.yml Module meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/META.json new/Switch-2.17/META.json --- old/Switch-2.16/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Switch-2.17/META.json 2014-03-18 13:28:27.000000000 +0100 @@ -0,0 +1,51 @@ +{ + "abstract" : "A switch statement for Perl, do not use if you can use given/when", + "author" : [ + "Damian Conway", + "Rafael Garcia-Suarez", + "Alexandr Ciornii" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.131490", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Switch", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "Filter::Util::Call" : "0", + "Text::Balanced" : "2", + "if" : "0", + "perl" : "5.005" + } + } + }, + "release_status" : "stable", + "resources" : { + "repository" : { + "url" : "http://github.com/chorny/Switch" + } + }, + "version" : "2.17" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/META.yml new/Switch-2.17/META.yml --- old/Switch-2.16/META.yml 2009-10-23 09:53:25.000000000 +0200 +++ new/Switch-2.17/META.yml 2014-03-18 13:28:25.000000000 +0100 @@ -1,14 +1,29 @@ ---- #YAML:1.0 -name: Switch -version: 2.16 -abstract: ~ -license: ~ -author: ~ -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: - Filter::Util::Call: 0 - Text::Balanced: 0 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 +--- +abstract: 'A switch statement for Perl, do not use if you can use given/when' +author: + - Damian Conway + - Rafael Garcia-Suarez + - Alexandr Ciornii +build_requires: + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.131490' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Switch +no_index: + directory: + - t + - inc +requires: + Filter::Util::Call: 0 + Text::Balanced: 2 + if: 0 + perl: 5.005 +resources: + repository: http://github.com/chorny/Switch +version: 2.17 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/Makefile.PL new/Switch-2.17/Makefile.PL --- old/Switch-2.16/Makefile.PL 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/Makefile.PL 2014-03-18 13:28:17.000000000 +0100 @@ -1,7 +1,54 @@ -use ExtUtils::MakeMaker; -WriteMakefile( - NAME => q[Switch], - VERSION_FROM => q[Switch.pm], - PREREQ_PM => { 'Filter::Util::Call' => 0, 'Text::Balanced' => 0 }, - INSTALLDIRS => ($] >= 5.00703 && $] < 5.011) ? 'perl' : 'site', -); +use ExtUtils::MakeMaker; +WriteMakefile1( + LICENSE => 'perl', + MIN_PERL_VERSION => '5.005', + META_MERGE => { + resources => { + repository => 'http://github.com/chorny/Switch', + }, + }, + #BUILD_REQUIRES => { + #}, + + NAME => q[Switch], + VERSION_FROM => q[Switch.pm], + ABSTRACT_FROM => => q[Switch.pm], + AUTHOR => ['Damian Conway', 'Rafael Garcia-Suarez', 'Alexandr Ciornii'], + PREREQ_PM => { 'Filter::Util::Call' => 0, 'Text::Balanced' => 2, 'if' => 0, }, + INSTALLDIRS => ($] >= 5.00703 && $] < 5.011) ? 'perl' : 'site', + $^O =~/win/i ? ( + dist => { + TAR => 'ptar', + TARFLAGS => '-c -C -f', + }, + ) : (), +); + +sub WriteMakefile1 { #Compatibility code for old versions of EU::MM. Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade. + my %params=@_; + my $eumm_version=$ExtUtils::MakeMaker::VERSION; + $eumm_version=eval $eumm_version; + die "EXTRA_META is deprecated" if exists $params{EXTRA_META}; + die "License not specified" if not exists $params{LICENSE}; + if ($params{AUTHOR} and ref($params{AUTHOR}) eq 'ARRAY' and $eumm_version < 6.5705) { + $params{META_ADD}->{author}=$params{AUTHOR}; + $params{AUTHOR}=join(', ',@{$params{AUTHOR}}); + } + if ($params{TEST_REQUIRES} and $eumm_version < 6.64) { + $params{BUILD_REQUIRES}={ %{$params{BUILD_REQUIRES} || {}} , %{$params{TEST_REQUIRES}} }; + delete $params{TEST_REQUIRES}; + } + if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) { + #EUMM 6.5502 has problems with BUILD_REQUIRES + $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} }; + delete $params{BUILD_REQUIRES}; + } + delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52; + delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48; + delete $params{META_MERGE} if $eumm_version < 6.46; + delete $params{META_ADD} if $eumm_version < 6.46; + delete $params{LICENSE} if $eumm_version < 6.31; + + WriteMakefile(%params); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/README new/Switch-2.17/README --- old/Switch-2.16/README 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/README 2014-03-18 13:23:01.000000000 +0100 @@ -1,10 +1,10 @@ ============================================================================== - Release of version 2.16 of Switch + Release of version 2.17 of Switch ============================================================================== NAME - Switch - A switch statement for Perl + Switch - A switch statement for Perl, do not use if you can use given/when DESCRIPTION @@ -17,8 +17,8 @@ AUTHOR Damian Conway (damian@conway.org) - Maintained by Rafael Garcia-Suarez (rgarciasuarez@gmail.com) - and the Perl 5 porters (perl5-porters@gmail.com) + Maintained by Alexandr Ciornii (alexchorny@gmail.com) + Previously was maintained by Rafael Garcia-Suarez and perl5 porters. COPYRIGHT Copyright (c) 1997-2008, Damian Conway. All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/Switch.pm new/Switch-2.17/Switch.pm --- old/Switch-2.16/Switch.pm 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/Switch.pm 2014-03-18 13:24:00.000000000 +0100 @@ -1,12 +1,13 @@ package Switch; +use 5.005; use strict; use vars qw($VERSION); use Carp; use if $] >= 5.011, 'deprecate'; -$VERSION = '2.16'; +$VERSION = '2.17'; # LOAD FILTERING MODULE... @@ -146,7 +147,7 @@ die "Bad $keyword statement (problem in the code block?) near $Switch::file line ", line(substr($source,0, pos $source), $line), "\n"; }; my $code = filter_blocks(substr($source,$pos[0],$pos[4]-$pos[0]),line(substr($source,0,$pos[0]),$line)); - $code =~ s/{/{ local \$::_S_W_I_T_C_H; Switch::switch $arg;/; + $code =~ s/{/{ local \$::_S_W_I_T_C_H; Switch::switch($arg);/; $text .= $code . 'continue {last}'; next component; } @@ -506,7 +507,7 @@ =head1 NAME -Switch - A switch statement for Perl +Switch - A switch statement for Perl, do not use if you can use given/when =head1 SYNOPSIS @@ -841,15 +842,22 @@ =head1 AUTHOR -Damian Conway (damian@conway.org). This module is now maintained by Rafael -Garcia-Suarez (rgarciasuarez@gmail.com) and more generally by the Perl 5 -Porters (perl5-porters@perl.org), as part of the Perl core. +Damian Conway (damian@conway.org). This module is now maintained by +Alexandr Ciornii (alexchorny@gmail.com). Previously was maintained by +Rafael Garcia-Suarez and perl5 porters. =head1 BUGS There are undoubtedly serious bugs lurking somewhere in code this funky :-) Bug reports and other feedback are most welcome. +May create syntax errors in other parts of code. + +On perl 5.10.x may cause syntax error if "case" is present inside heredoc. + +In general, use given/when instead. It were introduced in perl 5.10.0. +Perl 5.10.0 was released in 2007. + =head1 LIMITATIONS Due to the heuristic nature of Switch.pm's source parsing, the presence of @@ -863,6 +871,10 @@ Due to the way source filters work in Perl, you can't use Switch inside an string C<eval>. +May not work if sub prototypes are used (RT#33988). + +Regex captures in when are not available to code. + If your source file is longer then 1 million characters and you have a switch statement that crosses the 1 million (or 2 million, etc.) character boundary you will get mysterious errors. The workaround is to @@ -873,3 +885,4 @@ Copyright (c) 1997-2008, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Switch-2.16/t/given.t new/Switch-2.17/t/given.t --- old/Switch-2.16/t/given.t 2009-10-23 09:52:51.000000000 +0200 +++ new/Switch-2.17/t/given.t 2014-03-17 13:52:30.000000000 +0100 @@ -16,11 +16,11 @@ # H.O. FUNCS -given __ > 2 { +given 2 { - when 1 { ok(0) } else { ok(1) } - when 2 { ok(0) } else { ok(1) } - when 3 { ok(1) } else { ok(0) } + when __ < 1 { ok(0) } else { ok(1) } + when __ < 2 { ok(0) } else { ok(1) } + when __ < 3 { ok(1) } else { ok(0) } } given (3) { -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de