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

? sunnavy sunnavy at bestpractical.com
Mon May 3 03:07:20 EDT 2010


The branch, master has been updated
       via  a0040f2c11f6fa549756641b8efec40130bfffa3 (commit)
       via  f594f46d023ec535534243597d82a72813c48802 (commit)
      from  832ef3828704bde31c6bc8ad0e94db55f823c1cf (commit)

Summary of changes:
 bin/plient |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit f594f46d023ec535534243597d82a72813c48802
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon May 3 14:35:51 2010 +0800

    make method as an option

diff --git a/bin/plient b/bin/plient
index 4782448..5a86e58 100755
--- a/bin/plient
+++ b/bin/plient
@@ -7,15 +7,15 @@ Plient->import( 'plient', 'plient_support' );
 
 my %args;
 
-GetOptions( \%args, 'help|h', 'support|s=s' ) or die 'unknown option';
+GetOptions( \%args, 'help|h', 'support|s=s', 'request|X=s', )
+  or die 'unknown option';
 
 my $USAGE =<<EOF;
-USAGE: plient [METHOD] URL [ ... ]
+USAGE: plient URL [ ... ]
 EXAMPLES:
-    plient http://cpan.org/                         # fetch http://cpan.org
-    plient get http://cpan.org/                     # ditto
     plient --support http_get                       # check is support HTTP GET
     plient -s http_get                              # ditto
+    plient http://cpan.org/                         # fetch http://cpan.org
 EOF
 
 if ( $args{help} ) {
@@ -35,11 +35,8 @@ if ( !$ARGV[0] ) {
     exit;
 }
 
-my ( $method, @uri ) = @ARGV;
-if ( $method && $method =~ m{://} ) {
-    push @uri, $method;
-    $method = 'get';
-}
+my ( @uri ) = @ARGV;
+my $method = $args{'request'} || 'get';
 
 for my $uri ( @uri ) {
     print plient( $method, $uri );

commit a0040f2c11f6fa549756641b8efec40130bfffa3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon May 3 14:38:57 2010 +0800

    defaults to http if no scheme is specified

diff --git a/bin/plient b/bin/plient
index 5a86e58..617168f 100755
--- a/bin/plient
+++ b/bin/plient
@@ -38,7 +38,8 @@ if ( !$ARGV[0] ) {
 my ( @uri ) = @ARGV;
 my $method = $args{'request'} || 'get';
 
-for my $uri ( @uri ) {
+for my $uri (@uri) {
+    $uri = 'http://' . $uri unless $uri =~ /^\w+:/;
     print plient( $method, $uri );
 }
 

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



More information about the Bps-public-commit mailing list