Scroll to navigation

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.5

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

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.

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.

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'}

Outputs body of the page.

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).

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-2023 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.

2023-02-05 perl v5.36.0