Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding new Moose type for preexisting directories

  • Loading branch information...
commit 173ac4541c03ff8545b35737eb571f4b8881ac69 1 parent 9eb40ca
Sanko Robinson authored September 15, 2010

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  lib/Net/BitTorrent/Types.pm
7  lib/Net/BitTorrent/Types.pm
@@ -19,6 +19,7 @@ package Net::BitTorrent::Types;
19 19
                 NBTypes::File::Path
20 20
                 NBTypes::File::Path::Absolute
21 21
                 NBTypes::File::Path::PreExisting
  22
+                NBTypes::File::Directory::PreExisting
22 23
                 ]
23 24
         ],
24 25
         client  => [qw[NBTypes::Client::PeerID]],
@@ -107,8 +108,14 @@ package Net::BitTorrent::Types;
107 108
         where { require File::Spec; File::Spec->file_name_is_absolute($_) } =>
108 109
         message {'Filename must be absolute.'} => where { -f $_ } =>
109 110
         message {'File must be preexisting'};
  111
+    subtype 'NBTypes::File::Directory::PreExisting' => as 'Str' =>
  112
+        where { require File::Spec; File::Spec->file_name_is_absolute($_) } =>
  113
+        message {'Directory must be absolute.'} => where { -d $_ } =>
  114
+        message {'Directory must be preexisting'};
110 115
     coerce 'NBTypes::File::Path::PreExisting' => from 'Str' =>
111 116
         via { require File::Spec; File::Spec->rel2abs($_); };
  117
+    coerce 'NBTypes::File::Directory::PreExisting' => from 'Str' =>
  118
+        via { require File::Spec; File::Spec->rel2abs($_); };
112 119
 
113 120
     #
114 121
     subtype 'NBTypes::Client::PeerID' => as 'Str' =>

0 notes on commit 173ac45

Please sign in to comment.
Something went wrong with that request. Please try again.