[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Calling sub-routine



In reply to Amitava, Scott wrote:

>> ====================================================
>> # Undefined subroutine &main::PrintHeader called.
>> File 'LC 2:MacPerl ƒ: formregistration.pl'; Line 4
>> ====================================================
>> Apparently there seems to be some problem with the
>> subroutine.  I have
>> added to subroutine at the end.  One for saving the incoming
>> data and
>> the other for mailing confirmation.
>
>it's simple.. you haven't defined the sub yet, and you are trying to use it
>before the code knows what it is.

Yep: PrintHeader() can exported from CGI.pm (the :cgi-lib function set
contains it, so I imagine the script being worked on has a long history!),
but it isn't exported using the first line quoted below. Thus the easiest
way to get that part of the script in line would be to change the line

> use CGI qw(:standard :html3 -no_xhtml);

to something like:

> use CGI qw(:cgi-lib :standard :html3 -no_xhtml);

Or simply nail down the call to PrintHeader():

print CGI::PrintHeader();

The former has the (dubious?) virtue that any other cruft from cgi-lib that
might in parts of the script that we haven't seen will work transparently.

Cheers,
        Paul


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org