MOP4Import-Declare

 view release on metacpan or  search on metacpan

CLAUDE.md  view on Meta::CPAN

2. **Field Declaration**: Uses Perl's `fields` pragma and `%FIELDS` for compile-time checking of object fields via `my TYPE $var` syntax.

3. **Type System**: The `use MOP4Import::Types` pattern creates typed classes with checked fields, providing compile-time safety for typos in field names.

4. **CLI Framework**: Subcommands are methods prefixed with `cmd_`. Options are fields declared in the class.

5. **OO Modulino Pattern**: Single Perl file acts as both class module and CLI executable. CLI_JSON implements this pattern allowing any method to be called directly from command line for rapid testing and development.

## Testing Considerations

- Tests require multiple Perl modules: Test::Kantan, Test::Differences, Test::Output, Test::Exit, Test2::Tools::Command
- CI runs against Perl versions 5.16 through 5.40 plus threaded builds
- Some tests may skip on older Perl versions (< 5.018)

## Dependencies

Core runtime dependencies:
- JSON::MaybeXS
- Sub::Util >= 1.40
- Module::Runtime

Test dependencies include Test::Kantan, Test::Differences, Capture::Tiny, and others listed in cpanfile.

## Documentation Structure

- **Base/CLI_JSON.pod**: Reference manual for CLI_JSON users (how to use CLI_JSON to write OO Modulino)
- **docs/CLI_JSON_rationale.md**: Explains the rationale and value proposition of CLI_JSON
- **docs/OO_Modulino.md**: Conceptual explanation of the OO Modulino pattern
- **docs/CLI_JSON_rationale.ja.md**: Japanese version of rationale document
- **docs/OO_Modulino.ja.md**: Japanese version of OO Modulino pattern explanation

## CLI_JSON Development Workflow

META.json  view on Meta::CPAN

            "Module::Runtime" : "0",
            "Sub::Util" : "1.40",
            "perl" : "5.010"
         }
      },
      "test" : {
         "requires" : {
            "Capture::Tiny" : "0",
            "Cpanel::JSON::XS" : "4.05",
            "Test2::Tools::Command" : "0",
            "Test::Differences" : "0",
            "Test::Exit" : "0",
            "Test::Kantan" : "0",
            "Test::More" : "1.3021",
            "Test::Output" : "0",
            "YAML::Syck" : "0"
         }
      }
   },
   "provides" : {
      "MOP4Import::Base::CLI" : {

META.yml  view on Meta::CPAN

abstract: 'Thin Meta-Object Protocol to build extensible exporters'
author:
  - 'KOBAYASHI, Hiroaki <hkoba@cpan.org>'
build_requires:
  Capture::Tiny: '0'
  Cpanel::JSON::XS: '4.05'
  JSON::PP: '2.273'
  Module::Build: '0.42'
  Module::Build::Pluggable::CPANfile: '0.05'
  Test2::Tools::Command: '0'
  Test::Differences: '0'
  Test::Exit: '0'
  Test::Kantan: '0'
  Test::More: '1.3021'
  Test::Output: '0'
  YAML::Syck: '0'
  rlib: '0'
configure_requires:
  Module::Build: '0.42'
  Module::Build::Pluggable::CPANfile: '0.05'
  rlib: '0'

cpanfile  view on Meta::CPAN

on build => sub {
  requires 'rlib';
  requires 'Module::Build', '>= 0.42';
  requires 'Module::Build::Pluggable::CPANfile';
  requires 'JSON::PP', '>= 2.273';
};

on test => sub {
  requires 'Test::More', '>= 1.3021';
  requires 'Test::Kantan';
  requires 'Test::Differences';
  requires 'Capture::Tiny';
  requires 'Test::Output';
  requires 'Test::Exit';
  requires 'Test2::Tools::Command';
  requires 'YAML::Syck';
  requires 'Cpanel::JSON::XS', '>= 4.05';
};

t/06_cmd_help.t  view on Meta::CPAN

#----------------------------------------
use strict;
use warnings qw(FATAL all NONFATAL misc);
use Carp;
use FindBin; BEGIN { do "$FindBin::Bin/t_lib.pl" }

use File::Basename;
use File::Spec;

use Test::More;
use Test::Differences;
use Capture::Tiny qw(capture_stderr);

my $testDir = "$FindBin::Bin/examples";

use_ok("MOP4Import::Util::Inspector");

my $inspectorFn = $INC{"MOP4Import/Util/Inspector.pm"};
my $distLib = dirname(dirname(dirname(File::Spec->rel2abs($inspectorFn))));

my @run = ($^X, "-I$distLib");



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