pgFormatter::CGI(3pm) | User Contributed Perl Documentation | pgFormatter::CGI(3pm) |
NAME¶
pgFormatter::CGI - Implementation of CGI-BIN script to format SQL queries.
VERSION¶
Version 5.6
SYNOPSIS¶
This module is called by pg_format program, when it detects it is run in CGI environment. In such case all control over flow is passed to this module by calling:
my $program = pgFormatter::CGI->new(); $program->run()
FUNCTIONS¶
new¶
Object constructor, calls set_config method to set default values for various parameters.
run¶
Route to the right handler based on what sort of data we receive
run_webpage¶
Wraps all work related to generating html page.
It calls set of functions to get CGI object, receive parameters from request, sanitize them, beautify query (if provided) and print ghtml.
run_api¶
Wraps all work related to generating JSON response when used as API.
get_cgi¶
Creates CGI object, and sets POST size limit
¶
Sets config for the page and beautifier. URLs, names of auxiliary files, configuration for pgFormatter::Beautify module.
¶
Loads, and returns, default CSS from __DATA__.
¶
Gets values of parameters, and possibly uploaded file from CGI object to structures in $self.
¶
Get params for the API version of this service
sanitize_params¶
Overrides parameter values if given values were not within acceptable ranges.
beautify_query¶
Runs beautification on provided query, and stores new version in $self->{'content'}
print_json¶
Outputs beautified SQL as JSON
¶
Outputs body of the page.
print_footer¶
Outputs footer of the page
_load_optional_file¶
Helper function to try to load file. If it succeeds, it returns file content, it not, it returns empty string (instead of dying).
print_error¶
Outputs an error message when no acceptable response is found.
print_headers¶
Outputs page headers - both HTTP level headers, and HTML.
DATA¶
__DATA__ section (at the end of this file) is used to store default CSS Style, so that it will not "pollute" Perl code, and will not need to be indented.
AUTHOR¶
pgFormatter is an original work from Gilles Darold
BUGS¶
Please report any bugs or feature requests to: https://github.com/darold/pgFormatter/issues
COPYRIGHT¶
Copyright 2012-2025 Gilles Darold. All rights reserved.
LICENSE¶
pgFormatter is free software distributed under the PostgreSQL Licence.
A modified version of the SQL::Beautify Perl Module is embedded in pgFormatter with copyright (C) 2009 by Jonas Kramer and is published under the terms of the Artistic License 2.0.
2025-03-18 | perl v5.40.1 |