{"id":19640326,"url":"https://github.com/kentnl/dist-zilla-util-configdumper","last_synced_at":"2025-07-29T02:37:26.630Z","repository":{"id":19960841,"uuid":"23227747","full_name":"kentnl/Dist-Zilla-Util-ConfigDumper","owner":"kentnl","description":"Easy implementation of 'dumpconfig'","archived":false,"fork":false,"pushed_at":"2017-03-18T08:02:02.000Z","size":198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T22:44:45.664Z","etag":null,"topics":["dist-zilla","perl"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kentnl.png","metadata":{"files":{"readme":"README.mkdn","changelog":"Changes","contributing":"CONTRIBUTING.pod","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-22T14:18:10.000Z","updated_at":"2017-03-01T22:29:56.000Z","dependencies_parsed_at":"2022-08-29T05:01:25.728Z","dependency_job_id":null,"html_url":"https://github.com/kentnl/Dist-Zilla-Util-ConfigDumper","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/kentnl/Dist-Zilla-Util-ConfigDumper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Util-ConfigDumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Util-ConfigDumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Util-ConfigDumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Util-ConfigDumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentnl","download_url":"https://codeload.github.com/kentnl/Dist-Zilla-Util-ConfigDumper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Util-ConfigDumper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267620270,"owners_count":24116744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dist-zilla","perl"],"created_at":"2024-11-11T14:05:22.989Z","updated_at":"2025-07-29T02:37:26.605Z","avatar_url":"https://github.com/kentnl.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nDist::Zilla::Util::ConfigDumper - A Dist::Zilla plugin configuration extraction utility\n\n# VERSION\n\nversion 0.003010\n\n# SYNOPSIS\n\n    ...\n\n    with 'Dist::Zilla::Role::Plugin';\n    use Dist::Zilla::Util::ConfigDumper qw( config_dumper );\n\n    around dump_config =\u003e config_dumper( __PACKAGE__, qw( foo bar baz ) );\n\n# DESCRIPTION\n\nThis module contains a utility function for use within the `Dist::Zilla`\nplugin ecosystem, to simplify extraction of plugin settings for plugin\nauthors, in order for plugins like `Dist::Zilla::Plugin::MetaConfig` to expose\nthose values to consumers.\n\nPrimarily, it specializes in:\n\n- Making propagating configuration from the plugins inheritance hierarchy\nnearly foolproof.\n- Providing simple interfaces to extract values of lists of named methods\nor accessors\n- Providing a way to intelligently and easily probe the value of lazy\nattributes without triggering their vivification.\n\n# FUNCTIONS\n\n## `config_dumper`\n\n    config_dumper( __PACKAGE__, qw( method list ) );\n\nReturns a function suitable for use with `around dump_config`.\n\n    my $sub = config_dumper( __PACKAGE__, qw( method list ) );\n    around dump_config =\u003e $sub;\n\nOr\n\n    around dump_config =\u003e sub {\n      my ( $orig, $self, @args ) = @_;\n      return config_dumper(__PACKAGE__, qw( method list ))-\u003e( $orig, $self, @args );\n    };\n\nEither way:\n\n    my $function = config_dumper( $package_name_for_config, qw( methods to call on $self ));\n    my $hash = $function-\u003e( $function_that_returns_a_hash, $instance_to_call_methods_on, @somethinggoeshere );\n\n\u0026#x3d;~ All of this approximates:\n\n    around dump_config =\u003e sub {\n      my ( $orig , $self , @args ) = @_;\n      my $conf = $self-\u003e$orig( @args );\n      my $payload = {};\n\n      for my $method ( @methods ) {\n        try {\n          $payload-\u003e{ $method } = $self-\u003e$method();\n        };\n      }\n      $config-\u003e{+__PACKAGE__} = $payload;\n    }\n\nExcept with some extra \"things dun goofed\" handling.\n\n## `dump_plugin`\n\nThis function serves the other half of the equation, emulating `dzil`'s own\ninternal behavior for extracting the `plugin` configuration data.\n\n    for my $plugin ( @{ $zilla-\u003eplugins } ) {\n      pp( dump_plugin( $plugin )); # could prove useful somewhere.\n    }\n\nIts not usually something you need, but its useful in:\n\n- Tests\n- Crazy Stuff like injecting plugins\n- Crazy Stuff like having \"Child\" plugins\n\nThis serves to be a little more complicated than merely calling `-\u003edump_config`,\nas the structure `dzil` uses is:\n\n    {\n      class   =\u003e ...\n      name    =\u003e ...\n      version =\u003e ...\n      config  =\u003e $dump_config_results_here\n    }\n\nAnd of course, there's a bunch of magic stuff with `meta`, `can` and `if keys %$configresults`\n\nAll that insanity is wrapped in this simple interface.\n\n# ADVANCED USE\n\n## CALLBACKS\n\nInternally\n\n    config_dumper( $pkg, qw( method list ) );\n\nMaps to a bunch of subs, so its more like:\n\n    config_dumper( $pkg, sub {\n      my ( $instance, $payload ) = @_;\n      $payload-\u003e{'method'} = $instance-\u003emethod;\n    }, sub {\n      $_[1]-\u003e{'list'} = $_[0]-\u003elist;\n    });\n\nSo if you want to use that because its more convenient for some problem, be my guest.\n\n    around dump_config =\u003e config_dumper( __PACKAGE__, sub {\n      $_[1]-\u003e{'x'} = 'y'\n    });\n\nis much less ugly than\n\n    around dump_config =\u003e sub {\n      my ( $orig, $self, @args ) = @_;\n      my $conf = $self-\u003e$orig(@args);\n      $config-\u003e{+__PACKAGE__} = { # if you forget the +, things break\n         'x' =\u003e 'y'\n      };\n      return $config;\n    };\n\n## DETAILED CONFIGURATION\n\nThere's an additional feature for advanced people:\n\n    config_dumper( $pkg, \\%config );\n\n### `attrs`\n\n    config_dumper( $pkg, { attrs =\u003e [qw( foo bar baz )] });\n\nThis is for cases where you want to deal with `Moose` attributes,\nbut want added safety of **NOT** loading attributes that have no value yet.\n\nFor each item in `attrs`, we'll call `Moose` attribute internals to determine\nif the attribute named has a value, and only then will we fetch it.\n\n# AUTHOR\n\nKent Fredric \u003ckentnl@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2017 by Kent Fredric \u003ckentfredric@gmail.com\u003e.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentnl%2Fdist-zilla-util-configdumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentnl%2Fdist-zilla-util-configdumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentnl%2Fdist-zilla-util-configdumper/lists"}