[interchange-cvs] interchange - jon modified lib/Vend/Interpolate.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Tue May 13 02:53:13 UTC 2008
User: jon
Date: 2008-05-13 02:53:13 GMT
Modified: lib/Vend Interpolate.pm
Log:
Optimize empty [perl] blocks.
Skip costly eval of code entirely if perl tag was called with no code,
as is often done for the side-effect of opening database handles.
Revision Changes Path
2.302 interchange/lib/Vend/Interpolate.pm
rev 2.302, prev_rev 2.301
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.301
retrieving revision 2.302
diff -u -u -r2.301 -r2.302
--- Interpolate.pm 12 May 2008 16:08:43 -0000 2.301
+++ Interpolate.pm 13 May 2008 02:53:13 -0000 2.302
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#
-# $Id: Interpolate.pm,v 2.301 2008-05-12 16:08:43 mheins Exp $
+# $Id: Interpolate.pm,v 2.302 2008-05-13 02:53:13 jon Exp $
#
# Copyright (C) 2002-2008 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.301 $, 10);
+$VERSION = substr(q$Revision: 2.302 $, 10);
@EXPORT = qw (
@@ -1656,7 +1656,16 @@
};
}
- #$hole->wrap($Tag);
+ $Items = $Vend::Items;
+
+ $body = readfile($opt->{file}) . $body
+ if $opt->{file};
+
+ # Skip costly eval of code entirely if perl tag was called with no code,
+ # likely used only for the side-effect of opening database handles
+ return if $body !~ /\S/;
+
+ $body =~ tr/\r//d if $Global::Windows;
$MVSAFE::Safe = 1;
if (
@@ -1668,13 +1677,6 @@
$MVSAFE::Safe = 0 unless $MVSAFE::Unsafe;
}
- $body = readfile($opt->{file}) . $body
- if $opt->{file};
-
- $body =~ tr/\r//d if $Global::Windows;
-
- $Items = $Vend::Items;
-
if(! $MVSAFE::Safe) {
$result = eval($body);
}
More information about the interchange-cvs
mailing list