]> mj.ucw.cz Git - temple.git/commitdiff
Added tracking of dependencies from MJ's web
authorMartin Mares <mj@ucw.cz>
Fri, 11 Feb 2011 15:23:33 +0000 (16:23 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 11 Feb 2011 15:23:33 +0000 (16:23 +0100)
It is up to external modules to read the list of dependencies
and process it somehow.

UCW/Temple.pm

index 7224ac4e717c637bb81f3a05b61ddb60b82de8f3..eded62400cf6ebbaef4f4a4a702925a5b86cd1ad 100644 (file)
@@ -24,6 +24,12 @@ sub out {
        return;
 }
 
+our %deps = ();
+
+sub add_depend($) {
+       $deps{$_[0]} = 1;
+}
+
 sub get_nested($$$) {
        my ($r,$left,$right) = @_;
        pos $$r = pos($$r)-1;
@@ -134,6 +140,7 @@ sub parse_string($) {
 
 sub parse_file($) {
        my ($name) = @_;
+       add_depend($name);
        my $fh = new IO::File $name;
        die "Unable to open $name: $!" unless defined $fh;
        my $text;
@@ -190,6 +197,7 @@ sub include {
 sub load {
        my $f = shift @_;
        (!defined($f) || @_) and die "\@load requires only one argument";
+       UCW::Temple::add_depend($f);
        require $f;
        return;
 }