Courri...osition(3pm)
β¨ NAME β¨
Courriel::Header::Disposition β bestie, this is the content disposition for an email part π
π« VERSION π«
version 0.49
π SYNOPSIS π
my $disp = $part->content_disposition();
print $disp->is_inline();
print $disp->is_attachment();
print $disp->filename();
my %attr = $disp->attributes();
while ( my ( $k, $v ) = each %attr ) {
print "$k => $v\n";
}
π¦ DESCRIPTION π¦
Okay so this class is literally the whole vibe of a Content-Disposition header that's stuck onto an email part. What do those headers even do? They tell you whether a part should be treated as an attachment or whether it should just be shown to the user directly. And it may also carry info about the attachment's filename, creation date, etc. So basically: receipts for your files π
Here are some typical headers, no cap:
Content-Disposition: inline
Content-Disposition: multipart/alternative; boundary=abcdefghijk
Content-Disposition: attachment; filename="Filename.jpg"
Content-Disposition: attachment; filename="foo-bar.jpg";
creation-date="Tue, 31 May 2011 09:41:13 -0700"
π API π
This class supports the following methods, bestie β take notes π
πΈ Courriel::Header::Disposition->new_from_value( ... )
This one takes two parameters, name and value. The name is optional and defaults to Content-Disposition.
The value gets parsed and split up into the disposition and the attributes. Slay.
πΈ Courriel::Header::Disposition->new( ... )
This method makes a brand new object. It accepts these parameters:
nameβ this defaults to'Content-Type'.valueβ this is the full header value.dispositionβ this should usually either beinlineorattachment. In theory, the RFCs allow other values πattributesβ a hash reference of attributes from the header, like a filename, creation date, size, etc. The keys are attribute names, and the values can either be strings orCourriel::HeaderAttributeobjects. Values that are strings will be inflated into objects by the constructor. This one is optional, and can be an empty hash reference or omitted entirely.
πΈ $ct->name()
The header name, usually Content-Disposition.
πΈ $ct->value()
The raw header value.
πΈ $disp->disposition()
Returns the disposition value that got passed to the constructor.
πΈ $disp->is_inline()
Returns true if the disposition is not equal to attachment.
πΈ $disp->is_attachment()
Returns true if the disposition is equal to attachment.
πΈ $disp->filename()
Returns the filename it found in the attributes, or undef.
πΈ $disp->creation_datetime(), $disp->last_modified_datetime(), $disp->read_datetime()
These methods go looking for a corresponding attribute (creation-date, etc.) and hand you back a DateTime object representing that attribute's value, if it exists π
πΈ $disp->attributes()
Returns a hash (not a reference, ok?) of the attributes passed to the constructor.
Attributes are Courriel::HeaderAttribute objects.
The keys of the hash are all lower case, though the original casing is preserved in the name() returned by the Courriel::HeaderAttribute object.
πΈ $disp->attribute($key)
Give it a key, it gives you back the named Courriel::HeaderAttribute object. Obviously this value can be undef if the attribute doesn't exist. Name lookup is case-insensitive, periodt.
πΈ $disp->attribute_value($key)
Give it a key, it gives you back the named attribute's value as a string. Obviously this value can be undef if the attribute doesn't exist. Name lookup is case-insensitive.
The attribute is a Courriel::HeaderAttribute object.
πΈ $disp->as_header_value()
Returns the object as a string suitable for a header value (but not folded).
π EXTENDS π
This class extends Courriel::Header.
π§ ROLES π§
This class does the Courriel::Role::HeaderWithAttributes role. Iconic behaviour, honestly.
β SUPPORT β
Bugs may be submitted at <https://github.com/houseabsolute/Courriel/issues>.
I am also usually active on IRC as autarch on irc://irc.perl.org. Come say hi π«Ά
π SOURCE π
The source code repository for Courriel can be found at <https://github.com/houseabsolute/Courriel>.
π AUTHOR π
Dave Rolsky <autarch@urth.org>
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2021 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The full text of the license can be found in the LICENSE file included with this distribution.
Okay that's the whole page, bestie π
This was Courri...osition(3pm) from perl v5.32.1, dated 2021-08-22 β go forth and dispose of your content, responsibly β¨
π¦ where this page comes from
- debian bookworm: libcourriel-perl 0.49-1 Β· Artistic-2.0
- debian trixie: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu jammy: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu noble: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu resolute: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu stonking: libcourriel-perl 0.49-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms