Langertha

 view release on metacpan or  search on metacpan

.claude/skills/perl-moose/SKILL.md  view on Meta::CPAN

```

Use `method` (not `sub`) inside `role { }` block. Non-core — adds `MooseX::Role::Parameterized` dependency.

---

## Pattern 7 – Attribute Options Cheatsheet

```perl
has name    => (is => 'ro',   required => 1);
has tags    => (is => 'ro',   isa => 'ArrayRef[Str]', default => sub { [] });  # ALWAYS coderef for refs
has content => (is => 'lazy');                     # built on first access
sub _build_content { "generated: " . $_[0]->name }

has status  => (
    is      => 'rw',
    isa     => 'Str',
    trigger => sub {                               # fires on new() and set
        my ($self, $new, $old) = @_;              # $old is undef on construction
        die "bad status" unless $new =~ /\A(new|ok|done)\z/;
    },

.claude/skills/perl-moose/SKILL.md  view on Meta::CPAN

    where { $_ > 0 },
    message { "$_ is not a positive integer" };

coerce 'PositiveInt',
    from 'Str',
    via { int($_) };

# Or use Type::Tiny (recommended — works with both Moo and Moose):
use Types::Standard qw(Str Int ArrayRef InstanceOf);
has name => (is => 'ro', isa => Str);
has items => (is => 'ro', isa => ArrayRef[Str], default => sub { [] });
```

Prefer `Type::Tiny` / `Types::Standard` — portable between Moo and Moose, better error messages.

---

## Decision Guide

| Situation | Use |
|---|---|

ex/synopsis.pl  view on Meta::CPAN

    # use Moose::Util::TypeConstraints;
    #
    # # Base class for all GeoJSON objects
    # has 'type' => (is => 'ro', isa => 'Str', required => 1);
    #
    # package GeoJSON::Point;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'Point');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[Num]', required => 1);
    #
    # package GeoJSON::LineString;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'LineString');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[ArrayRef[Num]]', required => 1);
    #
    # package GeoJSON::Polygon;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'Polygon');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[ArrayRef[ArrayRef[Num]]]', required => 1);
    #
    # package GeoJSON::MultiPoint;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'MultiPoint');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[ArrayRef[Num]]', required => 1);
    #
    # package GeoJSON::MultiLineString;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'MultiLineString');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[ArrayRef[ArrayRef[Num]]]', required => 1);
    #
    # package GeoJSON::MultiPolygon;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'MultiPolygon');
    # has 'coordinates' => (is => 'ro', isa => 'ArrayRef[ArrayRef[ArrayRef[ArrayRef[Num]]]]', required => 1);
    #
    # package GeoJSON::GeometryCollection;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'GeometryCollection');
    # has 'geometries' => (is => 'ro', isa => 'ArrayRef[GeoJSON]', required => 1);
    #
    # package GeoJSON::Feature;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'Feature');
    # has 'geometry' => (is => 'ro', isa => 'GeoJSON', required => 1);
    # has 'properties' => (is => 'ro', isa => 'HashRef', default => sub { {} });
    # has 'id' => (is => 'ro', isa => 'Str', predicate => 'has_id');
    #
    # package GeoJSON::FeatureCollection;
    # use Moose;
    # extends 'GeoJSON';
    #
    # has '+type' => (default => 'FeatureCollection');
    # has 'features' => (is => 'ro', isa => 'ArrayRef[GeoJSON::Feature]', required => 1);
    #
    # 1;
    # ```
    #
    # This set of classes provides a structured way to work with GeoJSON data in Perl using Moose. Here's a brief explanation of each class:
    #
    # 1. `GeoJSON`: Base class for all GeoJSON objects.
    # 2. `GeoJSON::Point`: Represents a single point.
    # 3. `GeoJSON::LineString`: Represents a line of connected points.
    # 4. `GeoJSON::Polygon`: Represents a polygon (closed shape).

lib/Langertha/UsageRecord.pm  view on Meta::CPAN


has model    => ( is => 'ro', isa => 'Maybe[Str]' );
has provider => ( is => 'ro', isa => 'Maybe[Str]' );
has engine   => ( is => 'ro', isa => 'Maybe[Str]' );
has route    => ( is => 'ro', isa => 'Maybe[Str]' );
has endpoint => ( is => 'ro', isa => 'Maybe[Str]' );

has api_key_id => ( is => 'ro', isa => 'Maybe[Str]' );

has tool_calls => ( is => 'ro', isa => 'Int', default => 0 );
has tool_names => ( is => 'ro', isa => 'ArrayRef[Str]', default => sub { [] } );

has duration_ms => ( is => 'ro', isa => 'Maybe[Num]' );
has started_at  => ( is => 'ro', isa => 'Maybe[Num]' );
has finished_at => ( is => 'ro', isa => 'Maybe[Num]' );

has pricing_version => ( is => 'ro', isa => 'Maybe[Str]' );

sub to_hash {
  my ($self) = @_;
  return {



( run in 0.969 second using v1.01-cache-2.11-cpan-39bf76dae61 )