From 45e71cc493acfa83b325db87602872240548578a Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Fri, 8 Jan 2010 12:13:37 +0100 Subject: [PATCH] If there is a cache directory, save there all compiled code. --- Art5.pm | 8 ++++++++ art5 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Art5.pm b/Art5.pm index efb3a31..22e3df8 100644 --- a/Art5.pm +++ b/Art5.pm @@ -193,6 +193,14 @@ sub code { # compile if available if (defined($src)) { $self->{op}->{$op} = $self->compile($src); + + # if there is a cache directory, save the compiled code + if ($self->{cache} and open(F, '>' . $self->{cache} . $op)) { + use Data::Dumper; + + print F Dumper($self->{op}->{$op}); + close F; + } } } diff --git a/art5 b/art5 index 3892f51..bed7034 100755 --- a/art5 +++ b/art5 @@ -23,7 +23,7 @@ if (!defined($s)) { $s = join('', <>); } -my $a = Art5->new( path => \@path); +my $a = Art5->new( path => \@path, cache => '/tmp/art5/'); my $c = $a->compile($s); -- 2.11.4.GIT