This is a common problem. The heredoc terminator must be on a line all by
itself, no spaces, no tabs. Here you have it preceeded by spaces.

-----Original Message-----
From: Henk van Ess [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 9:22 AM
To: Bob Showalter; [EMAIL PROTECTED]
Subject: Re: 2 Q's, Google and Me - can you spell it out?


Dear Bob, dear all,

I followed your suggestion and installed Active Perl for a local test. If I
run the script below, I get the following error:

Too late for "-T" option at C:\spriet.nl

When I remove the first line #!/usr/bin/perl -wT
i get the error:

Can't find string terminator  "END_HTML"anywhere before EOF at C:\spriet.pl
line 31

Hope you can help ...

Henk van Ess



#!/usr/bin/perl -wT
    use strict;
    use CGI qw/:standard/;
    use URI::Escape;

    # if we came from the form, grab the values and create the URL
    if ( param )
    {
        # get the form data
        # see perldoc CGI
        my $_prefix = param( 'prefix' ) || '';
        my $_search = param( 'search' ) || '';

        # untaint it
        # see perldoc perlsec
        my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex
        my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex

        # escape characters with special meaning in URIs
        # see perldoc URI::Escape
        $prefix = uri_escape( $prefix );
        $search = uri_escape( $search );
        print redirect(
"http://www.google.com/search?q=$prefix%20$search"; );
    }
    # otherwise, print the Web page
    else
    {
        print header;
        print <<END_HTML;
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

    <html>
        <head>
            <title>Test page</title>
        </head>
        <body>
            <form action="spriet.cgi" method="get">
                <input type="checkbox" name="prefix" value="allintitle:" />
All in title<br />
                <input type="text"     name="search" />
                <input type="submit"   name="Submit" />
            </form>
        </body>
    </html>
    END_HTML
    }





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

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

Reply via email to