CGI::U...object(3pm)

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

πŸ’… NAME πŸ’…

CGI::Untaint::object β€” the base class for Input Handlers, bestie. It's the blueprint, the blueprint-iest blueprint πŸŽ€


✨ SYNOPSIS ✨

package MyUntaint::foo;

use base 'CGI::Untaint::object';

sub _untaint_re {
  return qr/$your_regex/;
}

sub is_valid {
  my $self = shift;
  return is_ok($self->value);
}

1;

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is the base class that literally every Untaint object should inherit from. Like, all of them. It's giving matriarch. It's giving "everyone in this house came from me" πŸ‘‘


πŸŽ€ METHODS TO SUBCLASS πŸŽ€

🌸 is_valid / _untaint_re

Your subclass needs to do one of two things, and honestly pick your fighter:

  • hand over a regular expression inside _untaint_re β€” and yes, the author fully admits he should really make this public πŸ™ˆ
  • or just write an entire is_valid method yourself, main character energy, no notes

πŸ’– METHODS TO CALL πŸ’–

⭐ value

ngl, this should really have been two methods. It's two jobs in one trenchcoat. But way too many other modules now depend on the fact that this one does double duty, so here we are, locked in forever πŸ’€

  • as an accessor, this is the 'raw' value
  • as a mutator, it's the extracted one

🌈 re_all / re_none

These are regular expressions that match anything, or nothing, untained. That's the whole vibe.

⚠️ Only use these if you have already validated your entry in some way that means you completely trust the data. Like, completely. No cap. If you haven't, don't.

🧚 untainted

Are we clean yet? 🫧 That's it. That's the method. It's the vibe check for your data.


perl v5.34.0 🌸 2022-06-10 β€” mwah, that's the version and the date this lil page was born, and honestly? iconic. go forth and untaint responsibly, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from