Re: Get a list of all pragmas



tuser <tuser3@xxxxxxxxx> wrote in comp.lang.perl.misc:
I am running perl 5.8.7 under Ubuntu Linux 6.06 LTS.

Looking at "perldoc perltoc", I can see the list of pragmas in my
version of perl.

Then I tried to get the list of all pragmas from a perl program:
=================
use ExtUtils::Installed;
$, = "\n";
print ExtUtils::Installed->new()->modules(), "";
=================

but that did only give me the manually installed modules from CPAN, not
even the pre-installed standard modules, let alone the pragmas !

How can I get this list of pragmas programmatically from within a perl
program (other than scanning the "perldoc perltoc" output) ?

This may get you started. It finds all all-lower-case module names
in @INC. Some are probably not meant for public consumption.

use File::Find;
my @prag;
find sub { /^([[:lower:]]+).pl$/ and push @prag, $1 }, @INC;
print join "\n", @prag, '';

Anno
.



Relevant Pages

  • Re: Get a list of all pragmas
    ... Looking at "perldoc perltoc", I can see the list of pragmas in my ... Then I tried to get the list of all pragmas from a perl program: ... You could try Module::CoreList module available from CPAN for this. ...
    (comp.lang.perl.misc)
  • Get a list of all pragmas
    ... I am running perl 5.8.7 under Ubuntu Linux 6.06 LTS. ... Looking at "perldoc perltoc", I can see the list of pragmas in my ... but that did only give me the manually installed modules from CPAN, ...
    (comp.lang.perl.misc)
  • Re: Get a list of all pragmas
    ... Looking at "perldoc perltoc", I can see the list of pragmas in my ... Then I tried to get the list of all pragmas from a perl program: ... You could try Module::CoreList module available from CPAN for this. ...
    (comp.lang.perl.misc)
  • Re: Get a list of all pragmas
    ... Looking at "perldoc perltoc", I can see the list of pragmas in my ... Then I tried to get the list of all pragmas from a perl program: ... It finds all all-lower-case module names ...
    (comp.lang.perl.misc)