From 33f59d74c3c1b5e70fdcaaa20b8f5fc605a8d4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sun, 30 Oct 2011 20:42:35 +0100 Subject: [PATCH] Optimize Dist::Zilla::Util startup Load Pod::Eventual at runtime only if abstract_from_file is used. This improves 'dzil authordeps' speed. --- lib/Dist/Zilla/Util.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index 8a4256141..1f32e95b7 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -10,9 +10,16 @@ use String::RewritePrefix 0.002; # better string context behavior { package Dist::Zilla::Util::PEA; - use Pod::Eventual 0.091480; # better nonpod/blank events - use base 'Pod::Eventual'; - sub _new { bless {} => shift; } + @Dist::Zilla::Util::PEA::ISA = ('Pod::Eventual'); + sub _new { + # Load Pod::Eventual only when used (and not yet loaded) + unless (exists $INC{'Pod/Eventual.pm'}) { + require Pod::Eventual; + Pod::Eventual->VERSION(0.091480); # better nonpod/blank events + } + + bless {} => shift; + } sub handle_nonpod { my ($self, $event) = @_; return if $self->{abstract};