]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
dev master
authorWill Budic <redacted>
Tue, 13 May 2025 09:24:57 +0000 (19:24 +1000)
committerWill Budic <redacted>
Tue, 13 May 2025 09:24:57 +0000 (19:24 +1000)
install_cpan_INSTALL_PREPARE_PROJECT_SETUP_FIRST.sh
system/modules/CNFGlobalFile.pm
system/modules/CNFParser.pm
tests/testTreeToHTML.pl

index 4fdf9070ef90dbfb0ba95719d8acb2a9505df1db..57f411632ef988b21ad8fd12be39bd00a1fd3081 100755 (executable)
@@ -22,15 +22,15 @@ sudo perl -MCPAN -e 'CPAN::install(local::lib)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(LWP)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Text::Levenshtein::XS)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::Term:)'
-sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::ReadKey)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::Screen)'
+sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::ReadKey)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Exception::Class)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(Syntax::Keyword::Try)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(JSON::XS)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBI)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::SQLite)'
-sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::Pg)'
-sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::mysql)'
+sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::Pg)'
+sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::mysql)'
 sudo perl -MCPAN -Mlocal::lib -e 'CPAN::install(CGI::Session)'
 
 sudo apt install libanyevent-perl libclass-refresh-perl libcompiler-lexer-perl \
