Would someone be kind enough to tell me why the code below does not work?
It is a library of sorts and resides in a file separate from the main cgi
(hence the "1;" at the end).  It is activated with the call
&MapFormData($fileName).  The print statements in MapFormData print to the
screen as I want and there are no errors either printed to the log file or
that kill the script.  However, neither the procStart subroutine nor the
procEnd subroutine are invoked.  I am not able to determine what the problem
is.

################## CODE SAMPLE FOLLOWS ##################

use strict;
use HTML::Parser;
use HTML::Entities qw(decode_entities);
require "dgcommon.cgi";

open(STDERR,">>dglogs/dgformapper.log")
        or die("Could not open or create dgformapper.log: $!");
chmod 0666, "dglogs/dgformapper.log";

sub procStart
    {
    my ($tagname,$attr,$attrseq) = @_;
    print qq[<b><i>$tagname -</i></b><br>];
    for my $i(0..@$attrseq)
        {
        print qq[@$attrseq[$i] is %$attr->{@$attrseq[$i]}<br>];
        }
    }   # end procStart

sub procEnd
    {
    my ($tagname) = @_;
    print qq[End $tagname<br>==============================<br><br>];
    }   # end procEnd

sub MapFormData
    {
    my @formTags = qw(form input textarea button select option);

    print qq[Entering MapFormData<br>];

    my ($formUrl) = shift;

    print qq[Just got $formUrl<br>];

    open(FORMFILE,"$formUrl")?
        print qq[Just opened $formUrl<br>]:
        &LogEntry(\*STDERR,"dgformapper","MapFormData",
                "Could not open $formUrl",$!);

    my $p = HTML::Parser->new (api_version => 3,
                start_h => [\&procStart, "tagname,attr,attrseq"],
                end_h => [\&procEnd, "tagname"],
                report_tags => [\@formTags ],
                );

    print qq[Created new HTML::Parser object<br>];

    my $retVal = $p->parse_file(\*FORMFILE);

    ref($retVal)?
        print qq[Parsed the file<br>]:
        &LogEntry(\*STDERR,"dgformapper","MapFormData",
                "Could not parse file $formUrl",$!);
    }

1;

################## END OF CODE SAMPLE ###################

Thanks in advance -
Peace In Christ -
Ron Goral
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>


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

Reply via email to