Debian...:Stanza(3pm)

πŸ’– Debian::Control::Stanza β€” the 3pm manual, bestie edition πŸ’–

okay so you wanna know about Debian::Control::Stanza? say less. this is the 3pm manpage for it, and I'm gonna walk you through every single crumb of it, no skips, no skimming. 🫢


🌸 NAME 🌸

Debian::Control::Stanza β€” one single stanza of a Debian source package control file. that's it, that's the whole vibe. one stanza. iconic behavior honestly. ✨


πŸŽ€ SYNOPSIS πŸŽ€

package Binary;
use base 'Debian::Control::Stanza';
use constant fields => qw( Package Depends Conflicts );

1;

look at that. clean. gorgeous. we love a class that knows what it is. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so Debian::Control::Stanza is the base class for two other classes: Debian::Control::Stanza::Source and Debian::Control::Stanza::Binary. it's giving parent energy, it's giving "I raised them". lowkey the blueprint. πŸ‘‘


⭐ FIELDS ⭐

the fields of a stanza get defined in the class method fields. typically you do it like this:

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

and here's the cute part: any field meant to hold a list of dependencies (you know, the ones the is_dependency_list method below is about) gets converted automatically into an instance of the Debian::Dependencies class. automatic glow-up, no cap. πŸ’–

🌈 User-defined fields

yesss, user-defined fields are supported, you can make your own. they start with X, and then optionally an S, B or C, then _, then a capital letter, then other letters and digits.

examples? we gotchu: X_Moon_Phase, XS_Hemisphere. πŸŒ™

peep the lore at <https://www.debian.org/doc/debian-policy/#user-defined-fields>.


🧚 CONSTRUCTOR 🧚

new

new( { field => value, ... } )

makes you a brand new Debian::Control::Stanza object, and if you want, it initializes it with the data you hand over. the object is hashref based and it's tied to Tie::IxHash β€” so yes bestie, the order stays exactly how you put it. we love an ordered queen. ✨

you are allowed to use dashes for the initial field names, but heads up, they get converted to underscores:

my $s = Debian::Control::Stanza::Source( {Build-Depends => "perl"} );
print $s->Build_Depends;

see how Build-Depends became Build_Depends? that's the conversion, and it ate. πŸ’…


πŸ’€ METHODS πŸ’€

is_dependency_list($field)

returns true if $field holds a list of dependencies. by default it's true for these fields right here:

  • Build_Depends
  • Build_Depends_Indep
  • Build_Depends_Arch
  • Build_Conflicts
  • Build_Conflicts_Indep
  • Build_Conflicts_Arch
  • Depends
  • Conflicts
  • Enhances
  • Replaces
  • Breaks
  • Pre_Depends
  • Recommends
  • Suggests

that's fourteen, count 'em. πŸ‘‘

is_comma_separated($field)

returns true if the given field is meant to hold a comma-separated list of values. this matters in stringification, when it's figuring out where to wrap the long lines. (so basically the line-wrapping decisions live here. main character energy.)

by default these fields are flagged as having such lists:

  • All fields that contain dependencies (see above) πŸ‘€
  • Uploaders
  • Provides

looks_like_an_x_field($field)

returns true if $field is considered an appropriate name for a user-defined field. vibe check passed, or nah. πŸ¦‹

get($field)

overrides the default get method from Class::Accessor, and swaps in Tie::IxHash's FETCH instead. not me improving on the classic.

set( $field, $value )

overrides the default set method from Class::Accessor, swapping in Tie::IxHash's STORE. and while it's at it, it converts $value into an instance of the Debian::Dependencies class β€” but only if $field is supposed to contain a dependency list (as decided by the is_dependency_list method, remember her?).

as_string([$width])

returns a string representation of the object, ready to be printed straight into a real debian/control file. it's also used as the stringification operator. periodt.

fields that are comma-separated use one line per item β€” except if they look like "${some:Field}", in which case they get wrapped at the $widthth column. and $width defaults to 80. 🌸


Copyright (C) 2009, 2017 Damyan Ivanov dmn@debian.org

Copyright (C) 2020 gregor herrmann gregoa@debian.org

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.

fr fr read the license, bestie, it's literally right there. πŸ’œ

and that's the whole page!! this was Debian...:Stanza from perl v5.40.1, dated 2026-05-08, per the User Contributed Perl Documentation. ty for coming to my ted talk, stan the stanza, bye bestie!! πŸŽ€βœ¨πŸ’–πŸ«Ά

πŸ“¦ where this page comes from