Replace Moose with Moo#33
Conversation
Agent-Logs-Url: https://github.com/worthmine/Text-vCard-Precisely/sessions/0e84e18d-a351-4e7c-9213-a25b5611482f Co-authored-by: worthmine <2944869+worthmine@users.noreply.github.com>
Agent-Logs-Url: https://github.com/worthmine/Text-vCard-Precisely/sessions/0e84e18d-a351-4e7c-9213-a25b5611482f Co-authored-by: worthmine <2944869+worthmine@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the Text::vCard::Precisely codebase from the Moose/MooseX stack to Moo + Type::Tiny, updating type constraints/coercions and related attribute patterns across the vCard v3/v4 modules.
Changes:
- Replaced
use Moose/Moose::Util::TypeConstraints/ MooseX type libs withuse Moo,Type::Utils, andTypes::Standard(Type::Tiny objects) throughout the library. - Updated coercions and shared cross-package type constraints to use
declare/enumvariables (including fully-qualifiedour $Typesharing between packages). - Updated collection handling to use
MooX::HandlesVia, and updated distribution dependencies incpanfileandMETA.json.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| META.json | Updates runtime dependencies to Moo/Type::Tiny stack and new validation libs. |
| cpanfile | Mirrors dependency migration (adds Moo/Type::Tiny/MooX::HandlesVia/Email::Valid/DateTime::TimeZone). |
| lib/Text/vCard/Precisely/V4/Node/Tel.pm | Migrates to Moo + Type::Tiny types; converts override to plain method. |
| lib/Text/vCard/Precisely/V4/Node/Related.pm | Replaces Moose subtypes/coercions with Type::Tiny declare + coercions. |
| lib/Text/vCard/Precisely/V4/Node/N.pm | Switches to Moo; uses Types::Standard types. |
| lib/Text/vCard/Precisely/V4/Node/Member.pm | Converts subtype declaration to Type::Tiny and updates attribute isa. |
| lib/Text/vCard/Precisely/V4/Node/Image.pm | Uses cross-package shared Type::Tiny constraints from V3 Image node. |
| lib/Text/vCard/Precisely/V4/Node/Address.pm | Switches to Moo; updates attribute type constraints. |
| lib/Text/vCard/Precisely/V4/Node.pm | Converts enums/subtypes to Type::Tiny objects shared via our variables. |
| lib/Text/vCard/Precisely/V4.pm | Replaces Moose coercion/type system with Type::Tiny equivalents; converts override to around where needed. |
| lib/Text/vCard/Precisely/V3/Node/URL.pm | Switches to Moo + Type::Tiny; updates URL coercion/type usage. |
| lib/Text/vCard/Precisely/V3/Node/Tel.pm | Migrates Tel node types/subtypes to Type::Tiny. |
| lib/Text/vCard/Precisely/V3/Node/SocialProfile.pm | Migrates SocialProfile types/coercions to Type::Tiny. |
| lib/Text/vCard/Precisely/V3/Node/N.pm | Migrates name content coercions/types to Type::Tiny. |
| lib/Text/vCard/Precisely/V3/Node/MultiContent.pm | Migrates enum + array coercion to Type::Tiny. |
| lib/Text/vCard/Precisely/V3/Node/Image.pm | Migrates image/base64 validation and media type constraints to Type::Tiny. |
| lib/Text/vCard/Precisely/V3/Node/Email.pm | Replaces MooseX::Types::Email with Email::Valid-backed Type::Tiny constraint. |
| lib/Text/vCard/Precisely/V3/Node/Address.pm | Switches to Moo; uses Types::Standard for address fields. |
| lib/Text/vCard/Precisely/V3/Node.pm | Converts shared base node types ($Types, $Content, etc.) to Type::Tiny objects. |
| lib/Text/vCard/Precisely/V3.pm | Replaces Moose types/coercions with Type::Tiny; includes the Nodes coercion arrayref fix described in PR body. |
| lib/Text/vCard/Precisely/Multiple.pm | Migrates native array handling from Moose traits to MooX::HandlesVia. |
| lib/Text/vCard/Precisely.pm | Switches to Moo and updates version enum typing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| use Types::Standard qw(Str Int ArrayRef HashRef Maybe Ref InstanceOf Object); | ||
|
|
||
| use Carp; | ||
| use Data::UUID; |
There was a problem hiding this comment.
Fixed in 5569a5f — added use DateTime::TimeZone; to V3.pm alongside the other imports. Also fixed the unescaped dot in the PIDNum regex in V4/Node.pm ((?:.\d) → (?:\.\d)).
| subtype 'PIDNum' => as 'Num' => where {m/^\d(?:.\d)?$/s} | ||
| => message {"The PID you provided, $_, was not supported"}; | ||
| has pid => ( is => 'rw', isa => subtype 'PID' => as 'ArrayRef[PIDNum]' ); | ||
| our $PIDNum = declare 'PIDNum', as Num, where {m/^\d(?:.\d)?$/s}, |
There was a problem hiding this comment.
Already fixed in 5569a5f — the dot is now escaped: m/^\d(?:\.\d)?$/s.
…PIDNum regex Agent-Logs-Url: https://github.com/worthmine/Text-vCard-Precisely/sessions/242143be-5a24-4e8e-b0b6-9d961d420214 Co-authored-by: worthmine <2944869+worthmine@users.noreply.github.com>
3f8a36d
into
copilot/adopt-github-actions-from-travis
Replaces the Moose/MooseX stack with the lighter Moo + Type::Tiny equivalents across all 20 library modules.
Dependency changes
Moose,Moose::Util::TypeConstraints,MooseX::Types::DateTime,MooseX::Types::Email→ removedMoo,Type::Tiny,MooX::HandlesVia,Email::Valid,DateTime::TimeZonePer-file migration pattern
use Moose→use Mooisa => 'Str') → Type::Tiny objects (isa => Str)subtype/enumdeclarations →my/ourvariables viaType::Utils:coerce 'X', from 'Str'→coerce $X, from Stroverride 'method' => sub { super() }→around 'method' => sub { my ($orig, $self) = @_; $self->$orig() }traits => ['Array']+elements→handles_via => 'Array'+all(viaMooX::HandlesVia)__PACKAGE__->meta->make_immutable()removed;no Moose→no MooCross-package type sharing
Types shared across packages (e.g.
$UIDfromV3.pmused inV4.pm) are declared withourand accessed via their fully-qualified package variable name.Type::Utilsis imported explicitly (not-all) to avoidextendsconflict with Moo.Bug fix (pre-existing)
return \map { ... } @$_in theNodescoerce inV3.pmwas returning a list of scalar references instead of anArrayRef. Fixed toreturn [ map { ... } @$_ ].