Group
Extension

Matches 5

Pepper ( E/EC/ECHERNOF/Pepper-1.5.tar.gz, ECHERNOF, 2021; MetaCPAN )
Pepper/lib/Pepper.pm ( view source; MetaCPAN )
oint_uri = ?
		}, [ $endpoint ] );
		
	# or maybe a JSON file
	} elsif ($self->{config}{url_mappings_file}) {
	
		my $url_mappings = $self->read_json_file( $self->{config}{url_mappings_file} );
		
		$
r = Pepper->new();

The $pepper object provides several conveniences for MySQL/MariaDB databases, JSON
parsing, Template Toolkit, file handling and logging.  In Web/Plack mode, 
$pepper will also incl
/127.0.0.1:5000 (or in your
browser, using your server's hostname:5000). You should receive basic JSON results. 
Modify PepperExample.pm to tweak those results and then restart the Plack service 
to t
Pepper ( E/EC/ECHERNOF/Pepper-1.5.tar.gz, ECHERNOF, 2021; MetaCPAN )
Pepper/lib/Pepper/PlackHandler.pm ( view source; MetaCPAN )
!$self->{response};

	my (@vars, $value, @values, $v, $request_body_type, $request_body_content, $json_params, $plack_headers, @plack_uploads, $plack_upload, $uploaded_filename);

	# stash the hostnam
t JSON data structures
	$request_body_type = $self->{request}->content_type;
	$request_body_content = $self->{request}->content;
	if ($request_body_content && $request_body_type eq 'application/json')
 {
		$json_params = $self->{utils}->json_to_perl($request_body_content);
		if (ref($json_params) eq 'HASH') {
			$self->{params} = $json_params;
		}
	}

	# the rest of this is to accept any POST / GET
Pepper ( E/EC/ECHERNOF/Pepper-1.5.tar.gz, ECHERNOF, 2021; MetaCPAN )
Pepper/lib/Pepper/Commander.pm ( view source; MetaCPAN )
pepper set-endpoint'. 
This is a faster option for handling requests, but you may leave blank for JSON config file.}],
		['default_endpoint_module', 
			qq{
Default endpoint-handler Perl module.
This 
s';
	} else {
		$$config{url_mappings_file} = $self->{pepper_directory}.'/config/pepper_endpoints.json';
	}

	# default endpoint handler
	$$config{default_endpoint_module} ||= 'PepperApps::PepperExamp
mappings{$$map[0]} = $$map[1];
		}
		
	# or maybe a JSON file
	} elsif ($utils->{config}{url_mappings_file}) {
	
		$url_mappings = $utils->read_json_file( $utils->{config}{url_mappings_file} );
		
	}	
Pepper ( E/EC/ECHERNOF/Pepper-1.5.tar.gz, ECHERNOF, 2021; MetaCPAN )
Pepper/lib/Pepper/Utilities.pm ( view source; MetaCPAN )
Utilities::VERSION = '1.5';

# for utf8 support with JSON
use utf8;
use Encode qw( encode_utf8 );

# for encoding and decoding JSON
use Cpanel::JSON::XS;

# for logging via logger()
use Path::Tiny;
us
y $self = bless {
		'request' => $$args{request},
		'response' => $$args{response},
		'json_coder' => Cpanel::JSON::XS->new->utf8->allow_nonref->allow_blessed,
		'config_file' => $ENV{HOME}.'/pepper/c
return $self;	
}

### START METHODS FOR GENERATING RESPONSES AND LOGS

# method to deliver html & json out to the client;
# this must be in here to be available even if not in plack mode
sub send_resp
Pepper ( E/EC/ECHERNOF/Pepper-1.5.tar.gz, ECHERNOF, 2021; MetaCPAN )
Pepper/lib/Pepper/Templates.pm ( view source; MetaCPAN )
rs sent via GET/POST or JSON body are available 
	# within $pepper->{params}
	#
	# Simply return your prepared content and Pepper will deliver
	# it to the client.  To send JSON, return a reference to
epper will send it out to the client
	# sending a data structure back will send that structure in JSON to the client
	# you can alse return HTML or any text 
	
	return $starter_content;

}

1;
];
}

#
evious cookie.
<br/><br/>


<strong>Return JSON:</strong>
<br/><input type="checkbox" name="return_json" value="yes"/>&nbsp;Click to have the response be JSON instead of HTML.
<br/>Leave un-checked to

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.