Sub::Ha...Blessed(3)

πŸ’– Sub::HandlesVia::HandlerLibrary::Blessed πŸ’–

okay bestie, so this page lives in the User Contributed Perl Documentation corner of the man world, and it's literally just a whole vibe about letting your attributes delegate to methods on blessed objects. no cap. let's get into it πŸ¦‹


✨ NAME ✨

Sub::HandlesVia::HandlerLibrary::Blessed β€” a whole library of object-related methods, periodt πŸ’…


🌸 SYNOPSIS 🌸

package My::Class {
  use Moo;
  use Sub::HandlesVia;
  use Types::Standard 'Object';
  use HTTP::Tiny;
  has http_ua => (
    is => 'rwp',
    isa => Object,
    handles_via => 'Blessed',
    handles => {
      'http_get'  => 'get',
      'http_post' => 'post',
    },
    default => sub { HTTP::Tiny->new },
  );
}

like, look at her go πŸ‘‘ http_ua holds a whole HTTP::Tiny object and then http_get and http_post just become methods on your class. the way that handles_via => 'Blessed' does all the heavy lifting? iconic.


πŸŽ€ DESCRIPTION πŸŽ€

This is a library of methods for Sub::HandlesVia. that's it, that's the description. she's a handler library, she handles stuff. πŸ’–


🧚 DELEGATABLE METHODS 🧚

okay so here's the thing that makes this one different from all the other libraries Sub::HandlesVia ships with: this library lets you delegate to ANY method name you want. any. literally any. no fixed list, no rules. slay. ✨

The way it works is: it assumes the attribute value is a blessed object, and then it just calls the correspondingly named method on it. so you say the method is called get, it calls get on the object. matching names, cute and simple, iykyk. 🫢

now, ngl, Moo, Moose, Mouse, and Mite all already have this kind of delegation built-in anyway. so if you're on one of those, you already ate. BUT this module lets you do the same delegation using Sub::HandlesVia instead, and that's highkey useful for Object::Pad and Class::Tiny, because those two don't have a built-in delegation feature. so now they can have one too. we love an inclusive moment 🌈


πŸ’€ BUGS πŸ’€

Please report any bugs to <https://github.com/tobyink/p5-sub-handlesvia/issues>.

(no seriously, if something's broken, go tell them, don't just suffer in silence bestie 😭)


πŸ‘‘ SEE ALSO πŸ‘‘

  • Sub::HandlesVia.

πŸ“ AUTHOR πŸ“

Toby Inkster <tobyink@cpan.org>.


This software is copyright (c) 2022 by Toby Inkster.

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


⭐ DISCLAIMER OF WARRANTIES ⭐

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

like, no promises, no guarantees, you get what you get and you don't throw a fit πŸ™ˆ that's the whole disclaimer, in all caps, very serious, very main character energy.


and that's the page bestie, fr fr πŸ’œ this one was rendered by perl v5.42.0 on 2026-02-11, so go forth and delegate responsibly. mwah 🫢✨

πŸ“¦ where this page comes from