-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Each of these instances of eval to check for the presence of PerlTidy should 
AxKit::Debug() if they get an error - just in case people enable it without 
PerlTidy installed. I suggest just dumping $@, or perhaps throwing an 
exception would be better so that it propogates properly rather than 
silently.

- ----------  Forwarded Message  ----------

Subject: cvs commit: xml-axkit/lib/Apache/AxKit/Language XSP.pm
Date: 28 Jun 2002 01:26:01 -0000
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]

  +                if ($AxKit::Cfg->DebugTidy) {
  +                    eval {
  +                        require XML::LibXML;
  +                        my $parser = new XML::LibXML();
  +                        $parser->keep_blanks(0);
  +                        if (my $dom_tree = $r->pnotes('dom_tree')) {
  +                            $xmlstr = $dom_tree->toString;
  +                        } elsif ($r->pnotes('xml_string')) {
  +                            $xmlstr = $r->pnotes('xml_string');
  +                        } else {
  +                            die;
  +                        }
  +                        local $XML::LibXML::setTagCompression = 1;
  +                        $xmlstr =
 $parser->parse_string($xmlstr,$r->uri)->toString(1); +                    };
                   }
  +                if (!defined $xmlstr) {
  +                    if (my $dom_tree = $r->pnotes('dom_tree')) {
  +                        $xmlstr = $dom_tree->toString;
  +                    } elsif ($r->pnotes('xml_string')) {
  +                        $xmlstr = $r->pnotes('xml_string');
  +                    } else {
  +                        $xmlstr = "<?xml version='1.0'?>\n<empty
 reason='no data found'/>\n"; +                    }
  +                }
  +                syswrite($fh,$xmlstr);
                   close($fh);
  -             $interm_count++;
  +                $interm_count++;
       if ($to_eval) {
  +        eval {
  +            require Perl::Tidy;
  +            require IO::Scalar;
  +            AxKit::Debug(5,'Running PerlTidy...');
  +
  +            my $temp_cache = Apache::AxKit::Cache->new($r, __PACKAGE__,
 'PerlTidy'); +            $temp_cache->{no_cache} = 0;
  +            $temp_cache->write( $to_eval );
  +            my $errors;
  +            Perl::Tidy::perltidy(
  +                source => $temp_cache->{file},
  +                destination => new
 Apache::AxKit::Language::XSP::StringWriter($to_eval), +               
 stderr => \$errors,
  +                argv => '-se -npro -f -nsyn -pt=2 -sbt=2 -csc -csce=2
 -vt=1 -lp -cab=3 -iob'); +            if ($errors) {
  +                AxKit::Debug(1,"PerlTidy warnings: $errors");
  +            } else {
  +                AxKit::Debug(5,"PerlTidy successful");
  +            }
  +        } if $AxKit::Cfg->DebugTidy;

- -- 
<:->get a SMart net</:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9HAkTVBc71ct6OywRAt29AKDDDf1Eaytrchj/hoWF7ib6XIW6BgCdEecL
x9mXX2ZgfzfU39maHspB0zw=
=FBOu
-----END PGP SIGNATURE-----

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

Reply via email to