{"id":19640318,"url":"https://github.com/kentnl/dist-zilla-role-tempdir","last_synced_at":"2026-06-15T05:33:54.265Z","repository":{"id":56833217,"uuid":"349599","full_name":"kentnl/Dist-Zilla-Role-Tempdir","owner":"kentnl","description":"Shell Out and collect the result in a DZ plug-in","archived":false,"fork":false,"pushed_at":"2017-03-10T12:10:00.000Z","size":309,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-09T18:56:39.723Z","etag":null,"topics":["dist-zilla","perl"],"latest_commit_sha":null,"homepage":"","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":"2009-10-26T02:44:15.000Z","updated_at":"2017-03-10T12:10:04.000Z","dependencies_parsed_at":"2022-09-08T07:41:32.403Z","dependency_job_id":null,"html_url":"https://github.com/kentnl/Dist-Zilla-Role-Tempdir","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Role-Tempdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Role-Tempdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Role-Tempdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FDist-Zilla-Role-Tempdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentnl","download_url":"https://codeload.github.com/kentnl/Dist-Zilla-Role-Tempdir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240947649,"owners_count":19883030,"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","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:21.289Z","updated_at":"2026-06-15T05:33:54.229Z","avatar_url":"https://github.com/kentnl.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nDist::Zilla::Role::Tempdir - Shell Out and collect the result in a DZ plug-in.\n\n# VERSION\n\nversion 1.001004\n\n# SYNOPSIS\n\n    package #\n      Dist::Zilla::Plugin::FooBar;\n\n    use Moose;\n    with 'Dist::Zilla::Role::FileInjector';\n    with 'Dist::Zilla::Role::InstallTool';\n    with 'Dist::Zilla::Role::Tempdir';\n\n    sub setup_installer {\n      my ( $self, $arg ) = @_ ;\n\n      my ( @generated_files ) = $self-\u003ecapture_tempdir(sub{\n        system( $somecommand );\n      });\n\n      for ( @generated_files ) {\n        if( $_-\u003eis_new \u0026\u0026 $_-\u003ename =~ qr/someregex/ ){\n          $self-\u003eadd_file( $_-\u003efile );\n        }\n      }\n    }\n\nThis role is a convenience role for factoring into other plug-ins to use the power of Unix\nin any plug-in.\n\nIf for whatever reason you need to shell out and run your own app that is not Perl ( i.e.: Java )\nto go through the code and make modifications, produce documentation, etc, then this role is for you.\n\nImportant to note however, this role **ONLY** deals with getting `Dist::Zilla`'s state written out to disk,\nexecuting your given arbitrary code, and then collecting the results. At no point does it attempt to re-inject\nthose changes back into [`Dist::Zilla`](https://metacpan.org/pod/Dist::Zilla). That is left as an exercise to the plug-in developer.\n\n# METHODS\n\n## capture\\_tempdir\n\nCreates a temporary and dumps the current state of Dist::Zilla's files into it.\n\nRuns the specified code sub `chdir`'ed into that `tmpdir`, and captures the changed files.\n\n    my ( @array ) = $self-\u003ecapture_tempdir(sub{\n\n    });\n\nResponse is an array of [`::Tempdir::Item`](https://metacpan.org/pod/Dist::Zilla::Tempdir::Item)\n\n    [ bless( { name =\u003e 'file/Name/Here' ,\n       status =\u003e 'O' # O = Original, N = New, M = Modified, D = Deleted\n       file   =\u003e Dist::Zilla::Role::File object\n     }, 'Dist::Zilla::Tempdir::Item' ) , bless ( ... ) ..... ]\n\nMake sure to look at [`Dist::Zilla::Tempdir::Item`](https://metacpan.org/pod/Dist::Zilla::Tempdir::Item) for usage.\n\n# SEE ALSO\n\n- [`Dist::Zilla::Tempdir::Item`](https://metacpan.org/pod/Dist::Zilla::Tempdir::Item)\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-role-tempdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentnl%2Fdist-zilla-role-tempdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentnl%2Fdist-zilla-role-tempdir/lists"}