Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add localizer; use JSON::MaybeXS; avoid EOL-check for tests #23

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

basiliscos
Copy link
Contributor

No description provided.

@basiliscos
Copy link
Contributor Author

Test pass on qa

0 [13:00] nobody@qa11 ~/perl-Mojo-WebSocketProxy (ivan/localize-errors %=)$ dzil test && dzil xt
[DZ] building distribution under .build/cR8RlsXjBJ for installation
[DZ] beginning to build Mojo-WebSocketProxy
[DZ] guessing dist's main_module is lib/Mojo/WebSocketProxy.pm
[VersionFromModule] dist version 0.06 (from lib/Mojo/WebSocketProxy.pm)
[OurPkgVersion] Skipping: "lib/Mojo/WebSocketProxy.pm" has no "# VERSION" comment
Wide character in print at /usr/lib/perl/5.14/IO/Handle.pm line 159.
Wide character in print at /usr/lib/perl/5.14/IO/Handle.pm line 159.
[Prereqs::FromCPANfile] Parsing 'cpanfile' to extract prereqs
Subroutine JSON::PP::Boolean::(-- redefined at /usr/share/perl/5.14/overload.pm line 24.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/share/perl/5.14/overload.pm line 24.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/share/perl/5.14/overload.pm line 24.
[GitHub::Meta] Getting GitHub repository info
[DZ] writing Mojo-WebSocketProxy in .build/cR8RlsXjBJ
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Mojo::WebSocketProxy
Writing MYMETA.yml and MYMETA.json
cp lib/Mojo/WebSocketProxy/CallingEngine.pm blib/lib/Mojo/WebSocketProxy/CallingEngine.pm
cp lib/Mojo/WebSocketProxy/Dispatcher.pm blib/lib/Mojo/WebSocketProxy/Dispatcher.pm
cp lib/Mojolicious/Plugin/WebSocketProxy.pm blib/lib/Mojolicious/Plugin/WebSocketProxy.pm
cp lib/Mojo/WebSocketProxy/Parser.pm blib/lib/Mojo/WebSocketProxy/Parser.pm
cp lib/Mojo/WebSocketProxy/Config.pm blib/lib/Mojo/WebSocketProxy/Config.pm
cp lib/Mojo/WebSocketProxy.pm blib/lib/Mojo/WebSocketProxy.pm
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-check-deps.t ................. ok    
t/00-compile.t .................... ok   
t/00-report-prereqs.t ............. # 
# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker 6.64 7.02
# 
# === Build Requires ===
# 
#     Module           Want       Have
#     ---------------- ---- ----------
#     Test::MockModule  any       0.05
#     Test::MockObject  any 1.20140408
#     Test::Mojo        any      undef
#     Test::More       0.94   1.302062
#     Test::Simple     0.44   1.302062
#     Test::TCP         any       2.06
# 
# === Test Requires ===
# 
#     Module               Want     Have
#     ------------------- ----- --------
#     ExtUtils::MakeMaker   any     7.02
#     File::Spec            any     3.47
#     IO::Handle            any     1.31
#     IPC::Open3            any     1.09
#     Test::CheckDeps     0.010    0.010
#     Test::More           0.94 1.302062
# 
# === Test Recommends ===
# 
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.143240
# 
# === Runtime Requires ===
# 
#     Module                   Want  Have
#     ------------------------ ---- -----
#     Class::Method::Modifiers  any  2.12
#     Data::UUID                any 1.219
#     Future                    any  0.35
#     Guard                     any 1.023
#     JSON                      any  2.90
#     JSON::XS                  any  3.01
#     MojoX::JSON::RPC          any  0.10
#     Mojolicious               any  7.29
#     Scalar::Util              any  1.48
#     Variable::Disposition     any 0.004
# 
# === Develop Requires ===
# 
#     Module                  Want     Have
#     ----------------------- ---- --------
#     Pod::Coverage::TrustPod  any 0.100003
#     Test::EOL                any      1.6
#     Test::Mojibake           any      1.1
#     Test::More              0.88 1.302062
#     Test::Pod               1.41     1.48
#     Test::Pod::Coverage     1.08     1.10
#     Test::Pod::LinkCheck     any    0.008
#     Test::Synopsis           any     0.15
#     Test::Version              1     2.05
# 
t/00-report-prereqs.t ............. ok   
t/05_basic.t ...................... ok    
t/10-before_forward.t ............. ok   
t/11-timeout.t .................... ok   
t/12-before_send_api_response.t ... ok   
t/13-action-not-found.t ........... ok   
t/14-bad-request.t ................ ok   
t/15-simple-success.t ............. ok   
t/16-auth-error-sample.t .......... ok   
t/17-instead_of_forward.t ......... ok   
t/18-per-action_before-forward.t .. ok   
t/19-rpc_response_cb.t ............ ok   
t/20-after_got_rpc_response.t ..... ok   
t/21-mojo-stash.t ................. ok   
t/22-override-response.t .......... ok   
t/23-binary-frame.t ............... ok   
All tests successful.
Files=18, Tests=147,  6 wallclock secs ( 0.07 usr  0.02 sys +  3.96 cusr  0.39 csys =  4.44 CPU)
Result: PASS
[DZ] all's well; removing .build/cR8RlsXjBJ
[DZ] building distribution under .build/T3Y0nJvGvy for installation
[DZ] beginning to build Mojo-WebSocketProxy
[DZ] guessing dist's main_module is lib/Mojo/WebSocketProxy.pm
[VersionFromModule] dist version 0.06 (from lib/Mojo/WebSocketProxy.pm)
[OurPkgVersion] Skipping: "lib/Mojo/WebSocketProxy.pm" has no "# VERSION" comment
Wide character in print at /usr/lib/perl/5.14/IO/Handle.pm line 159.
Wide character in print at /usr/lib/perl/5.14/IO/Handle.pm line 159.
[Prereqs::FromCPANfile] Parsing 'cpanfile' to extract prereqs
Subroutine JSON::PP::Boolean::(-- redefined at /usr/share/perl/5.14/overload.pm line 24.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/share/perl/5.14/overload.pm line 24.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/share/perl/5.14/overload.pm line 24.
[GitHub::Meta] Getting GitHub repository info
[DZ] writing Mojo-WebSocketProxy in .build/T3Y0nJvGvy
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Mojo::WebSocketProxy
Writing MYMETA.yml and MYMETA.json
cp lib/Mojo/WebSocketProxy/CallingEngine.pm blib/lib/Mojo/WebSocketProxy/CallingEngine.pm
cp lib/Mojo/WebSocketProxy/Dispatcher.pm blib/lib/Mojo/WebSocketProxy/Dispatcher.pm
cp lib/Mojolicious/Plugin/WebSocketProxy.pm blib/lib/Mojolicious/Plugin/WebSocketProxy.pm
cp lib/Mojo/WebSocketProxy/Parser.pm blib/lib/Mojo/WebSocketProxy/Parser.pm
cp lib/Mojo/WebSocketProxy/Config.pm blib/lib/Mojo/WebSocketProxy/Config.pm
cp lib/Mojo/WebSocketProxy.pm blib/lib/Mojo/WebSocketProxy.pm
xt/author/critic.t ............ ok   
xt/author/eol.t ............... ok   
xt/author/mojibake.t .......... ok   
xt/author/pod-coverage.t ...... ok   
xt/author/pod-syntax.t ........ ok   
xt/author/synopsis.t .......... ok   
xt/author/test-version.t ...... ok   
xt/release/common_spelling.t .. ok   
xt/release/pod-linkcheck.t .... ok   
All tests successful.
Files=9, Tests=55,  5 wallclock secs ( 0.03 usr  0.03 sys +  4.71 cusr  0.24 csys =  5.01 CPU)
Result: PASS
all's well; removing .build/T3Y0nJvGvy

Copy link
Contributor

@tom-binary tom-binary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor points but the concept looks fine, thanks.

Don't forget to update the documentation for the new config parameter!

@@ -5,7 +5,7 @@ use warnings;

use MojoX::JSON::RPC::Client;
use Guard;
use JSON;
use JSON::MaybeXS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpanfile needs updating? Although I'd suggest better to use Mojo::JSON, that way 3rd-party users get consistent handling across Mojolicious code.

@@ -14,6 +14,10 @@ sub register {

die 'No base path found!' unless $config->{base_path};

my $localizer = (ref($config->{localizer}) // '?') eq 'CODE'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for the // fallback here, ref returns an empty string for non-refs/undef. However, I'd suggest better to make it $config->{localizer} || sub { $_[1] } otherwise it's silently ignoring invalid parameters such as localizer => "some_helper_name".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants