At 3:17 PM 11/18/00, Amitava Basu wrote: >Hello: > >I have typed in the following script from Learning Perl. I >discarded the flock >function since it is not implemented in MacPerl. When I run >the script it >shows following error: > ><HR><FORM METHOD="POST" >ENCTYPE="application/x-www-form-urlencoded"> ></HR># Can't call method "textfield" without a package or >object reference, <> chunk 1. >File '.LC 1:Desktop Folder:scripts:guest.pl'; Line 31 > >I am unable to understand the problem. Can someone out there >please guide me. In the script you've shown, you are using several subroutines from the CGI.pm module that provide HTML markup in your output. Among others, these include p, h1, h2, hr, start_form, end_form, and end_html. You also use some CGI.pm subroutines to access data returned to your script (param), and some others. In some cases (e.g., "print hr start_form;") the script uses these subs 'bare' because they are imported via the ':standard' invocation in your statement "use CGI qw (:standard);" In other cases (e.g., "$entry->param("message");"), your script uses CGI subs qualified with the object reference "entry->", specific to each of your @entries items, each one created in the loop while (!eof (CHANDLE) && $#entries < $MAXSAVE) { $entry = CGI->new(\*CHANDLE); push @entries, $entry; } But the phrase that has caused the error $cur->textfield ( ... doesn't work because your script hasn't created the CGI object $cur anywhere. All your script has done is initialize the scalar variable $entry, which holds each object reference during each iteration through the loops its in. Try writing using textfield() without the $cur->. But there are other problems here as well. Lose the spaces around the arrows, for one. Incidentally, if you are new to Perl/MacPerl, I'd suggest that this isn't the simplest approach for learning, because you are dealing not only with Perl's functions and structures, but also with CGI.pm's own functions/subroutines and its approach to writing HTML. Plus, you happen to have chosen an example that has several layers of Perl, such as references and objects, that are difficult to make sense of until you've gotten control over the more basic stuff. Of course one way to learn a language is to obsess over something that you really want to get working. If you continue with this example, though, I'd suggest studying the author's excellent documentation of CGI.pm (book: Official Guide to Programming with CGI.pm, by Lincoln Stein, Wiley, 1998; or online: http://www.wiley.com/compbooks/stein/). HTH 1; - Bruce __Bruce_Van_Allen___Santa_Cruz_CA__ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org