Mixin:...::Param(3pm)

πŸ“¦
version 0.022 Β· 2 versions
  • 0.022 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.020 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay bestie, this is Mixin::ExtraFields::Param πŸ’– β€” it's the module that makes your class hand out a param method, you know, the familiar one everybody already knows and loves. iykyk πŸ’…

oh also? this page lives in the User Contributed Perl Documentation section, section 3pm, so if you were wondering where to find it: right here 🫢


🌸 VERSION 🌸

this is version 0.022 ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

like, literally, here's the whole vibe:

package Widget::Parametric;
use Mixin::ExtraFields::Param -fields => { driver => 'HashGuts' };;

...

my $widget = Widget::Parametric->new({ flavor => 'vanilla' });

printf "%s: %s\n", $_, $widget->param($_) for $widget->param;

periodt πŸ’… (yes the ;; is real, don't @ me, copy it exactly πŸ™ˆ)


πŸ’œ DESCRIPTION πŸ’œ

so what this module does is it mixes in to your class and gives you a param method β€” the same kind of param that CGI, CGI::Application, and all those other classes be handing out. iconic behavior, honestly πŸ‘‘

under the hood it uses Mixin::ExtraFields, which means it can use any Mixin::ExtraFields driver to store your data. any of them. the whole roster. main character energy 🌈

by default, the methods you get are:

  • param
  • exists_param
  • delete_param

these methods get imported by the "fields" group, and heads up bestie β€” that group must be requested. you don't just get it for free, you have to ask. ask nicely tho πŸ’–

and if you pass a "moniker" argument? then the moniker gets used instead of param. so you can call it whatever you want, it's giving customizable ✨

for more info, go peek at Mixin::ExtraFields πŸ’œ


πŸŽ€ PERL VERSION πŸŽ€

okay so, this library should run on perls released even a long time ago. like, it should work on any version of perl released in the last five years. slay πŸ’…

but β€” and this is the fine print bestie β€” even though it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. the version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

so like. don't come for her about the floor, okay? 😭


🌟 METHODS 🌟

πŸ’« param

my @params = $object->param;        # get names of existing params

my $value = $object->param('name'); # get value of a param

my $value = $object->param(name => $value); # set a param's value

my @values = $object->param(n1 => $v1, n2 => $v2, ...); # set many values

this method sets or retrieves parameters. that's it, that's the whole job, and she does it flawlessly 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Ricardo SIGNES <cpan@semiotic.systems>


🌈 CONTRIBUTORS 🌈

  • Ricardo SIGNES <rjbs@codesimply.com>
  • Ricardo Signes <rjbs@semiotic.systems>

(the icon himself, twice, with two different emails β€” we love a dedicated king πŸ’–)


This software is copyright (c) 2005 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page bestie πŸŽ€ this was Mixin:...::Param(3pm), straight out of perl v5.36.0, dated 2023-01-07 β€” mwah, go write something iconic with it πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from