[Bps-public-commit] plient branch, master, updated. 168c8d06158ae344af43ada16d6f9aafc54b36f0

? sunnavy sunnavy at bestpractical.com
Thu Apr 15 12:30:38 EDT 2010


The branch, master has been updated
       via  168c8d06158ae344af43ada16d6f9aafc54b36f0 (commit)
      from  667d0ba9f6884bd13ee6d58b0126a4ad8ef3628b (commit)

Summary of changes:
 lib/Plient.pm               |    2 +-
 lib/Plient/Protocol/File.pm |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 168c8d06158ae344af43ada16d6f9aafc54b36f0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Apr 16 00:30:21 2010 +0800

    support file:foo/bar too

diff --git a/lib/Plient.pm b/lib/Plient.pm
index 149760c..e4168c1 100644
--- a/lib/Plient.pm
+++ b/lib/Plient.pm
@@ -33,7 +33,7 @@ sub plient {
 }
 
 my %dispatch_map = (
-    'file://'  => 'Plient::Protocol::File',
+    'file:'    => 'Plient::Protocol::File',
     'http://'  => 'Plient::Protocol::HTTP',
     'https://' => 'Plient::Protocol::HTTPS',
 );
diff --git a/lib/Plient/Protocol/File.pm b/lib/Plient/Protocol/File.pm
index 3b813b7..67ffb9f 100644
--- a/lib/Plient/Protocol/File.pm
+++ b/lib/Plient/Protocol/File.pm
@@ -10,7 +10,7 @@ sub methods { qw/get/ }
 
 sub get {
     my ( $file, $args ) = @_;
-    $file =~ s!file://!!;
+    $file =~ s!file:(?://)?!!; # file:foo/bar is valid too
     open my $fh, '<', $file or warn "failed to open $file: $!" && return;
     local $/;
     <$fh>;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list