Author: ericwilhelm
Date: Sun Nov 11 13:31:09 2007
New Revision: 10227
Modified:
Module-Build/trunk/t/lib/DistGen.pm
Log:
t/lib/DistGen.pm - moved undent(), added scoped() function
Modified: Module-Build/trunk/t/lib/DistGen.pm
==============================================================================
--- Module-Build/trunk/t/lib/DistGen.pm (original)
+++ Module-Build/trunk/t/lib/DistGen.pm Sun Nov 11 13:31:09 2007
@@ -34,6 +34,24 @@
);
}
+# not methods
+*ScopeGuard::DESTROY = sub {
+ my $self = shift;
+ return unless($self and @$self);
+ $self->[0]->()
+};
+sub scoped { my ($sub) = @_; bless([$sub], 'ScopeGuard'); }
+
+sub undent {
+ my ($string) = @_;
+
+ my ($space) = $string =~ m/^(\s+)/;
+ $string =~ s/^$space//gm;
+
+ return($string);
+}
+########################################################################
+
sub new {
my $package = shift;
my %options = @_;
@@ -62,16 +80,6 @@
return $self;
}
-# not a method
-sub undent {
- my ($string) = @_;
-
- my ($space) = $string =~ m/^(\s+)/;
- $string =~ s/^$space//gm;
-
- return($string);
-}
-
sub _gen_default_filedata {
my $self = shift;