Text::...Bridge(3pm)

πŸ’– Text::Xslate::Bridge β€” the interface base class to import methods πŸ’–

okay bestie, so like. this page is Text::...Bridge(3pm), and it lives in the User Contributed Perl Documentation section of the manual, which honestly? iconic of it. let's get into it ✨


🌸 SYNOPSIS 🌸

here's the whole vibe up front, no cap:

package SomeTemplate::Bridge::Xslate;

use parent qw(Text::Xslate::Bridge);

__PACKAGE__->bridge(
    nil    => \%nil_methods,
    scalar => \%scalar_methods,
    array  => \%array_methods,
    hash   => \%hash_methods,

    function => \%functions,
);

# in your script

use Text::Xslate;

my $tx = Text::Xslate->new(
    module => [
        'SomeTemplate::Bridge::Xslate'
            => [-exclude => [qw(hash::keys hash::values)]],
    ],
);

like… look at her. subclassing, bridging, excluding a couple of hash:: methods like she's curating a playlist. main character energy fr fr πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this module? it's literally the base class for adaptor classes. that's the whole job description. she's the blueprint, the mother of bridges, the one everyone else use parents. periodt. πŸ‘‘


✨ INTERFACE ✨

🌈 "__PACKAGE__->bridge(@mapping) :Void"

this is the one move you gotta know. calling bridge on your package installs a bridge module that has the methods in @mapping. πŸ’«

and if you want an actual working example instead of my yapping? go look at example/bridge.pl. it's right there. go. look. 🫢

ngl the signature says :Void, so don't go expecting a return value to use, bestie β€” it's giving "does the thing and leaves." 😌

πŸ‘€ SEE ALSO πŸ‘€

the whole friend group, gathered:

  • Text::Xslate
  • Text::Xslate::Bridge::TT2
  • Text::Xslate::Bridge::TT2Like
  • Text::Xslate::Bridge::Alloy

go say hi πŸ“ they're all part of the family.


πŸ’œ and that's the tea! this page ships with perl v5.42.3, dated 2026-08-22, and it's Text::...Bridge(3pm) β€” so next time you're bridging methods, you know exactly where to come. slay, stay hydrated, and may your bridges never segfault. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from