Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Load Archive::Tar only when used (in Dist::Builder, Plugin::TestRelease) #140

Closed
wants to merge 1 commit into from

2 participants

@dolmen

This patch replaces use Archive::Tar with appropriate require Archive::Tar in Dist::Zilla::Dist::Builder and Dist::Zilla::Plugin::TestRelease.
One less module loaded every time.

Thanks to Devel::TraceUse for the help:

perl -d:TraceUse -Ilib -MDist::Zilla -e '$Dist::Zilla::VERSION=$Dist::Zilla::Plugin::GatherDir::VERSION=4.300030; require "bin/dzil"' nop
@dolmen dolmen Load Archive::Tar only when used (in Dist::Builder, Plugin::TestRelease)
Replace 'use Archive::Tar' with appropriate 'require Archive::Tar'.
One less module loaded every time.
Thanks to Devel::TraceUse for the catch.
73916d1
@rjbs
Owner

mereged

@rjbs rjbs closed this
@dolmen dolmen referenced this pull request in dagolden/Dist-Zilla-Plugin-CheckExtraTests
Merged

Lazy load dependencies #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 22, 2013
  1. @dolmen

    Load Archive::Tar only when used (in Dist::Builder, Plugin::TestRelease)

    dolmen authored
    Replace 'use Archive::Tar' with appropriate 'require Archive::Tar'.
    One less module loaded every time.
    Thanks to Devel::TraceUse for the catch.
This page is out of date. Refresh to see the latest.
View
2  lib/Dist/Zilla/Dist/Builder.pm
@@ -7,7 +7,6 @@ use Moose::Autobox 0.09; # ->flatten
use MooseX::Types::Moose qw(HashRef);
use MooseX::Types::Path::Class qw(Dir File);
-use Archive::Tar;
use File::pushd ();
use Path::Class;
use Try::Tiny;
@@ -438,6 +437,7 @@ sub _build_archive {
$self->log("building archive with Archive::Tar; install Archive::Tar::Wrapper for improved speed");
+ require Archive::Tar;
my $archive = Archive::Tar->new;
my %seen_dir;
for my $distfile (
View
3  lib/Dist/Zilla/Plugin/TestRelease.pm
@@ -22,7 +22,6 @@ This plugin was originally contributed by Christopher J. Madsen.
=cut
-use Archive::Tar;
use File::pushd ();
use Moose::Autobox;
use Path::Class ();
@@ -38,6 +37,8 @@ sub before_release {
$self->log("Extracting $tgz to $tmpdir");
+ require Archive::Tar;
+
my @files = do {
my $wd = File::pushd::pushd($tmpdir);
Archive::Tar->extract_archive("$tgz");
Something went wrong with that request. Please try again.