| 1 | package URI::Info::Plugin::SearchQuery::blibli; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use parent 'URI::Info::PluginBase'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||
| 9 | 1 | our $DATE = '2023-06-14'; # DATE | |||||||||
| 10 | 1 | our $DIST = 'URI-Info'; # DIST | |||||||||
| 11 | 1 | our $VERSION = '0.003'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | sub meta { | ||||||||||
| 14 | return { | ||||||||||
| 15 | 0 | ▶ | summary => 'Extract search query from blibli.com URL', | ||||||||
|
Subroutine
meta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | conf => { | ||||||||||
| 17 | }, | ||||||||||
| 18 | host => 'blibli.com', | ||||||||||
| 19 | }; | ||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | sub get_info { | ||||||||||
| 23 | 0 | ▶ | my ($self, $stash) = @_; | ||||||||
|
Subroutine
get_info: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 24 | 0 | my $url = $stash->{url}; | |||||||||
| 25 | 0 | my $res = $stash->{res}; | |||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | if ($url->full_path =~ m!\A/cari/!) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | $res->{is_search} = 1; | |||||||||
| 29 | 0 | $res->{search_type} = 'product'; | |||||||||
| 30 | 0 | ($res->{search_query} = $url->path) =~ s!\A/cari/!!; | |||||||||
| 31 | } | ||||||||||
| 32 | 0 | [200]; # 200=OK, 201=OK & skip the rest of the plugins, 500=error | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 1 | 1; | |||||||||
| 36 | # ABSTRACT: | ||||||||||
| 37 | |||||||||||
| 38 | __END__ | ||||||||||