CGI::A...InForm(3pm)

πŸ“¦
version 1.15 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

CGI::Application::Plugin::FillInForm β€” it's giving "let's link up with HTML::FillInForm" πŸ’– that's the whole vibe, bestie.


πŸ¦‹ SYNOPSIS πŸ¦‹

use CGI::Application::Plugin::FillInForm (qw/fill_form/);

my $t = $self->load_tmpl('farm.html');
$t->param( organic => 'less_pesticides' );

return $self->fill_form( \$t->output );

okay so literally three lines and your form is fed. periodt. πŸŽ€


🌸 DESCRIPTION 🌸

So this plugin is a little mix-in method that makes using HTML::FillInForm way more convenient. No cap. It just hands you a helper and gets out of your way. 🫢

πŸ’… fill_form()

# fill an HTML form with data in a hashref or from an object with with a param() method
my $filled_html = $self->fill_form($html, $data);

# ...or fill from a list of data sources
# (each item in the list can be either a hashref or an object)
my $filled_html = $self->fill_form($html, [$user, $group, $query]);

# ...or default to getting data from $self->query()
my $filled_html = $self->fill_form($html);

# extra fields will be passed on through:
my $filled_html = $self->fill_form($html, undef, fill_password => 0 );

(this is exactly what it looks like in the original, I'm not touching a single character, that's the rule πŸ‘‘)

So what's it doing? This method gives you a nicer syntax for calling HTML::FillInForm, plus an intelligent default: it just uses $self->query() as your default data source when you don't hand it anything else. Lowkey genius. ✨

⚠️ heads up bestie: by default, the mode param (usually 'rm') of every data source gets ignored. Why? So you don't accidentally clobber your run mode for the next page β€” which may be chillin' in a hidden field. Very "don't text your ex" of it, honestly. πŸ’€

And the type tea: $html must be a scalarref, or a reference to a scalarref. $filled_html will be a reference to a string. That's the shape, no wiggle room. 🌈

And the best part β€” because this method only loads HTML::FillInForm if it's needed, it's totally reasonable to load it in a base class and just always have it available. Set it and forget it energy:

use CGI::Application::Plugin::FillInForm (qw/fill_form/);

πŸŽ€ AUTHORS πŸŽ€

  • Cees Hek published the first draft on the CGI::App wiki 🧚
  • Mark Stosberg, C<< <mark@summersault.com> >> polished it for release. ✨
  • Michael Graham, C<< <mag-perl@occamstoothbrush.com> >> added tests and some new features. πŸ§ͺ
  • The module is now co-maintained by Mark and Michael. πŸ‘‘πŸ‘‘

πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests to "bug-cgi-application-plugin-fillinform@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. so like, you'll get the updates fr fr, no ghosting. πŸ™ˆ


🫢 CONTRIBUTING 🫢

Patches, questions and feedback are welcome. This project is managed using the darcs source control system ( <http://www.darcs.net/> ). My darcs archive is here: <http://mark.stosberg.com/darcs_hive/cap-fif/> β€” pull up, the door's open. 🌸


Copyright 2005 Mark Stosberg, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. iconic. πŸ’œ


and that's the whole page, bestie!! πŸ¦‹ this was documented as perl v5.34.0, dated 2022-06-09, and it lives in the User Contributed Perl Documentation corner of the man pages. go forth and fill those forms. slay. πŸ’…βœ¨

πŸ“¦ where this page comes from