Types-Path-Tiny-0.005/000755 000765 000024 00000000000 12161130146 014662 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/Changes000644 000765 000024 00000001207 12161130146 016155 0ustar00davidstaff000000 000000 Revision history for Types-Path-Tiny 0.005 2013-06-21 15:58:27 America/New_York - Removed MooseX::Types::Path::Tiny given pending split into separate dists 0.004 2013-06-21 13:05:55 America/New_York - Bumped Type::Tiny prereq to avoid known bugs in it 0.003 2013-06-20 16:01:13 America/New_York - Converted to Type::Tiny; works with Moose or Moo now - Dropped Perl prereq to v5.8.1 0.002 2013-02-12 09:35:41 America/New_York - Bump Moose version prereq to 2, just in case anyone out there still has version 1 installed. 0.001 2013-01-31 10:45:24 America/New_York - First release Types-Path-Tiny-0.005/CONTRIBUTING000644 000765 000024 00000003254 12161130146 016520 0ustar00davidstaff000000 000000 CONTRIBUTING Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. The distribution is managed with Dist::Zilla. This means than many of the usual files you might expect are not in the repository, but are generated at release time (e.g. Makefile.PL). However, you can run tests directly using the 'prove' tool: $ prove -l $ prove -lv t/some_test_file.t For most distributions, 'prove' is entirely sufficent for you to test any patches you have. You may need to satisfy some dependencies. See the included META.json file for a list. If you install App::mymeta_requires from CPAN, it's easy to satisfy any that you are missing by piping the output to your favorite CPAN client: $ mymeta-requires | cpanm $ cpan `mymeta-requires` Likewise, much of the documentation Pod is generated at release time. Depending on the distribution, some documentation may be written in a Pod dialect called WikiDoc. (See Pod::WikiDoc on CPAN.) If you would like to submit a documentation edit, please limit yourself to the documentation you see. If you see typos or documentation issues in the generated docs, please email or open a bug ticket instead of patching. Dist::Zilla is a very powerful authoring tool, but requires a number of author-specific plugins. If you would like to use it for contributing, install it from CPAN, then run one of the following commands, depending on your CPAN client: $ cpan `dzil authordeps` $ dzil authordeps | cpanm Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil xtest You can learn more about Dist::Zilla at http://dzil.org/ Types-Path-Tiny-0.005/dist.ini000644 000765 000024 00000000654 12161130146 016333 0ustar00davidstaff000000 000000 name = Types-Path-Tiny author = David Golden license = Apache_2_0 copyright_holder = David Golden copyright_year = 2013 [@DAGOLDEN] :version = 0.035 AutoMetaResources.bugtracker.rt = 0 AutoMetaResources.bugtracker.github = user:dagolden stopwords = AbsDir stopwords = AbsFile stopwords = AbsPath stopwords = SUBTYPES stopwords = coercions stopwords = diretory stopwords = subtype stopwords = subtypes Types-Path-Tiny-0.005/lib/000755 000765 000024 00000000000 12161130146 015430 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/LICENSE000644 000765 000024 00000026354 12161130146 015701 0ustar00davidstaff000000 000000 This software is Copyright (c) 2013 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Types-Path-Tiny-0.005/Makefile.PL000644 000765 000024 00000003325 12161130146 016637 0ustar00davidstaff000000 000000 use strict; use warnings; use 5.008001; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "Path::Tiny types and coercions for Moose and Moo", "AUTHOR" => "David Golden ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Types-Path-Tiny", "EXE_FILES" => [], "LICENSE" => "apache", "NAME" => "Types::Path::Tiny", "PREREQ_PM" => { "Path::Tiny" => 0, "Type::Library" => "0.008", "Type::Utils" => 0, "Types::Standard" => 0, "Types::TypeTiny" => "0.004", "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Find" => 0, "File::Spec::Functions" => 0, "File::Temp" => "0.18", "File::pushd" => 0, "List::Util" => 0, "Test::More" => "0.96" }, "VERSION" => "0.005", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; my $br = $WriteMakefileArgs{BUILD_REQUIRES}; for my $mod ( keys %$tr ) { if ( exists $br->{$mod} ) { $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; } else { $br->{$mod} = $tr->{$mod}; } } } unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Types-Path-Tiny-0.005/MANIFEST000644 000765 000024 00000000566 12161130146 016022 0ustar00davidstaff000000 000000 CONTRIBUTING Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Types/Path/Tiny.pm perlcritic.rc t/00-compile.t t/00-report-prereqs.t t/basic.t tidyall.ini xt/author/critic.t xt/author/pod-spell.t xt/release/distmeta.t xt/release/minimum-version.t xt/release/pod-coverage.t xt/release/pod-syntax.t xt/release/portability.t xt/release/test-version.t Types-Path-Tiny-0.005/META.json000644 000765 000024 00000004304 12161130146 016304 0ustar00davidstaff000000 000000 { "abstract" : "Path::Tiny types and coercions for Moose and Moo", "author" : [ "David Golden " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560", "license" : [ "apache_2_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Types-Path-Tiny", "no_index" : { "directory" : [ "t", "xt", "examples", "corpus" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Meta" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Path::Tiny" : "0", "Type::Library" : "0.008", "Type::Utils" : "0", "Types::Standard" : "0", "Types::TypeTiny" : "0.004", "perl" : "5.008001", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "ExtUtils::MakeMaker" : "0", "File::Find" : "0", "File::Spec::Functions" : "0", "File::Temp" : "0.18", "File::pushd" : "0", "List::Util" : "0", "Test::More" : "0.96" } } }, "provides" : { "Types::Path::Tiny" : { "file" : "lib/Types/Path/Tiny.pm", "version" : "0.005" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/dagolden/types-path-tiny/issues" }, "homepage" : "https://metacpan.org/release/Types-Path-Tiny", "repository" : { "type" : "git", "url" : "git://github.com/dagolden/types-path-tiny.git", "web" : "https://github.com/dagolden/types-path-tiny" } }, "version" : "0.005", "x_contributors" : [ "Toby Inkster " ] } Types-Path-Tiny-0.005/META.yml000644 000765 000024 00000002155 12161130146 016136 0ustar00davidstaff000000 000000 --- abstract: 'Path::Tiny types and coercions for Moose and Moo' author: - 'David Golden ' build_requires: ExtUtils::MakeMaker: 0 File::Find: 0 File::Spec::Functions: 0 File::Temp: 0.18 File::pushd: 0 List::Util: 0 Test::More: 0.96 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560' license: apache meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Types-Path-Tiny no_index: directory: - t - xt - examples - corpus package: - DB provides: Types::Path::Tiny: file: lib/Types/Path/Tiny.pm version: 0.005 requires: Path::Tiny: 0 Type::Library: 0.008 Type::Utils: 0 Types::Standard: 0 Types::TypeTiny: 0.004 perl: 5.008001 strict: 0 warnings: 0 resources: bugtracker: https://github.com/dagolden/types-path-tiny/issues homepage: https://metacpan.org/release/Types-Path-Tiny repository: git://github.com/dagolden/types-path-tiny.git version: 0.005 x_contributors: - 'Toby Inkster ' Types-Path-Tiny-0.005/perlcritic.rc000644 000765 000024 00000001072 12161130146 017350 0ustar00davidstaff000000 000000 severity = 5 verbose = 8 [Variables::ProhibitPunctuationVars] allow = $@ $! [TestingAndDebugging::ProhibitNoStrict] allow = refs # Turn these off [-BuiltinFunctions::ProhibitStringyEval] [-ControlStructures::ProhibitPostfixControls] [-ControlStructures::ProhibitUnlessBlocks] [-Documentation::RequirePodSections] [-InputOutput::ProhibitInteractiveTest] [-References::ProhibitDoubleSigils] [-RegularExpressions::RequireExtendedFormatting] [-InputOutput::ProhibitTwoArgOpen] [-Modules::ProhibitEvilModules] # Turn this on [Lax::ProhibitStringyEval::ExceptForRequire] Types-Path-Tiny-0.005/README000644 000765 000024 00000005771 12161130146 015554 0ustar00davidstaff000000 000000 NAME Types::Path::Tiny - Path::Tiny types and coercions for Moose and Moo VERSION version 0.005 SYNOPSIS ### specification of type constraint with coercion package Foo; use Moose; use Types::Path::Tiny qw/Path AbsPath/; has filename => ( is => 'ro', isa => Path, coerce => 1, ); has directory => ( is => 'ro', isa => AbsPath, coerce => 1, ); ### usage in code Foo->new( filename => 'foo.txt' ); # coerced to Path::Tiny Foo->new( directory => '.' ); # coerced to path('.')->absolute DESCRIPTION This module provides Path::Tiny types for Moose, Moo, etc. It handles two important types of coercion: * coercing objects with overloaded stringification * coercing to absolute paths It also can check to ensure that files or directories exist. SUBTYPES This module uses Type::Tiny to define the following subtypes. Path "Path" ensures an attribute is a Path::Tiny object. Strings and objects with overloaded stringification may be coerced. AbsPath "AbsPath" is a subtype of "Path" (above), but coerces to an absolute path. File, AbsFile These are just like "Path" and "AbsPath", except they check "-f" to ensure the file actually exists on the filesystem. Dir, AbsDir These are just like "Path" and "AbsPath", except they check "-d" to ensure the directory actually exists on the filesystem. CAVEATS Path vs File vs Dir "Path" just ensures you have a Path::Tiny object. "File" and "Dir" check the filesystem. Don't use them unless that's really what you want. Usage with File::Temp Be careful if you pass in a File::Temp object. Because the argument is stringified during coercion into a Path::Tiny object, no reference to the original File::Temp argument is held. Be sure to hold an external reference to it to avoid immediate cleanup of the temporary file or directory at the end of the enclosing scope. A better approach is to use Path::Tiny's own "tempfile" or "tempdir" constructors, which hold the reference for you. Foo->new( filename => Path::Tiny->tempfile ); SEE ALSO * Path::Tiny * Moose::Manual::Types SUPPORT Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at . You will be notified automatically of any progress on your issue. Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. git clone git://github.com/dagolden/types-path-tiny.git AUTHOR David Golden CONTRIBUTOR Toby Inkster COPYRIGHT AND LICENSE This software is Copyright (c) 2013 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Types-Path-Tiny-0.005/t/000755 000765 000024 00000000000 12161130146 015125 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/tidyall.ini000644 000765 000024 00000000240 12161130146 017021 0ustar00davidstaff000000 000000 ; Install Code::TidyAll ; run "tidyall -a" to tidy all files ; run "tidyall -g" to tidy only files modified from git [PerlTidy] select = {lib,t}/**/*.{pl,pm,t} Types-Path-Tiny-0.005/xt/000755 000765 000024 00000000000 12161130146 015315 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/xt/author/000755 000765 000024 00000000000 12161130146 016617 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/xt/release/000755 000765 000024 00000000000 12161130146 016735 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/xt/release/distmeta.t000644 000765 000024 00000000217 12161130146 020734 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); Types-Path-Tiny-0.005/xt/release/minimum-version.t000644 000765 000024 00000000266 12161130146 022264 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_ok( qq{5.010} ); Types-Path-Tiny-0.005/xt/release/pod-coverage.t000644 000765 000024 00000000527 12161130146 021501 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Types-Path-Tiny-0.005/xt/release/pod-syntax.t000644 000765 000024 00000000212 12161130146 021223 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); Types-Path-Tiny-0.005/xt/release/portability.t000644 000765 000024 00000000332 12161130146 021462 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; options(test_one_dot => 0); run_tests(); Types-Path-Tiny-0.005/xt/release/test-version.t000644 000765 000024 00000000643 12161130146 021567 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } my @imports = ( 'version_all_ok' ); my $params = { is_strict => 0, has_version => 1, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Types-Path-Tiny-0.005/xt/author/critic.t000644 000765 000024 00000000435 12161130146 020263 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); Types-Path-Tiny-0.005/xt/author/pod-spell.t000644 000765 000024 00000000606 12161130146 020705 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006000 eval "use Test::Spelling 0.12; use Pod::Wordlist::hanekomu; 1" or die $@; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ AbsDir AbsFile AbsPath SUBTYPES coercions diretory subtype subtypes David Golden dagolden Toby Inkster tobyink lib Types Path Tiny Types-Path-Tiny-0.005/t/00-compile.t000644 000765 000024 00000003100 12161130146 017151 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More; use File::Find; use File::Temp qw{ tempdir }; my @modules; find( sub { return if $File::Find::name !~ /\.pm\z/; my $found = $File::Find::name; $found =~ s{^lib/}{}; $found =~ s{[/\\]}{::}g; $found =~ s/\.pm$//; # nothing to skip push @modules, $found; }, 'lib', ); sub _find_scripts { my $dir = shift @_; my @found_scripts = (); find( sub { return unless -f; my $found = $File::Find::name; # nothing to skip open my $FH, '<', $_ or do { note( "Unable to open $found in ( $! ), skipping" ); return; }; my $shebang = <$FH>; return unless $shebang =~ /^#!.*?\bperl\b\s*$/; push @found_scripts, $found; }, $dir, ); return @found_scripts; } my @scripts; do { push @scripts, _find_scripts($_) if -d $_ } for qw{ bin script scripts }; my $plan = scalar(@modules) + scalar(@scripts); $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run"); { # fake home for cpan-testers local $ENV{HOME} = tempdir( CLEANUP => 1 ); like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" ) for sort @modules; SKIP: { eval "use Test::Script 1.05; 1;"; skip "Test::Script needed to test script compilation", scalar(@scripts) if $@; foreach my $file ( @scripts ) { my $script = $file; $script =~ s!.*/!!; script_compiles( $file, "$script script compiles" ); } } } Types-Path-Tiny-0.005/t/00-report-prereqs.t000644 000765 000024 00000003154 12161130146 020524 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec::Functions; use List::Util qw/max/; my @modules = qw( ExtUtils::MakeMaker File::Find File::Spec::Functions File::Temp File::pushd List::Util Path::Tiny Test::More Type::Library Type::Utils Types::Standard Types::TypeTiny perl strict warnings ); # replace modules with dynamic results from MYMETA.json if we can # (hide CPAN::Meta from prereq scanner) my $cpan_meta = "CPAN::Meta"; if ( -f "MYMETA.json" && eval "require $cpan_meta" ) { ## no critic if ( my $meta = eval { CPAN::Meta->load_file("MYMETA.json") } ) { my $prereqs = $meta->prereqs; delete $prereqs->{develop}; my %uniq = map {$_ => 1} map { keys %$_ } map { values %$_ } values %$prereqs; $uniq{$_} = 1 for @modules; # don't lose any static ones @modules = sort keys %uniq; } } my @reports = [qw/Version Module/]; for my $mod ( @modules ) { next if $mod eq 'perl'; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e catfile($_, $file) } @INC; if ( $prefix ) { my $ver = MM->parse_version( catfile($prefix, $file) ); $ver = "undef" unless defined $ver; # Newer MM should do this anyway push @reports, [$ver, $mod]; } else { push @reports, ["missing", $mod]; } } if ( @reports ) { my $vl = max map { length $_->[0] } @reports; my $ml = max map { length $_->[1] } @reports; splice @reports, 1, 0, ["-" x $vl, "-" x $ml]; diag "Prerequisite Report:\n", map {sprintf(" %*s %*s\n",$vl,$_->[0],-$ml,$_->[1])} @reports; } pass; # vim: ts=2 sts=2 sw=2 et: Types-Path-Tiny-0.005/t/basic.t000644 000765 000024 00000006220 12161130146 016373 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More 0.96; use File::Temp 0.18; use File::pushd qw/tempd/; use Path::Tiny; use Types::Path::Tiny -types; my $tf = File::Temp->new; my $td = File::Temp->newdir; my @cases = ( # Path { label => "coerce string to Path", type => Path, input => "./foo", }, { label => "coerce object to Path", type => Path, input => $tf, }, { label => "coerce array ref to Path", type => Path, input => [qw/foo bar/], }, # AbsPath { label => "coerce string to AbsPath", type => AbsPath, input => "./foo", }, { label => "coerce Path to AbsPath", type => AbsPath, input => path($tf), }, { label => "coerce object to AbsPath", type => AbsPath, input => $tf, }, { label => "coerce array ref to AbsPath", type => AbsPath, input => [qw/foo bar/], }, # File { label => "coerce string to File", type => File, input => "$tf", }, { label => "coerce object to File", type => File, input => $tf, }, { label => "coerce array ref to File", type => File, input => [$tf], }, # Dir { label => "coerce string to Dir", type => Dir, input => "$td", }, { label => "coerce object to Dir", type => Dir, input => $td, }, { label => "coerce array ref to Dir", type => Dir, input => [$td], }, # AbsFile { label => "coerce string to AbsFile", type => AbsFile, input => "$tf", }, { label => "coerce object to AbsFile", type => AbsFile, input => $tf, }, { label => "coerce array ref to AbsFile", type => AbsFile, input => [$tf], }, # AbsDir { label => "coerce string to AbsDir", type => AbsDir, input => "$td", }, { label => "coerce object to AbsDir", type => AbsDir, input => $td, }, { label => "coerce array ref to AbsDir", type => AbsDir, input => [$td], }, ); for my $c (@cases) { subtest $c->{label} => sub { my $wd = tempd; my $type = $c->{type}; my $input = $c->{input}; my $expected = path( ref $input eq 'ARRAY' ? @$input : $input ); $expected = $expected->absolute if $type =~ /^Abs/; my $output = eval { $type->assert_coerce( $input ); }; is( $@, '', "object created without exception" ); isa_ok( $output, "Path::Tiny", '$output' ); is( $output, $expected, '$output is as expected' ); }; } done_testing; # # This file is part of Types-Path-Tiny # # This software is Copyright (c) 2013 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # Types-Path-Tiny-0.005/lib/Types/000755 000765 000024 00000000000 12161130146 016534 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/lib/Types/Path/000755 000765 000024 00000000000 12161130146 017430 5ustar00davidstaff000000 000000 Types-Path-Tiny-0.005/lib/Types/Path/Tiny.pm000644 000765 000024 00000012613 12161130146 020714 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Types::Path::Tiny; # ABSTRACT: Path::Tiny types and coercions for Moose and Moo our $VERSION = '0.005'; # VERSION use Path::Tiny qw(); use Type::Library 0.008 -base, -declare => qw( Path AbsPath File AbsFile Dir AbsDir ); use Type::Utils; use Types::Standard qw( Str ArrayRef ); use Types::TypeTiny 0.004 StringLike => { -as => "Stringable" }; #<<< class_type Path, { class => "Path::Tiny" }; declare AbsPath, as Path, where { $_->is_absolute }, inline_as { $_[0]->parent->inline_check($_) . "&& ${_}->is_absolute" }, message { is_Path($_) ? "Path '$_' is not absolute" : Path->get_message($_); }; declare File, as Path, where { $_->is_file }, inline_as { $_[0]->parent->inline_check($_) . "&& (-f $_)" }, message { is_Path($_) ? "File '$_' does not exist" : Path->get_message($_); }; declare Dir, as Path, where { $_->is_dir }, inline_as { $_[0]->parent->inline_check($_) . "&& (-d $_)" }, message { is_Path($_) ? "Directory '$_' does not exist" : Path->get_message($_); }; declare AbsFile, as intersection([AbsPath, File]), message { is_AbsPath($_) ? File->get_message($_) : AbsPath->get_message($_); }; declare AbsDir, as intersection([AbsPath, Dir]), message { is_AbsPath($_) ? Dir->get_message($_) : AbsPath->get_message($_); }; #>>> for my $type ( Path, File, Dir ) { coerce( $type, from Str() => q{ Path::Tiny::path($_) }, from Stringable() => q{ Path::Tiny::path($_) }, from ArrayRef() => q{ Path::Tiny::path(@$_) }, ); } for my $type ( AbsPath, AbsFile, AbsDir ) { coerce( $type, from Path => q{ $_->absolute }, from Str() => q{ Path::Tiny::path($_)->absolute }, from Stringable() => q{ Path::Tiny::path($_)->absolute }, from ArrayRef() => q{ Path::Tiny::path(@$_)->absolute }, ); } ### optionally add Getopt option type (adapted from MooseX::Types:Path::Class ##eval { require MooseX::Getopt; }; ##if ( !$@ ) { ## MooseX::Getopt::OptionTypeMap->add_option_type_to_map( $_, '=s', ) ## for ( 'Path::Tiny', Path ); ##} 1; # vim: ts=4 sts=4 sw=4 et: __END__ =pod =encoding utf-8 =head1 NAME Types::Path::Tiny - Path::Tiny types and coercions for Moose and Moo =head1 VERSION version 0.005 =head1 SYNOPSIS ### specification of type constraint with coercion package Foo; use Moose; use Types::Path::Tiny qw/Path AbsPath/; has filename => ( is => 'ro', isa => Path, coerce => 1, ); has directory => ( is => 'ro', isa => AbsPath, coerce => 1, ); ### usage in code Foo->new( filename => 'foo.txt' ); # coerced to Path::Tiny Foo->new( directory => '.' ); # coerced to path('.')->absolute =head1 DESCRIPTION This module provides L types for Moose, Moo, etc. It handles two important types of coercion: =over 4 =item * coercing objects with overloaded stringification =item * coercing to absolute paths =back It also can check to ensure that files or directories exist. =for Pod::Coverage method_names_here =head1 SUBTYPES This module uses L to define the following subtypes. =head2 Path C ensures an attribute is a L object. Strings and objects with overloaded stringification may be coerced. =head2 AbsPath C is a subtype of C (above), but coerces to an absolute path. =head2 File, AbsFile These are just like C and C, except they check C<-f> to ensure the file actually exists on the filesystem. =head2 Dir, AbsDir These are just like C and C, except they check C<-d> to ensure the directory actually exists on the filesystem. =head1 CAVEATS =head2 Path vs File vs Dir C just ensures you have a L object. C and C check the filesystem. Don't use them unless that's really what you want. =head2 Usage with File::Temp Be careful if you pass in a File::Temp object. Because the argument is stringified during coercion into a Path::Tiny object, no reference to the original File::Temp argument is held. Be sure to hold an external reference to it to avoid immediate cleanup of the temporary file or directory at the end of the enclosing scope. A better approach is to use Path::Tiny's own C or C constructors, which hold the reference for you. Foo->new( filename => Path::Tiny->tempfile ); =head1 SEE ALSO =over 4 =item * L =item * L =back =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at L. You will be notified automatically of any progress on your issue. =head2 Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. L git clone git://github.com/dagolden/types-path-tiny.git =head1 AUTHOR David Golden =head1 CONTRIBUTOR Toby Inkster =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2013 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut