---
name: "Arch::Registry"
section: "3pm"
platform: "linux"
package: "libarch-perl"
version: "0.5.2-2"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/Arch::Registry"
---

# Arch::Registry(3pm)

manage registered archives, search archives on the web

## NAME

Arch::Registry - manage registered archives, search archives on the web

## SYNOPSIS

```
    use Arch::Registry;
    my $registry = Arch::Registry->new;
    my %archive_locations = $registry->registered_archives;
    $registry->register_archive('http://john.com/archives/main');
    $registry->unregister_archive('john@mail.com--tux');
    %archive_locations = $registry->supermirror_archives;
    die $registry->web_error if $registry->web_error;
    my @john_versions = @{
        $registry->supermirror_archive_versions->{'john@mail.com--tux')
    };
    my $archives = $registry->search_supermirror('.*', '--cset-gui--');
    die $registry->web_error unless defined $archives;
    my $versions = $registry->search_supermirror('john@', '^tla\b', 1);
    print map { "$_\n" } @$versions;  # print john@mail.com--tux/tla...
```

## DESCRIPTION

This class provides the way to register and unregister GNU Arch archives for the caller user and list all registered archives. It also provides the way to search the supermirror (currently mirrors.sourcecontrol.net) by archive name or archive/category/branch/version regexp.

## METHODS

The following class methods are available:

**new**, **register\_archive**, **unregister\_archive**, **registered\_archives**, **set\_web\_cache**, **flag\_web\_cache**, **supermirror\_archives**, **supermirror\_archive\_versions**, **search\_supermirror**, **web\_error**.

- **new**

  Construct Arch::Registry object.

- **register\_archive** *location* \[*archive*\]

  Register archive at the given *location* and optional *archive* (if missing then the location is actually accessed to find the archive name). Returns true on success.

- **unregister\_archive** *archive*

  Unregister *archive*. Returns true on success.

- **registered\_archives**

  Returns a hash (or hashref in scalar context) of registered archives, that is pairs *archive* =\> *location*.

- **set\_web\_cache** \[ *named-values* \]

  Define the web cache to use with operations on the supermirror.

  The keys of *named-values* are *dir* (the web cache directory) and *ttl* (time to live in minutes). If *named-values* is empty or misses *dir*, or *dir* does not exist, the cache is unset.

  This method has a side effect of forgetting memoized real-web-or-cache content fetches. So you may call it with or without parameters to reset the memoized values, although this should rarely be needed.

- **flag\_web\_cache** \[*value*\]

  Turn on or off the web cache depending on the parameter.

  *value* may be "enabled", "disabled", "nowrite" and "noread". Additionally, the false *value* will be taken as "disabled", the true *value* as "enabled".

- **supermirror\_archives**

  Returns a hash (or hashref in scalar context) of archives mirrored on the supermirror, that is pairs *archive* =\> *location*.

- **supermirror\_archive\_versions**

  Returns a hashref of archives mirrored on the supermirror and all their versions, that is pairs *archive* =\> \[ *version*, .. \].

- **search\_supermirror**

  - **search\_supermirror** *archive\_regexp*

  - **search\_supermirror** *archive\_regexp* *version\_regexp*

  - **search\_supermirror** *archive\_regexp* *version\_regexp* *return\_versions*

  Search the archives (and possibly their branches/versions) by *archive* and *version* regular expressions given.

  If *return\_versions* is unset, returns arrayref that is all matching \[ *archive*, .. \]. If *return\_versions* is set to 'joined', returns arrayref that is all matching \[ *archive*/*version*, .. \]. If *return\_versions* is set to 'hashref', returns hashref similar to **supermirror\_archive\_versions** that is all matching { *archive* =\> \[ *version*, .. \], ... }.

  If **web\_error** occurred, returns undef.

  *archive\_regexp* defaults to "any", *version\_regexp* defaults to "any", *return\_versions* defaults to false.

- **web\_error**

  Returns the string containing the error while fetching one or another supermirror url (the last one). Returns undef if no error occured.

## BUGS

Waiting for your reports.

## AUTHORS

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).

## SEE ALSO

For more information, see tla, Arch::Util, Arch::LiteWeb.
