App-SahUtils

 view release on metacpan or  search on metacpan

script/show-sah-coerce-rule-module  view on Meta::CPAN

        $name =~ /\A\w+(::\w+)*\z/
            or return [400, "Invalid module name '$name'"];;
        my $found;
        for my $prefix ("Data::Sah::Coerce", "Data::Sah::Coerce::perl", "Data::Sah::Coerce::js", "") {
            my $fullname = "$prefix\::$name";
            my $path = Module::Path::More::module_path(module => $fullname);
            next unless $path;
            $found++;
            return [200, "OK", File::Slurper::read_text($path)];
        }
        return [404, "No such coerce module name '$name'"] unless $found;
    } else {
        return [400, "Please specify name of a Sah schema module (or -l)"];
    }
}

Perinci::CmdLine::Any->new(
    url => '/main/app',
    pass_cmdline_object => 1,
)->run;

script/show-sah-filter-rule-module  view on Meta::CPAN

        $name =~ /\A\w+(::\w+)*\z/
            or return [400, "Invalid module name '$name'"];;
        my $found;
        for my $prefix ("Data::Sah::Filter", "Data::Sah::Filter::perl", "Data::Sah::Filter::js", "") {
            my $fullname = "$prefix\::$name";
            my $path = Module::Path::More::module_path(module => $fullname);
            next unless $path;
            $found++;
            return [200, "OK", File::Slurper::read_text($path)];
        }
        return [404, "No such filter module name '$name'"] unless $found;
    } else {
        return [400, "Please specify name of a Sah filter module (or -l)"];
    }
}

Perinci::CmdLine::Any->new(
    url => '/main/app',
    pass_cmdline_object => 1,
)->run;

script/show-sah-value-rule-modules  view on Meta::CPAN

        $name =~ /\A\w+(::\w+)*\z/
            or return [400, "Invalid module name '$name'"];;
        my $found;
        for my $prefix ("Data::Sah::Value", "Data::Sah::Value::perl", "Data::Sah::Value::js", "") {
            my $fullname = "$prefix\::$name";
            my $path = Module::Path::More::module_path(module => $fullname);
            next unless $path;
            $found++;
            return [200, "OK", File::Slurper::read_text($path)];
        }
        return [404, "No such value rule module name '$name'"] unless $found;
    } else {
        return [400, "Please specify name of a Sah value rule module (or -l)"];
    }
}

Perinci::CmdLine::Any->new(
    url => '/main/app',
    pass_cmdline_object => 1,
)->run;



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