index 944cade87544f4ee16017a7a4178e62a130727fc..3e8f7155c88d272bd3155d1145d5b0e53c72f744 100644 (file)
@@ -16,12 +16,9 @@ sub new ($class, $path) {
 sub content($self) {
     return _load($self) -> {content} ;
 }
-sub changed($self){
-    if(exists $self->{last_modified}){
-       my @cur = stat($self->{path});
-       return $cur[9] != $self->{last_modified} ? 1 : 0
-    }
-    return 1;
+sub changed($self){ return 1 if not $self->{last_modified}; #We return changed if doesn't exist.
+    my  @stats =  stat($self->{path});    
+    return $self->{last_modified} != $stats[9]
 }
 sub binary($self){
     _binary($self, *STDOUT)
index 125f0e4f7c4381fb6ad5405fdf11ab7642cc5f0d..6feddcf7fb1b0d9a9f8e4d1bc7a3515cac63bab4 100644 (file)
@@ -226,7 +226,7 @@ package PropertyValueStyle {
                     if(!$p){
                         $p = $itm;
                     }else{
-                        $itm =~ s/^\s*(['"])(.*)\g{1}$/$2/g if $itm;  $itm =~ s/\s*$//;                        
+                        $itm =~ s/^\s*(['"])(.*)\g{1}$/$2/g if $itm;  $itm =~ s/\s*$//;
                         $self->{$p}=$itm;
                         undef $p;
                     }
@@ -503,11 +503,11 @@ sub doInstruction { my ($self,$e,$t,$v) = @_;
         }
     }elsif($t eq 'FILE'){#@TODO Test case this
         $self->doLoadDataFile($e,$v);
-    }elsif($t eq 'INCLUDE'){
-        my $isMetaConst = $v =~ s/$meta_const//s;
+    }elsif($t eq 'INCLUDE'){        
         if (!$v){
-            $v=$e
+             $v=$e
         }else{
+            my $isMetaConst = $v =~ s/$meta_const//s;
             if ($isMetaConst){
                 $self -> {$e} = $v;
             }else{
@@ -521,7 +521,7 @@ sub doInstruction { my ($self,$e,$t,$v) = @_;
         }
         $includes[@includes] = {script=>$v,local=>$CUR_SCRIPT,loaded=>0, prc_last=>$prc_last};
     }elsif($t eq 'TREE'){
-        my  $tree = 0; 
+        my  $tree = 0;
         if( !$v ){
              $v = $e;
              $e = CNFMeta::ANN();
@@ -789,12 +789,11 @@ sub doDATAInstructions_{ my ($self,$e,$v,$t,$d)=@_;
 sub parse {  my ($self, $cnf_file, $content, $del_keys) = @_;
 
     my @tags;
-    $cnf_file = $cnf_file -> {path} if ref($cnf_file) eq 'CNFGlobalFile';
-
-    # We control from here the constances, as we need to unlock them if a previous parse was run.
+     # We control from here the constances, as we need to unlock them if a previous parse was run.
     unlock_hash(%$self);
 
     if(not $content){
+        $cnf_file = $cnf_file -> {path} if ref($cnf_file) eq 'CNFGlobalFile';
         open(my $fh, "<:perlio", $cnf_file )  or  die "Can't open $cnf_file -> $!";
            read $fh, $content, -s $fh;
         close   $fh;
@@ -1010,8 +1009,12 @@ sub parse {  my ($self, $cnf_file, $content, $del_keys) = @_;
     # Do scripted includes first. As these might set properties imported and processed used by the main script.
     if(@includes){
        $includes[@includes] = {script=>$CUR_SCRIPT,loaded=>1, prc_last=>0} if not includeContains($CUR_SCRIPT); #<- to prevent circular includes.
-       foreach (@includes){
-          $self -> doInclude($_) if $_ && not $_->{prc_last} and not $_->{loaded} and $_->{local} eq $CUR_SCRIPT;
+       my $hook = $self->{INCLUDES_LISTENER};
+       foreach my $include (@includes){
+          if ($include && not $include->{prc_last} and not $include->{loaded} and $include->{local} eq $CUR_SCRIPT){
+              $hook -> ($CUR_SCRIPT,$include->{script}) if $hook;
+              $self -> doInclude($include); #<- These might include new includes, not worried about to hook on, as would be to deep.
+          }
        }
     }
     # Do those autonumbering list anons, and for pre instruction processing prepare if have it.
@@ -1073,17 +1076,17 @@ sub parse {  my ($self, $cnf_file, $content, $del_keys) = @_;
                     $anechoic ->{$struct->name()} = $struct->process($self, $struct->script());
                     $self->log("Processed -> ".$struct->name()) if $self->{DEBUG}
                 }
-                    $splice[@splice] = $idx - @splice; 
+                    $splice[@splice] = $idx - @splice;
                 }elsif($type eq 'InstructedDataItem' && $priority > 0 && $priority < 5){
                     my $t = $struct->{ins};
                     if($t eq 'PLUGIN'){
                        instructPlugin($self, $struct);
-                       $splice[@splice] = $idx - @splice;                      
+                       $splice[@splice] = $idx - @splice;
                     }
                 }
             }
         }
-        
+
         foreach my $i(@splice){ splice(@items, $i, 1) }
 
         #Now only what is left instructed data items or plugins, and nodes that have assigned last priority, if any.
@@ -1157,11 +1160,11 @@ sub doInclude { my ($self, $prp_file) = @_;
                 $IS_IN_INCLUDE_MODE = 0;
                 $CUR_SCRIPT = $cur_script;
             }else{
-                $self->error("Include content is blank for include -> ".$prp_file->{script})
+                $self->error("Include content is blank for -> ".$prp_file->{script})
             }
         }else{
                 $prp_file->{loaded} = 0;
-                $self->error("Script include not available for include -> ".$prp_file->{script});
+                $self->error("Script include not available for -> ".$prp_file->{script});
                 CNFParserException->throw("Can't open include ".$prp_file->{script}." -> $!") if $self->{STRICT};
         }
     }
index 47e7ddf856f003915d5fdbe892eafce7d0a43f78..addb5628ad94868f7a9743b148e7f80c2c45c2b2 100644 (file)
@@ -3,7 +3,7 @@ use warnings; use strict;
 use Syntax::Keyword::Try;
 
 use lib "tests";
-use lib "/home/will/dev_new/PerlCNF/system/modules";
+use lib "system/modules";
 
 
 require TestManager;