A couple of quick (and probably naiive) questions regarding this code
snippet from H:T:JIT Compiler.pm as provided by Smejkal Petr in a previous
email:

        open(INDENT, "| indent -kr > code.tmp");
        print INDENT join("\n", @code);
        close INDENT;
        open(CODE, 'code.tmp');
        print STDERR join('', <CODE>);
        close(CODE);
        unlink('code.tmp');

(a) Consider what happens if there are multiple H:T:JIT invocations running
on files in the same directory and file-system simultaneously

(b) Consider what happens if indent doesn't exist (Solaris 8, for example)

How about this (untested) variant instead, which I believe removes the need
to differentiate between Windows and any other OS:

        open(INDENT, "| indent -kr > code.$$.tmp") && do {
            print INDENT join("\n", @code);
            close INDENT;
            open(CODE, 'code.$$.tmp') && do {
                chomp(@code = <CODE>);
                close CODE;
            };
            unlink('code.$$.tmp');
        };
        print STDERR join("\n", @code);

Cheers,
Chris
--
Chris Davies, Manheim Online
Tel. 0113 393-2004  Fax. 0870 444-0482.  Mobile 07778 199069


-----Original Message-----
From: Smejkal Petr [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 18, 2002 10:40 AM
To: Sam Tregar; HTML-Template (E-mail)
Subject: [htmltmpl] RE: HTML::Template::JIT 0.03 - Bugs on Win32


Hello,

I've tested the new H:T:JIT module. It really seems to be faster. Good job,
Mr. Tregar.
Actually I had to modify the module slightly to be able to test it:

[...]

2)
Compiler.pm lines ~ 40-50:

    if ( $^O eq 'MSWin32' ) {
      print STDERR join("\n", @code);
    } else {
      open(INDENT, "| indent -kr > code.tmp");
      print INDENT join("\n", @code);
      close INDENT;
      open(CODE, 'code.tmp');
      print STDERR join('', <CODE>);
      close(CODE);
      unlink('code.tmp');
    }

Do not expect that M$ Windows ships with "indent" included. :-)

[...]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to