« blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Later.pm
↑ Summary
blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Prefork.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::Parser::MojoBase; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Perl::PrereqScanner::NotQuiteLite::Util; | ||
| 6 | |||
| 7 | my @MojoBaseLike = qw/ | ||
| 8 | Mojo::Base | ||
| 9 | Mojo::Weixin::Base Mojo::Webqq::Base | ||
| 10 | Kelp::Base Rethinkdb::Base PMLTQ::Base | ||
| 11 | /; | ||
| 12 | |||
| 13 | sub register { | ||
| 14 | my ($class, %args) = @_; | ||
| 15 | my %mojo_base_like = map {$_ => 1} (@MojoBaseLike, @{$args{mojo_base_like} || []}); | ||
| 16 | my %mapping; | ||
| 17 | for my $module (keys %mojo_base_like) { | ||
| 18 | $mapping{use}{$module} = 'parse_mojo_base_args'; | ||
| 19 | } | ||
| 20 | return \%mapping; | ||
| 21 | } | ||
| 22 | |||
| 23 | sub parse_mojo_base_args { | ||
| 24 | my ($class, $c, $used_module, $raw_tokens) = @_; | ||
| 25 | |||
| 26 | my $tokens = convert_string_tokens($raw_tokens); | ||
| 27 | if (is_version($tokens->[0])) { | ||
| 28 | $c->add($used_module => shift @$tokens); | ||
| 29 | } | ||
| 30 | my $module = $tokens->[0]; | ||
| 31 | if (ref $module) { | ||
| 32 | $module = $module->[0]; | ||
| 33 | } | ||
| 34 | if (is_module_name($module)) { | ||
| 35 | $module =~ s|'|::|g; | ||
| 36 | $c->add($module => 0); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | |||
| 42 | __END__ |