{"id":32211603,"url":"https://github.com/rlauer6/query-param","last_synced_at":"2026-02-21T00:02:44.881Z","repository":{"id":297456561,"uuid":"996832340","full_name":"rlauer6/Query-Param","owner":"rlauer6","description":"Lightweight object interface for parsing and creating query strings ","archived":false,"fork":false,"pushed_at":"2025-10-29T23:02:52.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-06T22:21:41.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rlauer6.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-05T14:27:45.000Z","updated_at":"2025-10-29T23:02:35.000Z","dependencies_parsed_at":"2025-06-10T10:16:37.372Z","dependency_job_id":null,"html_url":"https://github.com/rlauer6/Query-Param","commit_stats":null,"previous_names":["rlauer6/query-param"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rlauer6/Query-Param","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlauer6%2FQuery-Param","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlauer6%2FQuery-Param/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlauer6%2FQuery-Param/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlauer6%2FQuery-Param/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rlauer6","download_url":"https://codeload.github.com/rlauer6/Query-Param/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlauer6%2FQuery-Param/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29668639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T23:24:07.480Z","status":"ssl_error","status_checked_at":"2026-02-20T23:24:06.202Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-22T06:52:45.986Z","updated_at":"2026-02-21T00:02:44.874Z","avatar_url":"https://github.com/rlauer6.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nQuery::Param - Lightweight object interface for parsing and creating\nquery strings and form parameters\n\n# SYNOPSIS\n\n    use Query::Param;\n\n    my $args = Query::Param-\u003enew(\"foo=1\u0026bar=2\u0026bar=3\u0026empty=\u0026encoded=%25+%2B\");\n\n    # Object-style access\n    my $foo     = $args-\u003eget(\"foo\");         # scalar: \"1\"\n    my $bar     = $args-\u003eget(\"bar\");         # arrayref: [\"2\", \"3\"]\n    my $encoded = $args-\u003eget(\"encoded\");     # scalar: \"% +\"\n\n    # CGI-style access\n    my $foo_again = $args-\u003eparam(\"foo\");     # same as get(\"foo\")\n    my @keys      = $args-\u003eparam;            # all parameter names\n\n    # Get all decoded parameters\n    my $all = $args-\u003eparams;                 # { foo =\u003e \"1\", bar =\u003e [\"2\", \"3\"], ... }\n\n    # Legacy-compatible flat hash\n    my $vars = $args-\u003eVars;                  # { foo =\u003e \"1\", bar =\u003e \"3\", ... }\n\n    # Check for presence\n    if ( $args-\u003ehas(\"bar\") ) { ... }\n\n    # Update or add parameters\n    $args-\u003eset(\"foo\", \"updated\");\n    $args-\u003eset(\"new\", \"value\");\n\n    # Get query string back\n    my $str = $args-\u003eto_string;              # bar=2\u0026bar=3\u0026empty=\u0026encoded=%25%20%2B\u0026foo=updated\u0026new=value\n\n# DESCRIPTION\n\nThis module parses an application/x-www-form-urlencoded encode query\nstring and provides an object-oriented interface for accessing the\nquery parameters.\n\nMultiple values for a parameter are stored as an array\ninternally. When accessed via `get`, a scalar is returned for single\nvalues, and an array reference for multiple values.\n\nThere are many modules that parse query strings, so why re-invent this\nwheel?\n\n- Simplicity\n    - Provides exactly what's needed to parse, access, mutate, and\n    emit query strings - nothing more.\n    - Easy to learn: get, set, has, keys, to\\_string, pairs.\n    - No dependency on object systems, Moo, Moose, or Catalyst internals.\n- Lazy Decoding and Isomorphic Round-Tripping\n    - Only decodes values on demand, saving effort when you only need a subset.\n    - Preserves semantics on `to_string()` - values go in and come\n    back out encoded correctly, even if original encoding format differed\n    (+ vs %20).\n    - Isomorphic: `to_string()` and `new()` are inverse operations, as\n    long as values are treated semantically.\n- No Magic or Global Side Effects\n    - Doesn't touch global vars (%ENV, @ARGV, etc.).\n    - Doesn't guess whether it's parsing a GET or POST - you pass it\n    a string explicitly.\n    - Can be used safely inside other frameworks or handlers without\n    surprises.\n- Consistent, Predictable Behavior\n    - Every key always returns a single value or an arrayref -\n    consistent rules.\n    - `set()` replaces; multiple values only come from the original\n    string or if assigned intentionally.\n- Tiny Footprint\n    - Just `URI::Escape`, no other non-core deps.\n    - Lightweight enough for CLI tools, embedded apps, or mod\\_perl\n    handlers.\n- CPAN Alternatives Can Be Overkill\n    - CGI is bloated, global, and tied to the web environment.\n    - `CGI::Tiny` is good, but intentionally avoids mutation - no\n    `set()`.\n    - `Plack::Request` and `HTTP::Request::Params` require full request\n    objects and more dependencies.\n    - Hash::MultiValue works but lacks parsing logic - and doesn't\n    round-trip.\n\n# CGI COMPATIBILITY\n\nThis module supports key methods from [CGI](https://metacpan.org/pod/CGI) for interoperability:\n\n- `param()` - scalar or arrayref return, regardless of context\n- `Vars()` - returns a hashref of flattened scalar values (last-value wins)\n- `get()` - equivalent to `param($key)`\n- `params()` - returns a hashref retaining all values (including\narrayrefs)\n- `to_string()` - round-trips encoded input with full fidelity\n\n**Note**: Unlike CGI.pm, `param()` and `get()` do not change behavior\ndepending on context. They always return a scalar (if one value) or an\narrayref (if multiple values). This avoids subtle bugs and improves\npredictability.\n\n# THREAD SAFETY\n\nThis module does not use any global state. It is safe to use in\nthreaded, embedded, and reentrant environments such as mod\\_perl,\nPlack, or inside event loops.\n\n# CONSTRUCTOR\n\n## new\n\n    my $args = Query::Param-\u003enew($query_string);\n\nParses the provided query string and returns a new\n`Query::Param` object.\n\n## new\\_from\\_request\n\n    my $args = Query::Param-\u003enew_from_request;\n\nParses query strings, application/x-www-form-urlencoded, or\nmultipart/form-data from HTTP requests.  Assumes environment variables\nCONTENT\\_TYPE, CONTENT\\_LENGTH, REQUEST\\_METHOD have been set.\n\n_NOTE: Reminder - this is a lightweight parser! It does not support\nfile downloads when data is passed as multipart/form-data._\n\nIf the content type is application/json the parser will decode the\npayload. You can retrieve the raw payload using the `to_string`\nmethod or individual keys of the payload using `get()`.\n\n# METHODS AND SUBROUTINES\n\n## get\n\n    $value = $args-\u003eget($key);\n\nReturns the value associated with `$key`. If there are multiple\nvalues, an array reference is returned. If only one value exists, the\nscalar is returned.  Returns undef if the key does not exist.\n\n## has\n\n    if ($args-\u003ehas(\"foo\")) { ... }\n\nReturns true if the key exists in the query string. This method\naccesses the tied hash internally.\n\n## keys\n\nReturns the keys or names of the query string parameters.\n\n## pairs\n\nReturns a list of array references that contain key/value pairs in the\nsame vein as `List::Util::pairs`.\n\n## param\n\n    my @names = $q-\u003eparam;\n    my $value = $q-\u003eparam('key');\n\nReturns the list of all parameter names when called with no arguments.\n\nWhen called with a key, returns the value for that parameter. If the\nparameter occurred multiple times in the original query string,\nreturns an array reference of values. Otherwise, returns a scalar\nvalue.\n\nThis method is provided for compatibility with `CGI-`param\u003e, but\nunlike CGI.pm, it always returns a scalar or array reference\nregardless of context. Internally, it delegates to `get()`.\n\n## params\n\n    my $hashref = $q-\u003eparams;\n\nReturns a hash reference containing all decoded parameters.\n\nEach key corresponds to a parameter name. The value is either a scalar\n(if the parameter had a single value) or an array reference (if the\nparameter occurred multiple times).\n\nThis method is intended as a replacement for `CGI-`Vars\u003e and provides\na consistent view of all parameters for inspection, testing, or\nexport.\n\n## set\n\nSets a query string parameter.\n\n## to\\_string\n\nCreates an query string from the parsed or set parameters.\n\n## Vars\n\n    my $vars = $q-\u003eVars;\n\nReturns a hash reference where each key maps to a scalar value.\n\nIf a parameter occurred multiple times in the query string, only the\nlast value is preserved - consistent with `CGI-`Vars\u003e, but\npotentially lossy.\n\nThis method is provided for compatibility with legacy code that\nexpects flattened query strings. Use `params()` instead to retain\nfull value lists and avoid silent data loss.\n\n# DEPENDENCIES\n\n- [URI::Escape](https://metacpan.org/pod/URI%3A%3AEscape)\n\n# AUTHOR\n\nRob Lauer - \u003crlauer6@comcast.net\u003e\n\n# LICENSE\n\nThis module is released under the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlauer6%2Fquery-param","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frlauer6%2Fquery-param","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlauer6%2Fquery-param/lists"}