diff --git a/mozilla/webtools/doctor/Doctor.pm b/mozilla/webtools/doctor/Doctor.pm
index bab7b0ed32d..c55aad1e65c 100644
--- a/mozilla/webtools/doctor/Doctor.pm
+++ b/mozilla/webtools/doctor/Doctor.pm
@@ -13,26 +13,12 @@ use AppConfig qw(:expand :argcount);
# Create the global template object that processes templates and specify
# configuration parameters that apply to templates processed in this script.
-our $template = Template->new(
- {
+our $template = Template->new({
# Colon-separated list of directories containing templates.
- INCLUDE_PATH => "templates" ,
- PRE_CHOMP => 1,
- POST_CHOMP => 1,
-
- FILTERS =>
- {
- linebreak => sub
- {
- my ($var) = @_;
- $var =~ s/\\/\\\\/g;
- $var =~ s/\n/\\n/g;
- $var =~ s/\r/\\r/g;
- return $var;
- }
- }
- }
-);
+ INCLUDE_PATH => "templates",
+ PRE_CHOMP => 1,
+ POST_CHOMP => 1
+});
# Define the global variables and functions that will be passed to the UI
# template. Individual functions add their own values to this hash before
@@ -42,66 +28,64 @@ our $vars = {};
# Create an AppConfig object and populate it with parameters defined
# in the configuration file.
# Note: Look in the configuration file for descriptions of each parameter.
-our $config = AppConfig->new(
- {
+our $config = AppConfig->new({
CASE => 1,
CREATE => 1 ,
- GLOBAL => {
- ARGCOUNT => ARGCOUNT_ONE ,
- }
- }
-);
+ GLOBAL => { ARGCOUNT => ARGCOUNT_ONE }
+});
$config->file("doctor.conf");
our %CONFIG = $config->varlist(".*");
$vars->{'config'} = \%CONFIG;
sub system_capture {
- # Runs a command and captures its output and errors. This should be using
- # in-memory files, but they require that we close STDOUT and STDERR
- # before reopening them on the in-memory files, and closing and reopening
- # STDERR causes CVS to choke with return value 256.
-
- my ($command, @args) = @_;
-
- my ($rv, $output, $errors);
-
- # Back up the original STDOUT and STDERR so we can restore them later.
- open(OLDOUT, ">&STDOUT") or die "Can't back up STDOUT to OLDOUT: $!";
- open(OLDERR, ">&STDERR") or die "Can't back up STDERR to OLDERR: $!";
- use vars qw( $OLDOUT $OLDERR ); # suppress "used only once" warnings
-
- # Close and reopen STDOUT and STDERR to in-memory files, which are just
- # scalars that take output and append it to their value.
- # XXX Disabled in-memory files in favor of temp files until in-memory issues
- # can be worked out.
- #close STDOUT;
- #close STDERR;
- #open STDOUT, ">", \$output or die "Can't open STDOUT to output var: $!";
- #open STDERR, ">", \$errors or die "Can't open STDERR to errors var: $!";
- my $outtmpfile = tempfile();
- my $errtmpfile = tempfile();
- open(STDOUT, ">$outtmpfile") or die "Can't dupe STDOUT to output cache: $!";
- open(STDERR, ">$errtmpfile") or die "Can't dupe STDERR to errors cache: $!";
-
- # Run the command.
- $rv = system($command, @args);
-
- # Restore original STDOUT and STDERR.
- close(STDOUT);
- close(STDERR);
- open(STDOUT, ">&OLDOUT") or die "Can't restore STDOUT from OLDOUT: $!";
- open(STDERR, ">&OLDERR") or die "Can't restore STDERR from OLDERR: $!";
-
- # Grab output and errors from the caches.
- # XXX None of this would be necessary if in-memory files was working.
- undef $/;
- seek($outtmpfile, 0, 0);
- seek($errtmpfile, 0, 0);
- $output = <$outtmpfile>;
- $errors = <$errtmpfile>;
-
- return ($rv, $output, $errors);
+ # Runs a command and captures its output and errors. This should be using
+ # in-memory files, but they require that we close STDOUT and STDERR
+ # before reopening them on the in-memory files, and closing and reopening
+ # STDERR causes CVS to choke with return value 256.
+
+ my ($command, @args) = @_;
+
+ my ($rv, $output, $errors);
+
+ # Back up the original STDOUT and STDERR so we can restore them later.
+ open(OLDOUT, ">&STDOUT") or die "Can't back up STDOUT to OLDOUT: $!";
+ open(OLDERR, ">&STDERR") or die "Can't back up STDERR to OLDERR: $!";
+ use vars qw( $OLDOUT $OLDERR ); # suppress "used only once" warnings
+
+ # Close and reopen STDOUT and STDERR to in-memory files, which are just
+ # scalars that take output and append it to their value.
+ # XXX Disabled in-memory files in favor of temp files until in-memory issues
+ # can be worked out.
+ #close STDOUT;
+ #close STDERR;
+ #open STDOUT, ">", \$output or die "Can't open STDOUT to output var: $!";
+ #open STDERR, ">", \$errors or die "Can't open STDERR to errors var: $!";
+ my $outfile = tempfile();
+ my $errfile = tempfile();
+ open(STDOUT, ">&", $outfile) or die "Can't dupe STDOUT to output file: $!";
+ open(STDERR, ">&", $errfile) or die "Can't dupe STDERR to errors file: $!";
+
+ # Run the command.
+ $rv = system($command, @args);
+
+ # Grab output and errors from the temp files. In a block to localize $/.
+ # XXX None of this would be necessary if in-memory files was working.
+ {
+ local $/ = undef;
+ seek($outfile, 0, 0);
+ seek($errfile, 0, 0);
+ $output = <$outfile>;
+ $errors = <$errfile>;
+ }
+
+ # Restore original STDOUT and STDERR.
+ close(STDOUT);
+ close(STDERR);
+ open(STDOUT, ">&OLDOUT") or die "Can't restore STDOUT from OLDOUT: $!";
+ open(STDERR, ">&OLDERR") or die "Can't restore STDERR from OLDERR: $!";
+
+ return ($rv, $output, $errors);
}
1; # so the require or use succeeds
diff --git a/mozilla/webtools/doctor/Doctor/File.pm b/mozilla/webtools/doctor/Doctor/File.pm
index 7cac079d676..db52142cea7 100644
--- a/mozilla/webtools/doctor/Doctor/File.pm
+++ b/mozilla/webtools/doctor/Doctor/File.pm
@@ -231,11 +231,22 @@ sub checkout {
# Extract the content and version.
if ($rv == 0) {
- open(FILE, "<", $self->spec) || die "Can't open $self->spec: $!";
- $/ = undef;
- $self->{_content} =
[% message %]
diff --git a/mozilla/webtools/doctor/templates/edit.tmpl b/mozilla/webtools/doctor/templates/edit.tmpl index c3c9c104639..b82083111b2 100644 --- a/mozilla/webtools/doctor/templates/edit.tmpl +++ b/mozilla/webtools/doctor/templates/edit.tmpl @@ -49,7 +49,7 @@