December 2002
Intermediate to advanced
496 pages
9h 40m
English
Mason handles posted form data similarly to Embperl. All form data widget names and their values are stored in the hash %ARGS. Let’s say a form is posted to a Mason page with the form widget named city. To obtain the value of the form widget, include this code in a Mason page:
<%perl>
my $city;
if (!exists $ARGS{´city´}) {
die "no value sent for required parameter ´city´";
} else {
$city = $ARGS{´city´});
}
</%perl> Using this code, the my() variable $city contains the value posted in the form for the widget named city.
In practice, %ARGS is generally not used. Instead, Mason programmers use <%args> ... </%args>.
The following tag, included anywhere in ...
Read now
Unlock full access