# This file belongs to TLPM v2.19, TeX Live Package Manager # Public Domain, P.Jackowski@gust.org.pl # incl [-pfer] # display a list of packages included in and matching sub incl { local $reg_method = \&string2reg; local $incl_method = \&incl_packages; local $getp_method = \&get_pkg_requires_all; local $getf_method = \&get_pkg_contains_all; my $pkges = $source_pkges; my ($pkg,$arg,$reg); while(defined($arg = shift)) { $arg eq '' and next or &no_opt($arg) and (defined $pkg ? $reg = $arg : $pkg = $arg) or &is_opt($arg,'f','files') and $incl_method = \&incl_files or &is_opt($arg,'p','packages') and $incl_method = \&incl_packages or &is_opt($arg,'e','expression') and $reg_method = \&string2preg or &is_opt($arg,'j','justone') and $getp_method = \&get_pkg_requires and $getf_method = \&get_pkg_contains or &is_opt($arg,'r','recurse') and $getp_method = \&get_pkg_requires_all and $getf_method = \&get_pkg_contains_all or &is_opt($arg,'h','help') and return $heeelp -> ('incl') or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'incl --help'); } return $error{'pkg_unspec'} -> () if $pkg eq ''; eval '$reg = $reg_method -> ($reg)'; if($@){return $error{'wrong_reg'} -> ($reg)} return if &read_source(); is_pkg($pkg,$pkges) or return $error{'pkg_not_found'} -> ($pkg); $incl_method -> ($pkg,$reg,$pkges); } sub incl_packages { my ($pkg,$reg,$pkges) = @_; my $count = 0; $mess -> (grep {/$reg/ and ++$count} $getp_method -> ($pkg,$pkges)); $mess -> ("\n"); if($tlpm_redir < 2) { $message -> (&one_or_more($count,'package','packages')); } } sub incl_files { my ($pkg,$reg,$pkges) = @_; my $count = 0; $mess -> (grep {/$reg/ and ++$count} $getf_method -> ($pkg,$pkges));$mess -> ("\n"); if($tlpm_redir < 2) { $message -> ("$count " . ($count == 1 ? "file" : "files")); } } 1;