Catman...:AlephX(3pm)

✨ NAME ✨

Catmandu::Store::AlephX β€” it's a Catmandu AlephX service, bestie, and it's implemented as a Catmandu::Store. That's the whole vibe. It's from the User Contributed Perl Documentation collection, and the page itself is the one and only Catman...:AlephX(3pm). πŸŽ€


🌸 SYNOPSIS 🌸

okay so this is how you actually use it, no cap:

use Catmandu::Store::AlephX;

my $store = Catmandu::Store::AlephX->new(url => 'http://aleph.ugent.be/X' , username => 'XXX' , password => 'XXX');

$store->bag('usm01')->each(sub {
});

Like, you spin up the store with a url, a username, and a password (the 'XXX's are placeholders, do not come for me), grab yourself a bag, and each your way through every record in it. πŸ¦‹


πŸ’… METHODS πŸ’…

πŸ’– get($id)

Pulls a record out of the Aleph database. It needs a record identifier, periodt. When it finds the thing you asked for it hands you back a Catmandu MARC record, and on failure it gives you undef. So like… vibe check your return value, fr fr. 😭

πŸ’– add($catmandu_marc)

Adds or updates a record in the Aleph database. It requires a Catmandu type MARC record, and that record needs a _id field holding the Aleph record number. Heads up: this method will throw an error when an add can't be executed. It's giving dramatic but honestly valid. πŸ’€

example

🚨 WARNING (the original says it, I'm just screaming it louder): Aleph will ignore the 001 field.
 #add new record. WARNING: Aleph will ignore the 001 field,
my $new_record = eval {
  $bag->add({
  record =>  [
    [
      'FMT',
      '',
      '',
      '_',
      'SE'
    ],
    [
      'LDR',
      '',
      '',
      '_',
      '00000cas^^2200385^a^4500'
    ],
    [
      '001',
      '',
      '',
      '_',
      '000000444'
    ],
    [
      '005',
      '',
      '',
      '_',
      '20140212095615.0'
    ]
    ..
  ]
});

};
if ($@) {
  die "add failed $@";
}

say "new record:".$record->{_id};

So you eval the add, you check $@, you die with "add failed $@"; if it all went sideways, and if it slayed you get to say your brand new $record->{_id}. 🌈

πŸ’– delete($id)

Deletes a record from the Aleph database. Needs a record identifier, and returns a true value when the record is deleted. Gone. Poof. ✨

πŸ’– each(callback)

Loops over all the records in the Aleph database, executing your callback for every single one of them. Every. Single. One. πŸ‘‘

πŸ’– search(query => $query, start => 0 , limit => 20);

That's the line, bestie. It's right there. πŸ’

πŸ’– searcher()

Not implemented. πŸ™ˆ

πŸ’– delete_all()

Not implemented. πŸ™ˆ

πŸ’– delete_by_query()

Not implemented. πŸ™ˆ


🫢 SEE ALSO 🫢

  • Catmandu::Store β€” go read that one too, iykyk.

and that's the whole page, bestie β€” sending you off with the receipts: this was Catman...:AlephX(3pm), a User Contributed Perl Documentation page, running on perl v5.36.0, and dated 2023-02-02. ily, go write some Perl. πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from