FunctionalPerl - functional programming on Perl
use FunctionalPerl; FunctionalPerl->VERSION # or $FunctionalPerl::VERSION # But all the actual modules are under FP::*, like: use FP::List; # etc. # But you can also import sets of modules from here, e.g.: use FunctionalPerl qw(:sequences :repl);
Allow Perl programs to be written with fewer side effects.
See the Functional Perl home page.
FunctionalPerl also acts as a convenience re-exporter, offering tags to load sets of modules.
Note that the tags and the sets of modules are very much alpha. If you want to have a better chance of code not breaking, import the modules you want directly.
Tags can be expanded via:
my ($modules, $unused_tags)= FunctionalPerl::expand(qw(:dev :most)); is $$modules{"FP::Failure"}, 2; # number of times used. use FP::Equal 'is_equal'; is_equal $unused_tags, [':all', ':csv', ':dbi', ':fix', ':git', ':io', ':path', ':pxml', ':rare', ':trampoline', ':transparentlazy'];
This is the list of supported import tags and the modules that they import:
:all: :dev, :io, :most, :rare
:all
:dev
:io
:most
:rare
:autobox: FP::autobox
:autobox
:chars: FP::Char
:chars
:csv: FP::Text::CSV
:csv
:datastructures: :chars, :maps, :numbers, :sequences, :sets, :tries
:datastructures
:maps
:numbers
:sequences
:sets
:tries
:dbi: FP::DBI
:dbi
:debug: :equal, :show, Chj::Backtrace, Chj::pp, Chj::time_this
:debug
:equal
:show
:dev: :debug, :repl, :test, Chj::ruse
:repl
:test
:equal: FP::Equal
:failure: FP::Failure
:failure
:fix: FP::fix
:fix
:functions: :equal, :failure, :show, FP::Combinators, FP::Div, FP::Memoizing, FP::Ops, FP::Optional, FP::Untainted, FP::Values, FP::uncurry
:functions
:git: FP::Git::Repository
:git
:io: Chj::tempdir, Chj::xIO, Chj::xhome, Chj::xopen, Chj::xopendir, Chj::xoutpipe, Chj::xperlfunc, Chj::xpipe, Chj::xtmpfile, FP::IOStream
:lazy: :stream, FP::Lazy, FP::Weak
:lazy
:stream
:maps: FP::Hash
:most: :autobox, :datastructures, :debug, :equal, :failure, :functions, :lazy, :show
:numbers: FP::BigInt
:path: FP::Path
:path
:pxml: PXML::Serialize, PXML::Util, PXML::XHTML
:pxml
:rare: :csv, :dbi, :fix, :git, :path, :trampoline
:trampoline
:repl: FP::Repl, FP::Repl::AutoTrap
:sequences: :stream, FP::Array, FP::Array_sort, FP::List, FP::MutableArray, FP::PureArray, FP::StrictList
:sets: FP::HashSet, FP::OrderedCollection
:show: FP::Show
:stream: FP::IOStream, FP::Stream, FP::Weak
:test: Chj::TEST
:trampoline: FP::Trampoline
:transparentlazy: :stream, FP::TransparentLazy, FP::Weak
:transparentlazy
:tries: FP::Trie
This is alpha software! Read the status section in the package README or on the website.
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.