XML::V...e::Base(3pm)

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

πŸ¦‹ NAME πŸ¦‹

okay bestie, welcome to the XML::Validate::Base page (that's the 3pm manual, we're in Perl land now πŸ’…). It's an abstract base class β€” the blueprint energy β€” that all the XML::Validate modules are supposed to inherit from. Not me reading the docs before writing code, growth. ✨


🌸 SYNOPSIS 🌸

like, here's the vibe of how you'd use it:

use XML::Validate::Base;

sub new {
  ... override new ...
}

sub validate {
  ... override validate ...
}

so you use it, then you override the methods it hands you. it's giving "starter pack, do the rest yourself" and honestly? iconic. 🫢


πŸ’œ DESCRIPTION πŸ’œ

XML::Validate::Base is a base class that comes stocked with a bunch of helpful subs, so that the real XML::Validate modules don't have to reinvent the wheel every single time. it's the supportive friend who already made the flashcards. 🌈


✨ METHODS ✨

new(%options)

Constructs a fresh new validator. and by "constructs" I mean β€” this method must be overridden. base class said "not my job, bestie" 😭

validate($xml)

Parses and validates $xml. Returns a true value on success, and undef on failure. oh and also β€” this method must be overridden. yes really. both of them. it's abstract, that's the whole point. πŸ’€

options

An accessor for the options hashref. cute, simple, does exactly what it says. main character of accessors fr fr. πŸ‘‘

set_options($supplied_options,$valid_options)

Sets the options for the validator. $supplied_options and $valid_options are hash refs containing, respectively:

  • the options that were supplied to the constructor, and
  • the valid options for the validator, along with their default values.
⚠️ heads up: if the supplied options hash ref contains an option that is not listed in the valid options, this sub throws an exception. no silently ignoring your typos here, she will read you. πŸ™ˆ

last_error

Returns the error from the last validate call. It's a hash ref with these fields:

  • message
  • line
  • column
🚨 note that the error gets cleared at the beginning of each validate call. so if you were counting on it sticking around... she moves on fast, bestie. πŸ’…

add_error($error)

Stores $error so last_error can hand it back to you later. $error should be a hash ref. πŸ“

clear_errors

Clears any errors the validator is currently holding. emotional reset button, we love a clean slate. 🧚


⭐ VERSION ⭐

$Revision: 1.9 $ on $Date: 2005/09/06 11:05:08 $ by $Author: johna $

the receipts, preserved for all eternity. lowkey a time capsule. πŸŽ€


🌸 AUTHOR 🌸

Colin Robertson <cpan _at_ bbc _dot_ co _dot_ uk>

thank you for your service king πŸ«‘πŸ’–


(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL. See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt


and that's the whole page bestie β€” this was XML::Validate::Base, served up by perl v5.34.0 on 2022-06-28. no cap, you now know more about abstract base classes than 90% of the group chat. go forth and override responsibly πŸ’…βœ¨πŸŒˆ