]> mj.ucw.cz Git - temple.git/commitdiff
Added "set" function for setting of template variables from outside
authorMartin Mares <mj@ucw.cz>
Wed, 12 Aug 2015 10:20:33 +0000 (12:20 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 12 Aug 2015 10:20:33 +0000 (12:20 +0200)
This is basically an easy way to get around strictness warnings.

UCW/Temple.pm

index e1a21e305b3a032a2aed33b726f7f86a9e7d8de7..ad4f021e6e54ff8c7b17371b3196eb62ee7d1040 100644 (file)
@@ -11,7 +11,7 @@ require Exporter;
 our $VERSION = 1.0;
 our @ISA = qw(Exporter);
 our @EXPORT = qw(out);
-our @EXPORT_OK = qw();
+our @EXPORT_OK = qw(set);
 
 use IO::File;
 
@@ -23,6 +23,13 @@ sub out {
        return;
 }
 
+sub set {
+       my ($var, $val) = @_;
+       $var = "T::$var";
+       no strict 'refs';
+       $$var = $val;
+}
+
 our %deps = ();
 
 sub add_depend($) {