Debian...:Stanza(3pm)

πŸ“¦
version 0.2 Β· 4 versions
, in ubuntu noble, ubuntu resolute

πŸ’– Debian...:Stanza(3pm) πŸ’–

okay bestie, welcome to the User Contributed Perl Documentation page for Debian...:Stanza(3pm) β€” yes that's the manual name, it's giving ✨ perldoc core ✨ and we're gonna get through it together, no cap 🫢


✨ NAME ✨

Debian::Copyright::Stanza β€” literally one single stanza of a Debian copyright file πŸŽ€

so like, one stanza. one. not the whole file. that's her whole job πŸ’…


🌸 VERSION 🌸

This doc describes Debian::Copyright::Stanza version 0.2 β€” periodt, that's the version, don't @ me πŸ¦‹


🧚 SYNOPSIS 🧚

here's the vibe, ok, look at her go:

package Header;
use base 'Debian::Copyright::Stanza';
use constant fields => qw(
    Format_Specification
    Name
    Source
    Maintainer
    X_Comment
);

1;

like?? the way she just works πŸ’œ subclass it, declare your fields, return a true value (1;, iconic behavior), done. slay.


πŸ”₯ DESCRIPTION πŸ”₯

Debian::Copyright::Stanza is the base class for these three queens πŸ‘‘:

  • Debian::Copyright::Stanza::Header
  • Debian::Copyright::Stanza::Files
  • Debian::Copyright::Stanza::License

that's it. she's the mother, they're the children, family dinner is served πŸ“


🌈 FIELDS 🌈

Stanza fields get defined in the class method fields. typically you do it like this, super simple:

use constant fields => qw( Foo Bar Baz );

now the tea β˜•: any field that's meant to hold a dependency list (as described in the is_dependency_list method below) gets automatically converted into instances of the Debian::Dependencies class. automatic. she does it for you. no manual labor, we love a self-sufficient icon πŸ’…


πŸŽ€ CONSTRUCTOR πŸŽ€

πŸ¦‹ new( { field => value, ... } ) πŸ¦‹

creates a new Debian::Copyright::Stanza object, and optionally initialises it with the data you hand over. the object is hashref based and tied to Tie::IxHash (so the order stays, bestie, the ORDER stays, we stan a predictable hash 😌).

you may use dashes in your initial field names β€” but lowkey they get converted to underscores. so like:

my $s = Debian::Copyright::Stanza::Header( {Name => "Blah"} );
print $s->Name;

dashessss in, underscores out, that's the trade 🫢


πŸ’€ METHODS πŸ’€

🌟 is_or_separated($field) 🌟

returns true if the given field is supposed to contain an 'or'-separated list of values. it's used when stringifying, specifically when she's deciding where to wrap those long, dramatic lines. you know the ones, the ones that go on forever and ever 😭

πŸ’– get($field) πŸ’–

overrides the default get method from Class::Accessor and swaps in Tie::IxHash's FETCH. same energy, better plumbing πŸ”§

⭐ set( $field, $value ) ⭐

overrides the default set method from Class::Accessor, but this time it's Tie::IxHash's STORE doing the work. consistent. reliable. a real one ✨

πŸ‘‘ as_string([$width]) πŸ‘‘

returns a string representation of the object β€” ready to be printed into a real debian/copyright file. it also doubles as the stringification operator, so when someone treats your object like a string, this is the method that catches it. main character energy, honestly 🌈

optional $width argument? yes ma'am, it's in the brackets, it's optional, it's there [$width], don't forget her πŸ™ˆ

Copyright (C) 2011 Nicholas Bamber <nicholas@periapt.co.uk>

This module is substantially based upon Debian::Control::Stanza. Copyright (C) 2009 Damyan Ivanov dmn@debian.org [Portions]

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ngl the all-caps warranty disclaimer is the loudest thing on this whole page and she is not kidding, that's the legal vibe check and it passed βœ…

and that's the whole page, bestie, you ate it, I'm so proud πŸ₯ΉπŸ’– this was Debian...:Stanza(3pm) from perl v5.36.0, dated 2022-10-14 β€” go forth and stringify responsibly, muah πŸ’…πŸŒΈ

πŸ“¦ where this page comes from