App-URIUtils

 view release on metacpan or  search on metacpan

script/parse-url  view on Meta::CPAN

# and generated automatically using Perinci::CmdLine::Gen version 0.499

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-06-30'; # DATE
our $DIST = 'App-URIUtils'; # DIST
our $VERSION = '0.003'; # VERSION

use 5.010001;
use strict;
use warnings;
use Log::ger;

use Perinci::CmdLine::Any;

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/URIUtils/parse_url",
    program_name => "parse-url",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Parse URL string into a hash of information
# PODNAME: parse-url

__END__

=pod

=encoding UTF-8

=head1 NAME

parse-url - Parse URL string into a hash of information

=head1 VERSION

This document describes version 0.003 of parse-url (from Perl distribution App-URIUtils), released on 2021-06-30.

=head1 SYNOPSIS

Usage:

 % parse-url [--debug] [--format=name] [--json] [--log-level=level]
     [--(no)naked-res] [-p] [--page-result[=program]] [--parse-type=s]
     [--quiet] [-t=s] [--trace] [--verbose] [--view-result[=program]] --
     <url> [base]

Examples:

 % parse-url 'https://www.tokopedia.com/search?st=product&q=soundmagic%20e10'
 +-----------------------+----------------------------------------------------------------+
 | key                   | value                                                          |
 +-----------------------+----------------------------------------------------------------+
 | authority             | www.tokopedia.com                                              |
 | base                  |                                                                |
 | canonical             | https://www.tokopedia.com/search?st=product&q=soundmagic%20e10 |
 | default_port          | 443                                                            |
 | fragment              |                                                                |
 | full_path             | /search?st=product&q=soundmagic%20e10                          |
 | has_recognized_scheme | 1                                                              |
 | host                  | www.tokopedia.com                                              |
 | opaque                | //www.tokopedia.com/search?st=product&q=soundmagic%20e10       |
 | orig                  | https://www.tokopedia.com/search?st=product&q=soundmagic%20e10 |
 | path                  | /search                                                        |
 | port                  | 443                                                            |
 | query                 | st=product&q=soundmagic e10                                    |
 | scheme                | https                                                          |
 +-----------------------+----------------------------------------------------------------+

Just parse the query parameters into hash:

 % parse-url -p 'https://www.tokopedia.com/search?st=product&q=soundmagic%20e10'
 +-----+----------------+
 | key | value          |
 +-----+----------------+
 | q   | soundmagic e10 |
 | st  | product        |
 +-----+----------------+

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--base>=I<s>

Can also be specified as the 2nd command-line argument.

=item B<--parse-type>=I<s>, B<-t>

Default value:

 "url"

Valid values:

 ["url","query-params"]

=item B<--url>=I<s>*

Can also be specified as the 1st command-line argument.

=item B<-p>

Shortcut for --parse-type=query-params.

See C<--parse-type>.

=back

=head2 Logging options

=over

=item B<--debug>



( run in 0.867 second using v1.01-cache-2.11-cpan-b16cb0d3907 )