NAME
Ancient - Ancient Perl utilities
DESCRIPTION
We've had a Modern perl so with that logic I guess it's time for an Ancient version.
This distribution currently provides eight independent modules:
slot - Global reactive state slots with optional watchers
util - Functional programming utilities with XS acceleration
noop - No-operation functions for benchmarking and testing
const - Fast read-only constants with compile-time optimization
doubly - Doubly linked list implementation
lru - LRU cache with O(1) operations
object - Objects with prototype chains
heap - Binary heap (priority queue)
MODULES
slot
use slot qw(app_name debug);
app_name("MyApp");
print app_name();
Global reactive state slots shared across packages with optional watchers for reactive programming. All slot:: functions are optimized to custom ops when called with constant names.
See slot for full documentation.
util
use util qw(is_array is_hash memo pipeline trim ...);
Fast functional programming utilities including type predicates, memoization, pipelines, lazy evaluation, and more. Many functions use custom ops for compile-time optimization.
See util for full documentation.
noop
use noop;
noop::pp(); # Pure Perl no-op
noop::xs(); # XS no-op
Minimal no-operation functions for benchmarking overhead and baseline performance testing.
See noop for full documentation.
const
use const;
my $pi = const::c(3.14159);
my $name = const::c("immutable");
const::const(my @list => qw/a b c/);
Fast read-only constants with compile-time optimization. When called with literal values, const::c() is optimized away at compile time for zero runtime overhead.
See const for full documentation.
doubly
use doubly;
my $list = doubly->new(1);
$list->add(2)->add(3);
$list = $list->start;
$list = $list->next;
Fast doubly linked list implementation with full navigation, insertion, and removal operations. Approximately 3x faster than pure Perl implementations.
See doubly for full documentation.
lru
use lru;
my $cache = lru::new(1000);
$cache->set('key', $value);
my $val = $cache->get('key');
LRU (Least Recently Used) cache with O(1) operations for get, set, exists, peek, and delete. Automatic eviction when capacity is reached.
See lru for full documentation.
object
use object;
object::define('Cat', qw(name age));
my $cat = new Cat 'Whiskers', 3;
print $cat->name;
Objects with prototype chains stored as arrays for speed. Property accessors are compiled to custom ops. Getters are 2.4x faster and setters 2x faster than traditional blessed hash references.
See object for full documentation.
heap
use heap;
my $pq = heap::new('min');
$pq->push(5)->push(1)->push(3);
print $pq->pop; # 1
Binary heap (priority queue) with configurable min/max behavior. Supports custom comparison callbacks for complex objects. O(log n) push and pop, O(1) peek.
See heap for full documentation.
AUTHOR
LNATION <email@lnation.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.