From a3133f6075d6fb174113c939ac5ee15ea19a4dba Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 25 Nov 2017 19:12:02 +0000 Subject: [PATCH 1/1] Perlcritic compliance + bump version and update Changes --- Changes | 4 +++ MANIFEST | 2 ++ README | 4 +-- lib/Audio/Opusfile.pm | 39 +++++++++++------------------ lib/Audio/Opusfile/Head.pm | 2 +- lib/Audio/Opusfile/PictureTag.pm | 2 +- lib/Audio/Opusfile/Tags.pm | 2 +- t/perlcritic.t | 11 ++++++++ t/perlcriticrc | 43 ++++++++++++++++++++++++++++++++ 9 files changed, 79 insertions(+), 30 deletions(-) create mode 100644 t/perlcritic.t create mode 100644 t/perlcriticrc diff --git a/Changes b/Changes index ef62290..a00356e 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for Perl extension Audio::Opusfile. +1.000 2017-11-25T19:12+00:00 + - Mark as stable + - Make dist perlcritic-compliant + 0.005001 2017-02-18T17:53+00:00 - Export op_current_link - More functions die on error diff --git a/MANIFEST b/MANIFEST index c5ea090..f3ef890 100644 --- a/MANIFEST +++ b/MANIFEST @@ -7,6 +7,8 @@ ppport.h typemap README t/Audio-Opusfile.t +t/perlcritic.t +t/perlcriticrc fallback/const-c.inc fallback/const-xs.inc lib/Audio/Opusfile.pm diff --git a/README b/README index 19299c6..42ed3fa 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -Audio-Opusfile version 0.005001 -=============================== +Audio-Opusfile version 1.000 +============================ Opus is a totally open, royalty-free, highly versatile audio codec. Opus is unmatched for interactive speech and music transmission over diff --git a/lib/Audio/Opusfile.pm b/lib/Audio/Opusfile.pm index 5d1e80e..bfd4a13 100644 --- a/lib/Audio/Opusfile.pm +++ b/lib/Audio/Opusfile.pm @@ -46,29 +46,20 @@ my @constants = our @EXPORT_OK = @constants; our @EXPORT = @constants; -our $VERSION = '0.005001'; - -sub AUTOLOAD { - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. - - my $constname; - our $AUTOLOAD; - ($constname = $AUTOLOAD) =~ s/.*:://; - croak "&Audio::Opusfile::constant not defined" if $constname eq 'constant'; - my ($error, $val) = constant($constname); - if ($error) { croak $error; } - { - no strict 'refs'; - # Fixed between 5.005_53 and 5.005_61 -#XXX if ($] >= 5.00561) { -#XXX *$AUTOLOAD = sub () { $val }; -#XXX } -#XXX else { - *$AUTOLOAD = sub { $val }; -#XXX } - } - goto &$AUTOLOAD; +our $VERSION = '1.000'; + +sub AUTOLOAD { ## no critic (ProhibitAutoloading) + my $constname; + our $AUTOLOAD; + ($constname = $AUTOLOAD) =~ s/.*:://s; + croak '&Audio::Opusfile::constant not defined' if $constname eq 'constant'; + my ($error, $val) = constant($constname); + if ($error) { croak $error; } + { + no strict 'refs'; ## no critic (ProhibitNoStrict) + *$AUTOLOAD = sub { $val }; + } + goto &$AUTOLOAD; } require XSLoader; @@ -77,8 +68,6 @@ require Audio::Opusfile::Head; require Audio::Opusfile::Tags; require Audio::Opusfile::PictureTag; -# Preloaded methods go here. - sub new_from_file { my ($class, $file) = @_; open_file($file) diff --git a/lib/Audio/Opusfile/Head.pm b/lib/Audio/Opusfile/Head.pm index d27ccc3..af48a38 100644 --- a/lib/Audio/Opusfile/Head.pm +++ b/lib/Audio/Opusfile/Head.pm @@ -5,7 +5,7 @@ use 5.014000; use strict; use warnings; -our $VERSION = '0.005001'; +our $VERSION = '1.000'; 1; __END__ diff --git a/lib/Audio/Opusfile/PictureTag.pm b/lib/Audio/Opusfile/PictureTag.pm index f81215d..560e70b 100644 --- a/lib/Audio/Opusfile/PictureTag.pm +++ b/lib/Audio/Opusfile/PictureTag.pm @@ -6,7 +6,7 @@ use strict; use warnings; use subs qw/parse/; -our $VERSION = '0.005001'; +our $VERSION = '1.000'; sub new { parse $_[1] } diff --git a/lib/Audio/Opusfile/Tags.pm b/lib/Audio/Opusfile/Tags.pm index 6c1e8df..0c877cc 100644 --- a/lib/Audio/Opusfile/Tags.pm +++ b/lib/Audio/Opusfile/Tags.pm @@ -6,7 +6,7 @@ use strict; use warnings; use subs qw/query query_count/; -our $VERSION = '0.005001'; +our $VERSION = '1.000'; sub query_all { my ($tags, $tag) = @_; diff --git a/t/perlcritic.t b/t/perlcritic.t new file mode 100644 index 0000000..e7a044a --- /dev/null +++ b/t/perlcritic.t @@ -0,0 +1,11 @@ +#!/usr/bin/perl +use v5.14; +use warnings; + +use Test::More; + +BEGIN { plan skip_all => '$ENV{RELEASE_TESTING} is false' unless $ENV{RELEASE_TESTING} } + +use Test::Perl::Critic -profile => 't/perlcriticrc'; + +all_critic_ok; diff --git a/t/perlcriticrc b/t/perlcriticrc new file mode 100644 index 0000000..1e7f484 --- /dev/null +++ b/t/perlcriticrc @@ -0,0 +1,43 @@ +severity = 1 + +[-BuiltinFunctions::ProhibitComplexMappings] +[-CodeLayout::RequireTidyCode] +[-ControlStructures::ProhibitPostfixControls] +[-ControlStructures::ProhibitUnlessBlocks] +[-Documentation::PodSpelling] +[-Documentation::RequirePodLinksIncludeText] +[-InputOutput::RequireBracedFileHandleWithPrint] +[-InputOutput::RequireCheckedClose] +[-InputOutput::RequireCheckedSyscalls] +[-Modules::ProhibitAutomaticExportation] +[-References::ProhibitDoubleSigils] +[-RegularExpressions::ProhibitEnumeratedClasses] +[-RegularExpressions::ProhibitUnusualDelimiters] +[-RegularExpressions::RequireBracesForMultiline] +[-RegularExpressions::RequireLineBoundaryMatching] +[-Subroutines::RequireFinalReturn] +[-ValuesAndExpressions::ProhibitConstantPragma] +[-ValuesAndExpressions::ProhibitEmptyQuotes] +[-ValuesAndExpressions::ProhibitLeadingZeros] +[-ValuesAndExpressions::ProhibitMagicNumbers] +[-ValuesAndExpressions::ProhibitNoisyQuotes] +[-Variables::ProhibitLocalVars] +[-Variables::ProhibitPackageVars] +[-Variables::ProhibitPunctuationVars] + +[BuiltinFunctions::ProhibitStringyEval] +allow_includes = 1 + +[RegularExpressions::RequireExtendedFormatting] +minimum_regex_length_to_complain_about = 20 + +[Documentation::RequirePodSections] +lib_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE +script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE + +[Subroutines::RequireArgUnpacking] +short_subroutine_statements = 5 +allow_subscripts = 1 + +[TestingAndDebugging::ProhibitNoWarnings] +allow_with_category_restriction = 1 -- 2.39.2