pgFormatter::CGI(3)
π NAME π
okay bestie, welcome to pgFormatter::CGI β the pgFormatter::CGI(3) page, filed under User Contributed Perl Documentation. It is literally the Implementation of CGI-BIN script to format SQL queries. No cap, that's the whole name situation. β¨
π VERSION π
Version 5.11 β iconic, current, slay. π
π¦ SYNOPSIS π¦
okay so this module gets called by the pg_format program when it detects it is run in a CGI environment. In such case all control over flow is passed to this module by calling:
my $program = pgFormatter::CGI->new();
$program->run()
No extra semicolon on that last line, bestie β copy it exactly. π«Ά
πΈ FUNCTIONS πΈ
π new π
Object constructor, and it calls the set_config method to set default values for various parameters. Constructor behavior: highkey foundational. β¨
β run β
Route to the right handler based on what sort of data we receive. It's giving traffic director energy, fr fr. π¦
π run_webpage π
Wraps all work related to generating html page.
It calls a set of functions to get CGI object, receive parameters from request, sanitize them, beautify query (if provided) and print ghtml. Yes, ghtml β that's what the page says, bestie, don't come for me. π
π run_api π
Wraps all work related to generating JSON response when used as API. API mode: served. π
π¦ get_cgi π¦
Creates CGI object, and sets POST size limit. Also does a whole lil' bundle of things:
- Sets config for the page and beautifier. URLs, names of auxiliary files, configuration for
pgFormatter::Beautifymodule. - 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. It's the vibe check for your params. π
π§ beautify_query π§
Runs beautification on provided query, and stores new version in $self->{'content'}. Glow-up complete. β¨
π print_json π
Outputs beautified SQL as JSON.
Outputs body of the page. Both of those lines are in this section, bestie β keepin' it exactly as the page says. π«Ά
π print_footer π
Outputs footer of the page. Yes, the little bottom bit. Cute. π
π _load_optional_file π
Helper function to try to load file. If it succeeds, it returns file content; if it doesn't, it returns empty string (instead of dying). Lowkey graceful. π
πΈ print_error πΈ
Outputs an error message when no acceptable response is found. Error handling but make it readable. π¨
β print_headers β
Outputs page headers β both HTTP level headers, and HTML. Header moment. π
π DATA π
The __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. Highkey smart, lowkey tidy. π§Ό
π AUTHOR π
pgFormatter is an original work from Gilles Darold. Iconic authorship, periodt. π
π BUGS π
Please report any bugs or feature requests to:
https://github.com/darold/pgFormatter/issues
Don't be shy, bestie β that's literally the place. π«Ά
π COPYRIGHT π
Copyright 2012-2026 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.
okay that's the whole manual page, bestie β brought to you by perl v5.42.3, dated 1980-01-01, and filed as pgFormatter::CGI(3). Mwah! ππ
β¨
π¦ where this page comes from
- nixpkgs unstable: perl5.42.3-pgformatter 5.11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms