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

? sunnavy sunnavy at bestpractical.com
Mon Nov 8 03:26:32 EST 2010


The branch, master has been updated
       via  df72602a5b61b5f5e251996315f573da7b35872d (commit)
       via  953337c5a93e5ce46ebee734c5e39adecb32b866 (commit)
      from  782936166373c84fe94c239052be4c0a6bd4f3e9 (commit)

Summary of changes:
 bin/plient-make-bundle |   11 ++++++-
 lib/Plient.pm          |   67 +++++++++++++++++++++++++++++++++++++++++++++++-
 lib/Plient/Test.pm     |    2 +-
 3 files changed, 76 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 953337c5a93e5ce46ebee734c5e39adecb32b866
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Nov 8 15:57:16 2010 +0800

    out to STDOUT if no file specified

diff --git a/bin/plient-make-bundle b/bin/plient-make-bundle
index ed726af..38964ac 100755
--- a/bin/plient-make-bundle
+++ b/bin/plient-make-bundle
@@ -16,12 +16,19 @@ EXAMPLES:
     plient-make-bundle /tmp/plient-bundle.pl
 EOF
 
-if ( $args{help} || !$ARGV[0] ) {
+if ( $args{help} ) {
     print $USAGE;
     exit;
 }
 
-open my $fh, '>', $ARGV[0] or die $!;
+my $fh;
+if ( $ARGV[0] ) {
+    open my $fh, '>', $ARGV[0] or die $!;
+}
+else {
+    $fh = *STDOUT;
+}
+
 print $fh '#! /usr/bin/env perl', "\n";
 print $fh '$ENV{PLIENT_BUNDLE_MODE} = 1;', "\n";
 

commit df72602a5b61b5f5e251996315f573da7b35872d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Nov 8 16:26:05 2010 +0800

    tweak the env names and doc them

diff --git a/lib/Plient.pm b/lib/Plient.pm
index 26a1f2e..9f311d3 100644
--- a/lib/Plient.pm
+++ b/lib/Plient.pm
@@ -195,7 +195,7 @@ sub handlers {
                   : delete $map{"Plient::Handler::$_"}
               } @$preference;
         }
-        push @handlers, keys %map unless $ENV{PLIENT_HANDLER_PREFERENCE_ONLY};
+        push @handlers, keys %map unless $ENV{PLIENT_HANDLER_PREFERENCE_STRICT};
         return @handlers;
     }
     else {
@@ -381,6 +381,71 @@ e.g. the following 2 ways of 'GET' http://cpan.org are equivalent:
 currently $args is not used, we may use it later, e.g. to test if support 
 Digest Authentication.
 
+=head1 ENV FOR USERS
+
+=over 4
+
+=item PLIENT_CURL
+
+curl's path, if not specified, use the one `which curl` returns
+
+=item PLIENT_CURL_CONFIG
+
+curl-config's path, if not specified, use the one `which curl-config`
+returns
+
+=item PLIENT_WGET
+
+wget's path, if not specified, use the one `which wget` returns
+
+=item PLIENT_HANDLER_PREFERENCE
+
+preference of handlers, format is:
+
+PROTOCOL1:HANDLER1,HANDLER2;PROTOCOL2:HANDLER3,...  
+
+e.g.
+    http:HTTPLite,curl,wget;https:curl,wget
+
+default is equal to(not set in this env actually):
+
+    http:curl,wget,HTTPLite,LWP;https:curl,wget,LWP
+
+
+C<Plient> will try the listed one by one to get the first competent one to
+handle the ongoing request.
+but if none was found, it will try the other handlers not listed.
+
+=back
+
+=head1 ENV FOR DEVELOPERS
+
+=over 4
+
+=item PLIENT_HANDLER_PREFERENCE_STRICT
+
+C<Plient> will try other handlers that are not listed in 
+C<PLIENT_HANDLER_PREFERENCE> if all the listed ones can't handle
+the ongoing request.
+
+if this is true, C<Plient> won't try in this situation, instead,
+it will die directly.
+
+used in C<Plient>'s tests.
+
+=item PLIENT_TEST_PLACKUP_WAIT
+
+seconds we wait after starting plackup in tests. by default it's 1 second.
+it can be decimal, e.g. 0.3
+
+this waiting time is to make sure plack is really started.
+
+=item PLIENT_BUNDLE_MODE
+
+used in plient-make-bundle only, end users shouldn't touch this.
+
+=back
+
 =head1 DEPENDENCIES
 
 None.
diff --git a/lib/Plient/Test.pm b/lib/Plient/Test.pm
index ecf2293..243f641 100644
--- a/lib/Plient/Test.pm
+++ b/lib/Plient/Test.pm
@@ -22,7 +22,7 @@ sub start_http_server {
     if ( defined $pid ) {
         if ($pid) {
             # have you ever been annoied that "sleep 1" is too much?
-            usleep 1_000_000 * ( $ENV{PLIENT_TEST_PLACKUP_TIME} || 1 );
+            usleep 1_000_000 * ( $ENV{PLIENT_TEST_PLACKUP_WAIT} || 1 );
             push @pids, $pid;
             return "http://localhost:$port";
         }

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



More information about the Bps-public-commit mailing list