Perlan...LConfig(3pm)
β¨ Perlanet::Trait::YAMLConfig β¨
okay bestie, gather round, because this one is genuinely such a vibe. this is Perlanet::Trait::YAMLConfig, straight out of the User Contributed Perl Documentation (you know, the 3pm section, the perl module corner of the library πΈ). it's a trait, it's a whole personality, and it's here to let your planet config live in its own little YAML home instead of being all up in your code. obsessed. π
π NAME π
Perlanet::Trait::YAMLConfig β configure Perlanet through a YAML configuration file π¦
π SYNOPSIS π
like, here's the whole move, copy it exactly, no cap:
package MyPerlanet;
extends 'Perlanet';
with 'Perlanet::Traits::YAMLConfig';
my $perlanet = MyPerlanet->new_with_config(
configfile => 'whatever.yml'
);
$perlanet->run;
that's it. that's the whole ritual. new_with_config with a configfile, then run, and you're a main character. π
π DESCRIPTION π
so the whole point of this trait is that it lets you move the configuration of Perlanet out into an external YAML configuration file. your perl code stays cute and clean, and all the planet details go chill in their own .yml where they belong. it's giving separation of concerns, honestly. π«Ά
π Example Configuration File π
here's what a config file actually looks like, literally verbatim, don't @ me:
title: planet test
description: A Test Planet
url: http://planet.example.com/
author:
name: Dave Cross
email: dave@dave.org.uk
entries: 20
opml: opml.xml
page:
file: index.html
template: index.tt
feed:
file: atom.xml
format: Atom
cache_dir: /tmp/feeds
feeds:
- url: http://blog.dave.org.uk/atom.xml
title: Dave's Blog
web: http://blog.dave.org.uk/
- url: http://use.perl.org/~davorg/journal/rss
title: Dave's use.perl Journal
web: http://use.perl.org/~davorg/journal/
- url: http://www.oreillynet.com/pub/feed/31?au=2607
title: Dave on O'Reillynet
web: http://www.oreillynet.com/pub/au/2607
look at those nested feeds entries. a whole little list of blogs. the web keys, the author block, the page and feed subsections β it's structured, it's tidy, it ate and left no crumbs. π§
π METHODS π
two methods, short and sweet, both iconic in their own way:
π get_config_from_file
Extracts the configuration from a YAML file. it's the one doing the pulling-out-the-details part, iykyk. β¨
π read_config
Actually reads the YAML. yeah, that's the whole description. it reads it. it does the reading. respect. π
πΈ AUTHOR πΈ
Oliver Charles, <oliver.g.charles@googlemail.com> β shoutout to the author, an absolute legend for real fr fr π«Ά
π COPYRIGHT AND LICENSE π
Copyright (c) 2010 by Magnum Solutions Ltd.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
so yeah β free software, same terms as Perl itself, pick 5.10.0 or literally any later Perl 5 you've got lying around. do whatever, it's yours. π
and that's the page, bestie!! πβ this one's from perl v5.36.0, dated 2023-02-21, and it's still serving looks. go forth and YAML-config your planet. mwah. πππ¦
π¦ where this page comes from
- debian bookworm: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libperlanet-perl 2.2.1-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms