Arch::Changes(3pm)

πŸ“¦ version 0.5.2, in ubuntu jammy

πŸ’– 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 of ADD, DELETE, MODIFY, META_MODIFY or RENAME.
  • 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 type RENAME, 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 (ADD or DELETE), or a hashref with a combination of one-to-three keys (MODIFY, META_MODIFY and RENAME). 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