Skip to content

Commit

Permalink
Item12864: don't use DEBUG to toggle local debug
Browse files Browse the repository at this point in the history
... as it conflicts with Assert.pm
  • Loading branch information
MichaelDaum committed Aug 28, 2014
1 parent 875e50f commit 49052af
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
*.gz
*.swp
pub/System/JsonRpcContrib/jquery.jsonrpc.js
pub/System/JsonRpcContrib/json2.js
JsonRpcContrib.md5
JsonRpcContrib.sha1
JsonRpcContrib.tgz
JsonRpcContrib.txt
JsonRpcContrib.zip
JsonRpcContrib_installer
JsonRpcContrib_installer.pl
4 changes: 2 additions & 2 deletions bin/jsonrpc
@@ -1,7 +1,7 @@
#!/usr/bin/perl -wT
#!/usr/bin/env perl
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
3 changes: 2 additions & 1 deletion data/System/JsonRpcContrib.txt
Expand Up @@ -219,11 +219,12 @@ If a namespace, method, or parameters are specified as part of a JSON-RPC reques
-->

| Author(s): | Michael Daum |
| Copyright: | © 2011-2013 Michael Daum http://michaeldaumconsulting.com |
| Copyright: | © 2011-2014 Michael Daum http://michaeldaumconsulting.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 28 Aug 2014: | don't use DEBUG constant to toggle local debug messages as it conflicts with Assert.pm |
| 11 Dec 2013: | removed dependency on JSON::XS |
| 30 May 2013: | added support for serialising objects, and rewrote some of the documentation (Foswiki:Main/CrawfordCurrie) |
| 20 Mar 2013: | added feature to define handlers in !LocalSite.cfg (Config.spec) so that pure contribs can implement backends now |
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Contrib/JsonRpcContrib.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# JsonRpcContrib is Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# JsonRpcContrib is Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -24,8 +24,8 @@ use warnings;
=cut

our $VERSION = '2.11';
our $RELEASE = '2.11';
our $VERSION = '2.12';
our $RELEASE = '2.12';
our $SHORTDESCRIPTION = 'JSON-RPC interface for Foswiki';
our $NO_PREFS_IN_TOPIC = 1;
our $SERVER;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Contrib/JsonRpcContrib/Error.pm
@@ -1,6 +1,6 @@
# JSON-RPC for Foswiki
#
# Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Contrib/JsonRpcContrib/JQueryPlugin.pm
Expand Up @@ -77,7 +77,7 @@ HERE
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2011-2012 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
8 changes: 5 additions & 3 deletions lib/Foswiki/Contrib/JsonRpcContrib/Request.pm
@@ -1,6 +1,6 @@
# JSON-RPC for Foswiki
#
# Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -25,7 +25,7 @@ use Foswiki::Contrib::JsonRpcContrib::Error ();
use Error qw( :try );
use Foswiki::Func ();
use Foswiki::Plugins ();
use constant DEBUG => 0; # toggle me
use constant TRACE => 0; # toggle me

###############################################################################
sub new {
Expand Down Expand Up @@ -149,6 +149,8 @@ sub id {
sub param {
my ( $this, $key, $value ) = @_;

return unless $key;

$this->{data}{params}{$key} = $value if defined $value;
return $this->{data}{params}{$key};
}
Expand Down Expand Up @@ -188,7 +190,7 @@ sub parser {
################################################################################
# static
sub writeDebug {
print STDERR '- JsonRpcContrib::Request - ' . $_[0] . "\n" if DEBUG;
print STDERR '- JsonRpcContrib::Request - ' . $_[0] . "\n" if TRACE;
}

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Contrib/JsonRpcContrib/Response.pm
@@ -1,6 +1,6 @@
# JSON-RPC for Foswiki
#
# Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -20,7 +20,7 @@ use strict;
use warnings;

use JSON ();
use constant DEBUG => 0; # toggle me
use constant TRACE => 0; # toggle me

################################################################################
sub new {
Expand Down
7 changes: 3 additions & 4 deletions lib/Foswiki/Contrib/JsonRpcContrib/Server.pm
@@ -1,6 +1,6 @@
# JSON-RPC for Foswiki
#
# Copyright (C) 2011-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2011-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -25,8 +25,7 @@ use Foswiki::Contrib::JsonRpcContrib::Error ();
use Foswiki::Contrib::JsonRpcContrib::Request ();
use Foswiki::Contrib::JsonRpcContrib::Response ();

# SMELL: constant DEBUG blocks use of ASSERT
use constant DEBUG => 0; # toggle me
use constant TRACE => 0; # toggle me

# Error codes for json-rpc response
# -32700: Parse error - Invalid JSON was received by the server.
Expand All @@ -43,7 +42,7 @@ use constant DEBUG => 0; # toggle me
################################################################################
# static
sub writeDebug {
print STDERR '- JsonRpcContrib::Server - ' . $_[0] . "\n" if DEBUG;
print STDERR '- JsonRpcContrib::Server - ' . $_[0] . "\n" if TRACE;
}

################################################################################
Expand Down

0 comments on commit 49052af

Please sign in to comment.