X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPod%2FFunctions.pm;h=99727b7fe9532152915c0f60ff7c35091bba1287;hb=8e5f3f285c3a089acb6e38e5ef624a23fca2164f;hp=03cbf711eb6db6f95fd66ebba137ea147aaea11b;hpb=5bc28da93666e223bb56098f72517273bc8bcbf9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Pod/Functions.pm b/lib/Pod/Functions.pm index 03cbf71..99727b7 100644 --- a/lib/Pod/Functions.pm +++ b/lib/Pod/Functions.pm @@ -1,13 +1,82 @@ package Pod::Functions; +use strict; -#:vi:set ts=20 +=head1 NAME + +Pod::Functions - Group Perl's functions a la perlfunc.pod + +=head1 SYNOPSIS + + use Pod::Functions; + + my @misc_ops = @{ $Kinds{ 'Misc' } }; + my $misc_dsc = $Type_Description{ 'Misc' }; + +or + + perl /path/to/lib/Pod/Functions.pm + +This will print a grouped list of Perl's functions, like the +L section. + +=head1 DESCRIPTION + +It exports the following variables: + +=over 4 + +=item %Kinds + +This holds a hash-of-lists. Each list contains the functions in the catagory +the key denotes. + +=item %Type + +In this hash each key represents a function and the value is the catagory. +The catagory can be a comma separated list. + +=item %Flavor + +In this hash each key represents a function and the value is a short +description of that function. + +=item %Type_Description + +In this hash each key represents a catagory of functions and the value is +a short description of that catagory. + +=item @Type_Order + +This list of catagories is used to produce the same order as the +L section. + +=back + +=head1 CHANGES + +1.02 20020813 + de-typo in the SYNOPSIS section (thanks Mike Castle for noticing) + +1.01 20011229 + fixed some bugs that slipped in after 5.6.1 + added the pod + finished making it strict safe + +1.00 ?? + first numbered version + +=cut + +our $VERSION = '1.02'; require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(%Kinds %Type %Flavor %Type_Description @Type_Order); +our @ISA = qw(Exporter); +our @EXPORT = qw(%Kinds %Type %Flavor %Type_Description @Type_Order); + +our(%Kinds, %Type, %Flavor); -%Type_Description = ( +our %Type_Description = ( 'ARRAY' => 'Functions for real @ARRAYs', 'Binary' => 'Functions for fixed length data or records', 'File' => 'Functions for filehandles, files, or directories', @@ -30,7 +99,7 @@ require Exporter; 'Namespace' => 'Keywords altering or affecting scoping of identifiers', ); -@Type_Order = qw{ +our @Type_Order = qw{ String Regexp Math @@ -57,18 +126,19 @@ while () { chomp; s/#.*//; next unless $_; - ($name, $type, $text) = split " ", $_, 3; + my($name, $type, $text) = split " ", $_, 3; $Type{$name} = $type; $Flavor{$name} = $text; - for $type ( split /[,\s]+/, $type ) { - push @{$Kinds{$type}}, $name; + for my $t ( split /[,\s]+/, $type ) { + push @{$Kinds{$t}}, $name; } -} +} close DATA; +my( $typedesc, $list ); unless (caller) { - foreach $type ( @Type_Order ) { + foreach my $type ( @Type_Order ) { $list = join(", ", sort @{$Kinds{$type}}); $typedesc = $Type_Description{$type} . ":"; write; @@ -85,7 +155,7 @@ format = $list . -1 +1; __DATA__ -X File a file test (-r, -x, etc) @@ -201,6 +271,7 @@ oct String,Math convert a string to an octal number open File open a file, pipe, or descriptor opendir File open a directory ord String find a character's numeric representation +our Misc,Namespace declare and assign a package variable (lexical scoping) pack Binary,String convert a list into a binary representation pipe Process open a pair of connected filehandles pop ARRAY remove the last element from an array and return it @@ -296,7 +367,7 @@ values HASH return a list of the values in a hash vec Binary test or set particular bits in a string wait Process wait for any child process to die waitpid Process wait for a particular child process to die -wantarray Misc,Flow get list vs array context of current subroutine call +wantarray Misc,Flow get void vs scalar vs list context of current subroutine call warn I/O print debugging info write I/O print a picture record y/// String transliterate a string