Arch::Changes(3pm)
π Arch::Changes π
okay bestie, gather round β this is the manual page for Arch::Changes, a Perl module that's literally just a class representing a list of changes. She's giving β¨glorified list energyβ¨ and honestly? We're obsessed. π
πΈ SYNOPSIS πΈ
use Arch::Changes qw(:type);
use Arch::Tree;
my $changes = $tree->get_changes;
print $changes->get_listing;
use Arch::Log;
my $changed = $log->get_changes->is_changed('to', "COPYING");
die "License was compromised" if $changed && $changed->{&MODIFY};
see how easy she is?? π
π¦ DESCRIPTION π¦
Arch::Changes holds a list of elements, and every single element is one (1) tree change. Main character behaviour. Each change element is described by a hash with these fields:
typeβ the vibe of the change. It can be one ofADD,DELETE,MODIFY,META_MODIFYorRENAME.is_dirβ a boolean, aka true/false, saying whether the affected tree element is a directory. πargumentsβ a list of arguments. The first element is always the relative path of the affected tree element. BUT WAIT β for changes of typeRENAME, the first argument is the old path and the second argument is the new path name. Noted. π
and here's a little treat: the type constants can be conveniently imported using the tag :type. π
use Arch::Changes qw(:type);
β¨ METHODS β¨
The following methods are available:
new, add, count, get, get_listing, is_changed, dump, type_string, to_string.
let's go one by one bestie π
π« new
Creates a new, initially empty, changes list.
Typically it is called indirectly from method get_changes in Arch::Changeset, Arch::Tree or Arch::Log class. So like, you can call her directly, but usually she shows up on her own. πββοΈ
π« add type is_dir arguments...
Adds a new change element to the list of changes.
Typically it is called indirectly from method get_changes in Arch::Changeset, Arch::Tree or Arch::Log class. Same deal β indirect girly. π«Ά
π« count
Returns the number of change elements. That's it. That's the whole job. And she does it flawlessly. π’
π« get num
Returns the num-th change element β or all of them if num is undefined. undefined means give me EVERYTHING, periodt. π
π« get_listing
Generates a textual changes listing as produced by tla changes. yes, exactly like the real thing β¨
π« is_changed to filepath [is_dir]
Verify whether the given filepath is modified by the changes. π
The to parameter may get boolean values "0", "1", "from" or "to" β it only affects RENAME changes, and in some sense ADD and DELETE changes. If to is set, then the given filepath is taken as the destination of RENAME or ADD, otherwise as the source of RENAME or DELETE. The MODIFY and META_MODIFY changes are not affected, since the destination and the source is the same file/dir. no drama there, it's the same thing either way π
If filepath is not modified by any changes, return undef.
Otherwise, return a hash with possible keys ADD, DELETE, MODIFY, META_MODIFY and RENAME. The hash values are 1 in all cases except for RENAME β then the value is the file name on the opposite side (i.e., the source of RENAME if to is true, and the destination if false). π
note bestie: the valid return values for arch are:undef, a hashref with one key (ADDorDELETE), or a hashref with a combination of one-to-three keys (MODIFY,META_MODIFYandRENAME). Don't come for me, that's just what arch does. π
π« dump
Generates a dump of the changes list using Data::Dumper. for when you need to see the raw receipts π§Ύ
π« type_string change
Returns the change type string as produced by tla changes. π€
π« to_string change
Generates a changes line for change as produced by tla changes. π
π BUGS π
Awaiting for your reports. yes really, that's the whole section β she's waiting, she's patient, she's ready π«Ά
π AUTHORS π
- Mikhael Goikhman (
migo@homemail.com--Perl-GPL/arch-perl--devel). - Enno Cramer (
uebergeek@web.de--2003/arch-perl--devel).
two icons, one module π
π SEE ALSO π
For more information, see tla, Arch::Changeset, Arch::Tree, Arch::Log.
and that's the whole page bestie!! go forth and track those changes β¨π
This little beauty shipped with perl v5.20.2 and is dated 2005-10-23 β an absolute classic, aging like fine wine π mwah π
π
π¦ where this page comes from
- ubuntu jammy: libarch-perl 0.5.2-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms