Bread:...jection(3pm)

πŸ“¦
version 0.37 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– Bread::...jection(3pm) πŸ’–

okay bestie, this is a page from the User Contributed Perl Documentation β€” the manual name is literally Bread:...jection(3pm), yes it's abbreviated, yes it's iconic, we move. sit down, grab a strawberry, let's talk about setter injection. πŸ“βœ¨


✨ NAME ✨

Bread::Board::SetterInjection β€” a service that instantiates objects via setter functions. no cap, that's the whole vibe. πŸŽ€


🌈 VERSION 🌈

version 0.37 β€” periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works is: this service class instantiates objects by calling new on a class, and then β€” plot twist β€” it calls setters on the object it just got back. it's giving "build first, decorate after." πŸ’…

this class consumes these three roles, all of them, every single one:

  • Bread::Board::Service::WithClass
  • Bread::Board::Service::WithParameters
  • Bread::Board::Service::WithDependencies

πŸ‘‘ ATTRIBUTES πŸ‘‘

πŸ’œ class

this attribute is provided by Bread::Board::Service::WithClass. but here's the thing, bestie β€” this service makes it a required attribute. and honestly? fair. you literally cannot call a constructor if you don't have a class. that's not a hot take, that's just facts. πŸ”₯


⭐ METHODS ⭐

🌸 get

this is the main character method, obviously. here's the tea:

  1. it calls the new method on the class to get the object to return 🫢
  2. then, for each of the service parameters, it calls a setter with the same name as the parameter, passing it that parameter's value ✨

so like. parameter named foo? boom, setter called foo gets the value. matching names only, iykyk. πŸ’–


🧚 AUTHOR 🧚

Stevan Little <stevan@iinteractive.com> β€” the icon, the legend, the moment. πŸ‘‘


πŸ’€ BUGS πŸ’€

please report any bugs or feature requests on the bugtracker website:

https://github.com/stevan/BreadBoard/issues

also, when you're submitting a bug or a request, please include a test-file β€” or a patch to an existing test-file β€” that illustrates the bug or the desired feature. like, help us help you, bestie, we're begging. πŸ™ˆ

This software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive.

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 β€” no notes, ate and left no crumbs. this was rendered with perl v5.36.0 on 2022-12-12, filed under Bread:...jection(3pm). mwah, love u, go build something. πŸ’…πŸ’–πŸŒˆ

πŸ“¦ where this page comes from