------------------------------------------------------------ Listing 4: edit-person.html % # Make sure that we got all required name-value pairs % unless ($email and $new_first) { Missing information!

Missing information!

Sorry, but you need to provide us with the person's e-mail address and their new first name.

% # Make sure that the e-mail address looks somewhat valid % } elsif ($email !~ /[.\w]+@\w+\.\w{2,3}/) { Bad e-mail address!

Bad e-mail address!

Sorry, but the provided e-mail address doesn't look legal.

% # If we made it this far, use $email to choose the person, then % # change the first name with the API % } else { <%perl> my $set_person_successfully = $people->set_current_person_by_email($email); % if ($set_person_successfully) { <%perl> my $updated_name_successfully = $people->update_first_name($new_first); % if ($updated_name_successfully) { Success!

Success!

You successfully changed the first name.

% } else { Error!

Error!

There was an error trying to set the name for "<% $email %>" to "<% $new_first %>".

% } % } else { Error!

Error!

There was an error trying to set the current person based on the e-mail address "<% $email %>".

% } % } <%init> use People; my $people = new People; <%args> $email $new_first