I've been struggling to install a web-based HTML Validator on Mac OS X. There are ways to do it, with lots of patience and makeing various binaries.

So then I had what I thought was a brilliant idea -- BBEdit has a validator, BBEdit is scriptable via AppleScript; I'll use BBEdit as the back end and cut out all the hassle.

This script works just fine from the command line:

#!/usr/bin/perl use strict; use Mac::AppleScript::Glue; use LWP::Simple; print "Enter URL:\n -> "; my $URL = <STDIN> || die "$!"; getstore( $URL, "/path/to/tempfile.html" ) || die; my $BB = new Mac::AppleScript::Glue::Application('BBEdit') || die "$!"; my $results = $BB->check_syntax( file => "path:to:tempfile.html" ) || die "$!"; # If it worked, $results is now # an AoH-type data structure foreach my $item ( @{$results} ) { print 'Line ' . $item->{'result_line'} . ': ' . $item->{'message'} . "\n"; }
So then I tried it as a CGI script and it totally dies at the commented line above, "# if it worked...".

When run from he command line, it works fine.

When run from the browser, it gives no output beyond that point.

I tried to wrap it with an eval{} but it still died.

Any ideas? Any reason why it should run fine from the command line but fail when run from the browser? What should I try or troubleshoot?



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

In reply to Mac::AppleScript::Glue in CGI script by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.