diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c0afb70 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +indent_style = space +indent_size = 4 + +end_of_line = lf +charset = utf-8 + +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yml,yaml}] +indent_size = 2 +quote_type = single + +[Changes] +indent_size = 2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d42b81e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,182 @@ +name: Test +on: + push: ~ + pull_request: ~ + +jobs: + perl-versions: + runs-on: ubuntu-latest + name: Calculate Perl Versions + outputs: + versions: ${{ steps.perl-versions.outputs.perl-versions }} + steps: + - uses: actions/checkout@v4 + - name: Extract perl dependecy + id: prereqs + uses: perl-actions/get-prereqs@v1 + with: + sources: prereqs.yml + - id: perl-versions + uses: perl-actions/perl-versions@v1 + with: + since-perl: ${{ steps.prereqs.outputs.perl }} + with-devel: true + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: ~/.perl-cpm + key: cpm-${{ runner.os }} + - name: Setup local::lib + run: | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + - name: Extract Dist::Zilla dependencies + id: authordeps + uses: perl-actions/get-prereqs@v1 + with: + sources: dist.ini + phases: author + - name: Install authordeps + uses: perl-actions/install-with-cpm@v1 + with: + sudo: false + install: ${{ steps.authordeps.outputs.prereqs }} + - name: Build + id: build + run: | + DZIL_COLOR=1 dzil build --no-tgz | tee "/tmp/dzil-build.log" + echo build="$(grep --only-matching 'built in .*' "/tmp/dzil-build.log" | tail -1 | cut -c10-)" >> "$GITHUB_OUTPUT" + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build.outputs.build }} + path: ${{ steps.build.outputs.build }} + include-hidden-files: true + outputs: + name: ${{ steps.build.outputs.build }} + + test: + needs: + - perl-versions + - build + + strategy: + fail-fast: false + matrix: + perl-version: ${{ fromJson(needs.perl-versions.outputs.versions) }} + + runs-on: ubuntu-latest + container: + image: perl:${{ matrix.perl-version }}-buster + + env: + AUTOMATED_TESTING: 1 + PERL_USE_UNSAFE_INC: 0 + + steps: + - name: Download build + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.name }} + - uses: actions/cache@v4 + with: + path: ~/.perl-cpm + key: cpm-perl:${{ matrix.perl-version }}-buster + - name: Setup local::lib + run: | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + - name: Extract configure dependecies + id: configure + uses: perl-actions/get-prereqs@v1 + with: + phases: configure + - name: Install configure deps + uses: perl-actions/install-with-cpm@v1 + with: + sudo: false + install: ${{ steps.configure.outputs.prereqs }} + - name: Run Makefile.PL + run: perl Makefile.PL + - name: Extract dependecies + id: prereqs + uses: perl-actions/get-prereqs@v1 + with: + phases: build test runtime + relationships: requires recommends suggests + - name: Install deps + uses: perl-actions/install-with-cpm@v1 + with: + sudo: false + install: ${{ steps.prereqs.outputs.prereqs }} + - name: Run the tests + run: make test + env: + AUTHOR_TESTING: 1 + + test-xt: + needs: + - perl-versions + - build + + runs-on: ubuntu-latest + container: + image: perl:5.36-buster + + env: + AUTOMATED_TESTING: 1 + + steps: + - name: Download build + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.name }} + - uses: actions/cache@v4 + with: + path: ~/.perl-cpm + key: cpm-perl:5.36-buster + - name: Setup local::lib + run: | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" + - name: Extract configure dependecies + id: configure + uses: perl-actions/get-prereqs@v1 + with: + phases: configure + - name: Install configure deps + uses: perl-actions/install-with-cpm@v1 + with: + sudo: false + install: ${{ steps.configure.outputs.prereqs }} + - name: Run Makefile.PL + run: perl Makefile.PL + - name: Extract dependecies + id: prereqs + uses: perl-actions/get-prereqs@v1 + with: + phases: build test runtime develop + relationships: requires recommends suggests + - name: Install deps + uses: perl-actions/install-with-cpm@v1 + with: + sudo: false + install: ${{ steps.prereqs.outputs.prereqs }} + - name: Run the xt tests + run: prove -l xt + env: + AUTHOR_TESTING: 1 + - name: Run the xt/author tests + run: prove -lr xt/author + env: + AUTHOR_TESTING: 1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..829b42f --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +/MANIFEST.bak +/Makefile.old +/Makefile +/blib/ +/pm_to_blib +/MYMETA.json +/MYMETA.yml +/cover_db/ +/MYMETA.json.lock +/MANIFEST +/.build/ +/Catalyst-Action-RenderView-*.tar.gz +/Catalyst-Action-RenderView-*/ diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 0000000..faea4f1 --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,81 @@ +severity = 1 +verbose = 9 +only = 1 + +[BuiltinFunctions::ProhibitLvalueSubstr] +[BuiltinFunctions::ProhibitShiftRef] +[BuiltinFunctions::ProhibitSleepViaSelect] +[BuiltinFunctions::ProhibitStringyEval] +[BuiltinFunctions::ProhibitUniversalCan] +[BuiltinFunctions::ProhibitUniversalIsa] +[BuiltinFunctions::ProhibitVoidGrep] +[BuiltinFunctions::ProhibitVoidMap] +[BuiltinFunctions::RequireGlobFunction] +[BuiltinFunctions::RequireSimpleSortBlock] +[ClassHierarchies::ProhibitOneArgBless] +[CodeLayout::ProhibitHardTabs] +[CodeLayout::RequireConsistentNewlines] +[ControlStructures::ProhibitCascadingIfElse] +[ControlStructures::ProhibitDeepNests] +[ControlStructures::ProhibitLabelsWithSpecialBlockNames] +[ControlStructures::ProhibitMutatingListFunctions] +[ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] +[ControlStructures::ProhibitUnreachableCode] +[ControlStructures::ProhibitYadaOperator] +[ErrorHandling::RequireCheckingReturnValueOfEval] +[InputOutput::ProhibitBacktickOperators] +[InputOutput::ProhibitBarewordFileHandles] +[InputOutput::ProhibitExplicitStdin] +[InputOutput::ProhibitInteractiveTest] +[InputOutput::ProhibitJoinedReadline] +[InputOutput::ProhibitOneArgSelect] +[InputOutput::ProhibitReadlineInForLoop] +[InputOutput::ProhibitTwoArgOpen] +[InputOutput::RequireCheckedOpen] +[InputOutput::RequireEncodingWithUTF8Layer] +[Miscellanea::ProhibitFormats] +[Miscellanea::ProhibitUnrestrictedNoCritic] +[Modules::ProhibitAutomaticExportation] +[Modules::ProhibitConditionalUseStatements] +[Modules::ProhibitEvilModules] +[Modules::ProhibitExcessMainComplexity] +[Modules::RequireBarewordIncludes] +[Modules::RequireEndWithOne] +[Modules::RequireFilenameMatchesPackage] +[NamingConventions::ProhibitAmbiguousNames] +[Objects::ProhibitIndirectSyntax] +[RegularExpressions::ProhibitCaptureWithoutTest] +[RegularExpressions::ProhibitComplexRegexes] +[RegularExpressions::ProhibitUnusedCapture] +[Subroutines::ProhibitBuiltinHomonyms] +[Subroutines::ProhibitExcessComplexity] +max_mccabe = 30 +[Subroutines::ProhibitExplicitReturnUndef] +[Subroutines::ProhibitManyArgs] +[Subroutines::ProhibitNestedSubs] +[Subroutines::ProhibitReturnSort] +[Subroutines::ProhibitUnusedPrivateSubroutines] +[Subroutines::ProtectPrivateSubs] +[TestingAndDebugging::ProhibitProlongedStrictureOverride] +[TestingAndDebugging::RequireTestLabels] +[TestingAndDebugging::RequireUseStrict] +[TestingAndDebugging::RequireUseWarnings] +[ValuesAndExpressions::ProhibitCommaSeparatedStatements] +[ValuesAndExpressions::ProhibitComplexVersion] +[ValuesAndExpressions::ProhibitImplicitNewlines] +[ValuesAndExpressions::ProhibitLeadingZeros] +[ValuesAndExpressions::ProhibitMismatchedOperators] +[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] +[ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator] +[ValuesAndExpressions::RequireQuotedHeredocTerminator] +[Variables::ProhibitAugmentedAssignmentInDeclaration] +allow_our = 1 +[Variables::ProhibitConditionalDeclarations] +[Variables::ProhibitMatchVars] +[Variables::ProhibitReusedNames] +[Variables::ProhibitUnusedVariables] +[Variables::ProtectPrivateVars] +[Variables::RequireInitializationForLocalVars] +[Variables::RequireLexicalLoopIterators] +[Variables::RequireLocalizedPunctuationVars] +[Variables::RequireNegativeIndices] diff --git a/Changes b/Changes index 9557bd5..398fe60 100644 --- a/Changes +++ b/Changes @@ -1,59 +1,63 @@ +Revision history for Perl extension Catalyst-Action-RenderView + +{{ $NEXT }} + 0.16 2011-01-05 19:28:00 GMT - - Fix bug accidentally introduced in the last version with response - 3xx statuses. + - Fix bug accidentally introduced in the last version with response + 3xx statuses. 0.15 2011-01-04 14:19:36 CET - - Don't delegate to a view if the response body is set to `undef'. - - Make sure a Test::More with done_testing support is available. + - Don't delegate to a view if the response body is set to `undef'. + - Make sure a Test::More with done_testing support is available. 0.14 2009-12-03 03:13:23 GMT - - Remove warnings from tests about actions in the app root + - Remove warnings from tests about actions in the app root 0.13 2009-10-24 04:48:03 PDT - - Re-release 0.12 without changes for reindexing by CPAN/PAUSE. + - Re-release 0.12 without changes for reindexing by CPAN/PAUSE. 0.12 2009-10-18 19:10:00 BST - - Fixup copyright information + - Fixup copyright information 0.11 2009-06-28 19:29:16 - - Update Module::Install to 0.87 to unbreak auto_install. - No functional changes. + - Update Module::Install to 0.87 to unbreak auto_install. + No functional changes. 0.10 2009-04-29 18:24:50 - - Depend on Data::Visitor 0.24 to avoid Class::MOP deprecation - warnings. (Florian Ragwitz) + - Depend on Data::Visitor 0.24 to avoid Class::MOP deprecation + warnings. (Florian Ragwitz) 0.09 2009-02-18 21:32:00 - - Store config in $c->config->{'Action::RenderView'} - instead of $c->config->{debug}. - Config from $c->config->{debug} is deprecated, but - still supported. - - Switch from NEXT to next::method + - Store config in $c->config->{'Action::RenderView'} + instead of $c->config->{debug}. + Config from $c->config->{debug} is deprecated, but + still supported. + - Switch from NEXT to next::method 0.08 2008-05-02 19:40:00 - - Add AsCGI to list of test requirements. - - Check for defined()ness of $c->res->body so "0" is valid. (RT #30564) + - Add AsCGI to list of test requirements. + - Check for defined()ness of $c->res->body so "0" is valid. (RT #30564) 0.07 2007-09-01 11:03:00 - - Add DateTime to default list of scrubbed objects - - Stringify rather than ref by default , - more explicit message + - Add DateTime to default list of scrubbed objects + - Stringify rather than ref by default , + more explicit message 0.06 2007-08-29 16:35:00 - - Add support for scrubbing stash objects. - - Remove undef warning + - Add support for scrubbing stash objects. + - Remove undef warning 0.05 2007-04-26 - - switch to Module::Install + - switch to Module::Install 0.04 2006-07-04 09:21:00 - - That debug code wasn't quite production ready : / + - That debug code wasn't quite production ready : / 0.03 2006-07-02 11:26:00 - - Forgot to update use test as well, silly git. + - Forgot to update use test as well, silly git. 0.02 2006-06-29 14:59:00 - - Oops, moved content check ending brace up. + - Oops, moved content check ending brace up. 0.01 2006-06-26 17:14:00 - - Initial release + - Initial release diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..5b27fde --- /dev/null +++ b/dist.ini @@ -0,0 +1,109 @@ +name = Catalyst-Action-RenderView +copyright_year = 2006 - 2009 +license = Perl_5 +author = Marcus Ramberg +author = Florian Ragwitz +copyright_holder = Marcus Ramberg +copyright_holder = Florian Ragwitz + +;;; Gather +[Git::GatherDir] +exclude_filename = Makefile.PL +exclude_filename = META.json +exclude_filename = LICENSE +exclude_filename = README.md + +[GatherFile] +filename = .perlcriticrc + +;;; Metadata +[Git::Contributors] + +[MetaProvides::Package] + +[MetaResources] +bugtracker.url = https://github.com/perl-catalyst/Catalyst-Action-RenderView/issues +repository.url = https://github.com/perl-catalyst/Catalyst-Action-RenderView.git +repository.web = https://github.com/perl-catalyst/Catalyst-Action-RenderView +repository.type = git + +[PrereqsFile] + +[UseUnsafeInc] +dot_in_INC = 0 + +;;; Modification +[PodWeaver] +; authordep Pod::Weaver::Section::Contributors +; authordep Pod::Weaver::Plugin::StopWords + +;;; Extra Files +[License] +[MetaJSON] +[MetaYAML] +[Manifest] +[Pod2Readme] + +;;; Installer +[MakeMaker] + +[StaticInstall] +mode = on + +;;; Tests +[MetaTests] +[MojibakeTests] +[PodSyntaxTests] +[Test::CPAN::Changes] +[Substitute / RenameTestCPANChanges] +-version = 0.008 +file = xt/release/cpan-changes.t +filename_code = s{release}{author}; +[Test::ChangesHasContent] +[Test::Compile] +[Test::EOL] +[Test::Kwalitee] +filename = xt/author/kwalitee.t +[Test::MinimumVersion] +[Test::NoTabs] +[Test::Perl::Critic] +critic_config = .perlcriticrc +[Substitute / VerboseCritic] +file = xt/author/critic.t +code = s/ x!!.*;/;/; s/(-profile)/-verbose => 8, $1/; +[Test::Pod::Coverage::TrustMe] +[Test::PodSpelling] +[Test::Portability] +options = test_one_dot = 0 +[Test::ReportPrereqs] +[Test::Version] + +;;; Repo files +[CopyFilesFromRelease] +filename = Makefile.PL +filename = META.json +filename = LICENSE +[ReadmeAnyFromPod / ReadmeGFMInRoot] +phase = release + +[Regenerate::AfterReleasers] +plugin = CopyFilesFromRelease +plugin = ReadmeGFMInRoot + +;;; Release +[TestRelease] +[RunExtraTests] +[ConfirmRelease] +[UploadToCPAN] + +[Git::Check] +[Git::Remote::Check] +branch = master +[@Git::VersionManager] +-remove = Prereqs +commit_files_after_release = Makefile.PL +commit_files_after_release = META.json +commit_files_after_release = LICENSE +commit_files_after_release = README.md +NextRelease.format = %-6v %{yyyy-MM-dd}d%{ (TRIAL RELEASE)}T +[Git::Push] diff --git a/lib/Catalyst/Action/RenderView.pm b/lib/Catalyst/Action/RenderView.pm index 5de16ed..503075b 100644 --- a/lib/Catalyst/Action/RenderView.pm +++ b/lib/Catalyst/Action/RenderView.pm @@ -20,7 +20,7 @@ sub execute { $c->config->{'Action::RenderView'}->{ignore_classes} = ( ref($c->config->{'debug'}) eq 'HASH' ? $c->config->{'debug'}->{ignore_classes} : undef ) || [ qw/ - DBIx::Class::ResultSource::Table + DBIx::Class::ResultSource::Table DBIx::Class::ResultSourceHandle DateTime / ] unless exists $c->config->{'Action::RenderView'}->{ignore_classes}; @@ -58,6 +58,7 @@ sub execute { }; 1; +__END__ =head1 NAME @@ -100,16 +101,16 @@ See L. When you force debug with dump_info=1, RenderView is capable of removing classes from the objects in your stash. By default it will replace any DBIx::Class resultsource objects with the class name, which cleans up the -debug output considerably, but you can change what gets scrubbed by -setting a list of classes in +debug output considerably, but you can change what gets scrubbed by +setting a list of classes in $c->config->{'Action::RenderView'}->{ignore_classes}. For instance: - $c->config->{'Action::RenderView'}->{ignore_classes} = []; - -To disable the functionality. You can also set -config->{'Action::RenderView'}->{scrubber_func} to change what it does with the -classes. For instance, this will undef it instead of putting in the + $c->config->{'Action::RenderView'}->{ignore_classes} = []; + +To disable the functionality. You can also set +config->{'Action::RenderView'}->{scrubber_func} to change what it does with the +classes. For instance, this will undef it instead of putting in the class name: $c->config->{'Action::RenderView'}->{scrubber_func} = sub { undef $_ }; @@ -117,8 +118,8 @@ class name: =head2 Deprecation notice This plugin used to be configured by setting C<< $c->config->{debug} >>. -That configuration key is still supported in this release, but is -deprecated, please use the C< 'Action::RenderView' > namespace as shown +That configuration key is still supported in this release, but is +deprecated, please use the C< 'Action::RenderView' > namespace as shown above for configuration in new code. =head1 EXTENDING @@ -136,7 +137,7 @@ you can set it up like this: sub render : ActionClass('RenderView') { } - sub end : Private { + sub end : Private { my ( $self, $c ) = @_; $c->forward('render'); # do stuff here @@ -160,4 +161,3 @@ This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. =cut - diff --git a/prereqs.yml b/prereqs.yml new file mode 100644 index 0000000..d8bf018 --- /dev/null +++ b/prereqs.yml @@ -0,0 +1,9 @@ +runtime: + requires: + perl: 5.008005 + Catalyst::Runtime: 5.80030 + Data::Visitor: 0.24 + MRO::Compat: 0 +test: + requires: + Test::More: 0.88 diff --git a/weaver.ini b/weaver.ini new file mode 100644 index 0000000..e535f8e --- /dev/null +++ b/weaver.ini @@ -0,0 +1,12 @@ +[@CorePrep] +[-SingleEncoding] +[-StopWords] + +[Generic / NAME] + +[Leftovers] + +[Bugs] +[Authors] +[Contributors] +[Legal]