]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Text.pm
* Document how to create the estraier database in add_bug_to_estraier
[debbugs.git] / Debbugs / Text.pm
index 9a06510dc491843189575cfd032febfc76c048af..bc1363b648b0a6bf3f8f59e3867f5e41e670d9eb 100644 (file)
@@ -74,6 +74,7 @@ fills the template in.
 our %tt_templates;
 our %filled_templates;
 our $safe;
+our $hole;
 our $language;
 sub fill_in_template{
      my %param = validate_with(params => \@_,
@@ -90,9 +91,12 @@ sub fill_in_template{
                                          safe      => {type => OBJECT,
                                                        optional => 1,
                                                       },
+                                         hole_var  => {type => HASHREF,
+                                                       optional => 1,
+                                                      },
                                         },
                              );
-     return _fill_in_template(@param{qw(template variables language safe output)});
+     return _fill_in_template(@param{qw(template variables language safe output hole_var)});
 }
 
 
@@ -109,6 +113,7 @@ sub include {
                                                          $language,
                                                          $safe,
                                                          undef,
+                                                         {},
                                                          1
                                                         );
      };
@@ -123,7 +128,7 @@ sub include {
 
 sub _fill_in_template{
      my %param;
-     @param{qw(template variables language safe output nosafe)} = @_;
+     @param{qw(template variables language safe output hole_var no_safe)} = @_;
      print STDERR "_fill template $param{template} language $param{language} safe $param{safe}\n"
          if $DEBUG;
 
@@ -149,6 +154,9 @@ sub _fill_in_template{
 
      if (defined $param{safe}) {
          $safe = $param{safe};
+         if (not defined $hole) {
+              $hole = Safe::Hole->new();
+         }
      }
      else {
          print STDERR "Created new safe\n" if $DEBUG;
@@ -193,6 +201,9 @@ sub _fill_in_template{
                    ${"${root}::$key"} = $param{variables}{$key};
               }
          }
+         for my $key (keys %{$param{hole_var}||{}}) {
+              $hole->wrap($param{hole_var}{$key},$safe,$key);
+         }
      }
      #$safe->deny_only();
      # perldoc Opcode; for details