Changeset 1649
- Timestamp:
- 09/02/06 06:56:05
- trunk/plagger (modified) (previous)
- trunk/plagger/t/TestPlagger.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/t/TestPlagger.pm
r1648 r1649 289 289 use File::Temp (); 290 290 291 292 =over 293 294 =item interpolate 295 296 Filter that replaces scalar values of the type 297 298 $foo 299 $foo::bar 300 301 With their actual values. But don't do backslash escaped things like 302 303 \$foo 304 305 Note that you can't do this either: 306 307 ${foo} 308 309 Meaning you can't use $foo like so: 310 311 BAR$fooHELLO 312 313 =cut 314 315 define the interpolate filter - replace $vars with 291 316 sub interpolate { 292 317 my $stuff = shift; 293 $stuff =~ s/(?<!\\)(\$[\w\:]+)/$1/eeg; 294 $stuff =~ s/\\\$/\$/g; 318 319 # interpert in $foo::bar to their values in the string 320 # (but not \$foo::bar) 321 $stuff =~ s/(?<!\\) # check there's no backslash before this 322 (\$[\w\:]+) # look for a $var possibly with packages 323 /$1/eegx; # replace it with its value 324 325 $stuff =~ s/\\\$/\$/g; # turn the escaped \$ into $ 326 295 327 $stuff; 296 328 } 329 330 =item config 331 332 Filter that configures plagger based on the YAML passed in. 333 334 =cut 297 335 298 336 sub config { 299 337 my $yaml = shift; 338 339 # replace $foo values with their actual values 300 340 $yaml = $self->interpolate($yaml); 301 341 … … 309 349 } 310 350 351 =item output_file 352 353 Reads the file who's filename is in $main::output and returns it (failing on problems) 354 355 =cut 356 311 357 sub output_file { 312 358 my $output = $main::output or die "\$main::output is undefined";
