Config...:Simple(3pm)

πŸ’– Config::Onion::Simple πŸ’–

okay so bestie, welcome to Config::Onion::Simple β€” the Perl module that lives in the User Contributed Perl Documentation section of your friendly neighborhood man pages, aka the 3pm zone. she's a Simple interface to a Config::Onion singleton and she is literally here to make your shared config dreams come true. ✨


✨ VERSION ✨

version 1.007</purl>

(we stan a version number 1.007, very spy movie, very iconic πŸŽ€)


πŸ¦‹ SYNOPSIS πŸ¦‹

use Config::Onion::Simple qw( cfg cfg_obj );

cfg_obj->load('myapp');
my $setting = cfg->{setting};

that's it. that's the whole vibe. you pull in cfg and cfg_obj, you load your app's config, and you go get your lil setting. slay. πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea β˜•: it is often useful for a single master configuration to be shared across multiple modules in an application. like, why is every module keeping its own secret little config stash, y'know? messy.

Config::Onion::Simple provides an interface to do this without requiring any of those modules to know about each other. no awkward introductions, no "hey have you met my config", they just all vibe off the same singleton. group chat energy, zero drama. 🫢


πŸ‘‘ EXPORTABLE FUNCTIONS πŸ‘‘

kay so important: Config::Onion::Simple exports nothing by default. nothing! zip! you have to ask for it, like a polite queen. the following functions are exported only on request β€” that means you put them in your use line, like in the SYNOPSIS up there. 🌈

⭐ cfg

Returns a reference to the complete configuration hash managed by the Config::Onion singleton. it's the whole thing, the full spread. πŸ’–

🚨 READ THIS PART, BESTIE: this hash should be treated as read-only, because any changes will be lost if the configuration is altered using the underlying Config::Onion instance's methods. so don't go writing to it, it's not the main character here, it's just the display case. 😭

Calling cfg is equivalent to calling cfg_obj->get. same energy, different name. ✨

πŸŽ€ cfg_obj

Returns a reference to the Config::Onion singleton. use this object's methods to make any changes to the configuration. this is the one with the ✨power✨. changes go here, periodt. πŸ‘‘


πŸ› SEE ALSO πŸ›

  • Config::Onion β€” the actual engine underneath all this, go say hi πŸ’œ

πŸ’œ AUTHOR πŸ’œ

Dave Sherohman <dsheroh@cpan.org> β€” thank you for your service, legend 🫑


This software is copyright (c) 2012 by Lund University Library.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so basically: free, open, go wild, just keep it legal. 🌈


aaaand that's the whole page!! 🌟 this bad girl shipped as part of perl v5.40.1 and got her glow-up on 2025-08-04. mwah πŸ’‹ go forth and share one config across all your modules, bestie β€” no cap, it's giving main character energy. πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from