/usr/local/share/man/man3
NameSizeModeActions
App::Prove.3pm105080444editdlrm
App::Prove::State.3pm60050444editdlrm
App::Prove::State::Result.3pm56190444editdlrm
App::Prove::State::Result::Test.3pm50510444editdlrm
AppConfig.3pm352890444editdlrm
AppConfig::Args.3pm79920444editdlrm
AppConfig::CGI.3pm66090444editdlrm
AppConfig::File.3pm126140444editdlrm
AppConfig::Getopt.3pm74440444editdlrm
AppConfig::State.3pm249720444editdlrm
AppConfig::Sys.3pm66950444editdlrm
Archive::Tar.3pm440610444editdlrm
Archive::Tar::File.3pm110830444editdlrm
Archive::Zip.3pm699850444editdlrm
Archive::Zip::FAQ.3pm184370444editdlrm
Archive::Zip::MemberRead.3pm67340444editdlrm
Archive::Zip::Tree.3pm28750444editdlrm
B::COW.3pm51630444editdlrm
Canary::Stability.3pm37270444editdlrm
CDB_File.3pm143180444editdlrm
common::sense.3pm00444editdlrm
Compress::Raw::Bzip2.3pm134630444editdlrm
Compress::Raw::Zlib.3pm420820444editdlrm
Compress::Zlib.3pm387190444editdlrm
CPAN::Meta.3pm159230444editdlrm
CPAN::Meta::Converter.3pm65940444editdlrm
CPAN::Meta::Feature.3pm43220444editdlrm
CPAN::Meta::History.3pm78550444editdlrm
CPAN::Meta::History::Meta_1_0.3pm99730444editdlrm
CPAN::Meta::History::Meta_1_1.3pm124100444editdlrm
CPAN::Meta::History::Meta_1_2.3pm222240444editdlrm
CPAN::Meta::History::Meta_1_3.3pm239740444editdlrm
CPAN::Meta::History::Meta_1_4.3pm245650444editdlrm
CPAN::Meta::Merge.3pm52850444editdlrm
CPAN::Meta::Prereqs.3pm73800444editdlrm
CPAN::Meta::Requirements.3pm123080444editdlrm
CPAN::Meta::Spec.3pm455920444editdlrm
CPAN::Meta::Validator.3pm42150444editdlrm
CPAN::Meta::YAML.3pm42300444editdlrm
Crypt::OpenSSL::Random.3pm56340444editdlrm
Curses.3pm375800444editdlrm
Curses::UI.3pm156190444editdlrm
Curses::UI::Buttonbox.3pm89080444editdlrm
Curses::UI::Calendar.3pm82030444editdlrm
Curses::UI::Checkbox.3pm65090444editdlrm
Curses::UI::Color.3pm59030444editdlrm
Curses::UI::Common.3pm64980444editdlrm
Curses::UI::Container.3pm90410444editdlrm
Curses::UI::Dialog::Basic.3pm52130444editdlrm
Curses::UI::Dialog::Calendar.3pm47610444editdlrm
Curses::UI::Dialog::Dirbrowser.3pm53690444editdlrm
Curses::UI::Dialog::Error.3pm43070444editdlrm
Curses::UI::Dialog::Filebrowser.3pm68890444editdlrm
Curses::UI::Dialog::Progress.3pm57740444editdlrm
Curses::UI::Dialog::Question.3pm52770444editdlrm
Curses::UI::Dialog::Status.3pm47650444editdlrm
Curses::UI::Label.3pm73330444editdlrm
Curses::UI::Listbox.3pm119880444editdlrm
Curses::UI::Menubar.3pm81100444editdlrm
Curses::UI::Notebook.3pm91400444editdlrm
Curses::UI::PasswordEntry.3pm37430444editdlrm
Curses::UI::Popupmenu.3pm74310444editdlrm
Curses::UI::Progressbar.3pm58910444editdlrm
Curses::UI::Radiobuttonbox.3pm40690444editdlrm
Curses::UI::Searchable.3pm66680444editdlrm
Curses::UI::TextEditor.3pm141710444editdlrm
Curses::UI::TextEntry.3pm36230444editdlrm
Curses::UI::TextViewer.3pm36700444editdlrm
Curses::UI::Tutorial.3pm85550444editdlrm
Curses::UI::Widget.3pm256750444editdlrm
Curses::UI::Window.3pm50840444editdlrm
Cwd.3pm71830444editdlrm
Date::Format.3pm72910444editdlrm
Date::Language.3pm38090444editdlrm
Date::Language::Bulgarian.3pm36750444editdlrm
Date::Language::Hungarian.3pm30910444editdlrm
Date::Parse.3pm54020444editdlrm
Digest::SHA.3pm257590444editdlrm
Expect.3pm602290444editdlrm
ExtUtils::CBuilder.3pm119230444editdlrm
ExtUtils::CBuilder::Platform::Windows.3pm31170444editdlrm
ExtUtils::Command.3pm59420444editdlrm
ExtUtils::Command::MM.3pm57230444editdlrm
ExtUtils::Liblist.3pm126790444editdlrm
ExtUtils::MakeMaker.3pm793570444editdlrm
ExtUtils::MakeMaker::Config.3pm25870444editdlrm
ExtUtils::MakeMaker::FAQ.3pm268290444editdlrm
ExtUtils::MakeMaker::Locale.3pm111680444editdlrm
ExtUtils::MakeMaker::Tutorial.3pm83890444editdlrm
ExtUtils::Manifest.3pm119610444editdlrm
ExtUtils::Mkbootstrap.3pm34590444editdlrm
ExtUtils::Mksymlists.3pm66990444editdlrm
ExtUtils::MM.3pm28290444editdlrm
ExtUtils::MM_AIX.3pm30440444editdlrm
ExtUtils::MM_Any.3pm311290444editdlrm
ExtUtils::MM_BeOS.3pm27980444editdlrm
ExtUtils::MM_Cygwin.3pm35690444editdlrm
ExtUtils::MM_Darwin.3pm26880444editdlrm
ExtUtils::MM_DOS.3pm30210444editdlrm
ExtUtils::MM_MacOS.3pm29870444editdlrm
ExtUtils::MM_NW5.3pm32000444editdlrm
ExtUtils::MM_OS2.3pm28860444editdlrm
ExtUtils::MM_QNX.3pm29420444editdlrm
ExtUtils::MM_Unix.3pm214190444editdlrm
ExtUtils::MM_UWIN.3pm30510444editdlrm
ExtUtils::MM_VMS.3pm149000444editdlrm
ExtUtils::MM_VOS.3pm29260444editdlrm
ExtUtils::MM_Win32.3pm59190444editdlrm
ExtUtils::MM_Win95.3pm32760444editdlrm
ExtUtils::MY.3pm27640444editdlrm
ExtUtils::testlib.3pm26900444editdlrm
File::GlobMapper.3pm114470444editdlrm
File::HomeDir.3pm182120444editdlrm
File::HomeDir::Darwin.3pm32320444editdlrm
File::HomeDir::Darwin::Carbon.3pm35170444editdlrm
File::HomeDir::Darwin::Cocoa.3pm34460444editdlrm
File::HomeDir::Driver.3pm31010444editdlrm
File::HomeDir::FreeDesktop.3pm34870444editdlrm
File::HomeDir::MacOS9.3pm34990444editdlrm
File::HomeDir::Test.3pm35340444editdlrm
File::HomeDir::Unix.3pm36380444editdlrm
File::HomeDir::Windows.3pm48910444editdlrm
File::Path.3pm310300444editdlrm
File::Slurp.3pm236260444editdlrm
File::Spec.3pm137840444editdlrm
File::Spec::AmigaOS.3pm28260444editdlrm
File::Spec::Cygwin.3pm39570444editdlrm
File::Spec::Epoc.3pm32510444editdlrm
File::Spec::Functions.3pm37990444editdlrm
File::Spec::Mac.3pm186640444editdlrm
File::Spec::OS2.3pm31180444editdlrm
File::Spec::Unix.3pm98370444editdlrm
File::Spec::VMS.3pm63890444editdlrm
File::Spec::Win32.3pm64510444editdlrm
File::Temp.3pm367990444editdlrm
File::Which.3pm97460444editdlrm
Getopt::Long.3pm526470444editdlrm
HDB.3pm109470444editdlrm
HDB::CMDS.3pm188940444editdlrm
HDB::Encode.3pm78630444editdlrm
HDB::Object.3pm100570444editdlrm
HTML::AsSubs.3pm85860444editdlrm
HTML::Element.3pm707930444editdlrm
HTML::Element::traverse.3pm159840444editdlrm
HTML::Form.3pm281580444editdlrm
HTML::Parse.3pm82770444editdlrm
HTML::Tree.3pm99820444editdlrm
HTML::Tree::AboutObjects.3pm379180444editdlrm
HTML::Tree::AboutTrees.3pm585340444editdlrm
HTML::Tree::Scanning.3pm343850444editdlrm
HTML::TreeBuilder.3pm301380444editdlrm
HTTP::Tiny.3pm277090444editdlrm
IO::AtomicFile.3pm53810444editdlrm
IO::Compress::Base.3pm35060444editdlrm
IO::Compress::Bzip2.3pm232600444editdlrm
IO::Compress::Deflate.3pm267680444editdlrm
IO::Compress::FAQ.3pm267180444editdlrm
IO::Compress::Gzip.3pm344890444editdlrm
IO::Compress::RawDeflate.3pm271340444editdlrm
IO::Compress::Zip.3pm408700444editdlrm
IO::InnerFile.3pm60350444editdlrm
IO::Lines.3pm37830444editdlrm
IO::Pty.3pm85790444editdlrm
IO::Scalar.3pm106790444editdlrm
IO::ScalarArray.3pm105280444editdlrm
IO::Stringy.3pm40490444editdlrm
IO::Tty.3pm83480444editdlrm
IO::Tty::Constant.3pm100120444editdlrm
IO::Uncompress::AnyInflate.3pm328000444editdlrm
IO::Uncompress::AnyUncompress.3pm307670444editdlrm
IO::Uncompress::Base.3pm35180444editdlrm
IO::Uncompress::Bunzip2.3pm291710444editdlrm
IO::Uncompress::Gunzip.3pm317190444editdlrm
IO::Uncompress::Inflate.3pm299150444editdlrm
IO::Uncompress::RawInflate.3pm295630444editdlrm
IO::Uncompress::Unzip.3pm312790444editdlrm
IO::Wrap.3pm106640444editdlrm
IO::WrapTie.3pm149870444editdlrm
JSON::PP.3pm500800444editdlrm
JSON::PP::Boolean.3pm26670444editdlrm
JSON::Syck.3pm80940444editdlrm
JSON::XS.3pm890370444editdlrm
JSON::XS::Boolean.3pm28570444editdlrm
lib::core::only.3pm56470444editdlrm
local::lib.3pm313900444editdlrm
LWP.3pm285060444editdlrm
LWP::Authen::Ntlm.3pm74890444editdlrm
LWP::ConnCache.3pm99670444editdlrm
LWP::Debug.3pm56080444editdlrm
LWP::MemberMixin.3pm48210444editdlrm
LWP::Protocol.3pm83500444editdlrm
LWP::Protocol::https.3pm56840444editdlrm
LWP::RobotUA.3pm90220444editdlrm
LWP::Simple.3pm90160444editdlrm
LWP::UserAgent.3pm481560444editdlrm
lwpcook.3pm148380444editdlrm
lwptut.3pm324410444editdlrm
Module::Build.3pm445630444editdlrm
Module::Build::API.3pm892670444editdlrm
Module::Build::Authoring.3pm173630444editdlrm
Module::Build::Base.3pm51570444editdlrm
Module::Build::Bundling.3pm99990444editdlrm
Module::Build::Compat.3pm108850444editdlrm
Module::Build::ConfigData.3pm73880444editdlrm
Module::Build::Cookbook.3pm259460444editdlrm
Module::Build::Notes.3pm46900444editdlrm
Module::Build::Platform::aix.3pm44720444editdlrm
Module::Build::Platform::cygwin.3pm45050444editdlrm
Module::Build::Platform::darwin.3pm44910444editdlrm
Module::Build::Platform::Default.3pm44900444editdlrm
Module::Build::Platform::MacOS.3pm53980444editdlrm
Module::Build::Platform::os2.3pm44740444editdlrm
Module::Build::Platform::Unix.3pm44810444editdlrm
Module::Build::Platform::VMS.3pm78850444editdlrm
Module::Build::Platform::VOS.3pm44770444editdlrm
Module::Build::Platform::Windows.3pm45290444editdlrm
Module::Build::PPMMaker.3pm48860444editdlrm
Mozilla::CA.3pm35710444editdlrm
Net::CIDR::Lite.3pm95620444editdlrm
Net::Cmd.3pm115450444editdlrm
Net::Config.3pm81000444editdlrm
Net::Domain.3pm38350444editdlrm
Net::FTP.3pm273410444editdlrm
Net::FTP::dataconn.3pm39790444editdlrm
Net::HTTP.3pm163750444editdlrm
Net::HTTP::NB.3pm53940444editdlrm
Net::HTTPS.3pm54380444editdlrm
Net::IP.3pm276970444editdlrm
Net::libnetFAQ.3pm147460444editdlrm
Net::Netrc.3pm67290444editdlrm
Net::NNTP.3pm231930444editdlrm
Net::POP3.3pm122590444editdlrm
Net::SMTP.3pm188800444editdlrm
Net::SSLeay.3pm3493500444editdlrm
Net::SSLeay::Handle.3pm91270444editdlrm
Net::Time.3pm45240444editdlrm
ok.3pm28510444editdlrm
Parse::CPAN::Meta.3pm101870444editdlrm
POD2::DE::local::lib.3pm228790444editdlrm
POD2::PT_BR::local::lib.3pm227620444editdlrm
Socket.3pm340780444editdlrm
Sub::Identify.3pm50870444editdlrm
SUPER.3pm73940444editdlrm
Switch.3pm190140444editdlrm
TAP::Base.3pm34010444editdlrm
TAP::Formatter::Base.3pm62330444editdlrm
TAP::Formatter::Color.3pm37170444editdlrm
TAP::Formatter::Console.3pm27220444editdlrm
TAP::Formatter::Console::ParallelSession.3pm30650444editdlrm
TAP::Formatter::Console::Session.3pm28320444editdlrm
TAP::Formatter::File.3pm26930444editdlrm
TAP::Formatter::File::Session.3pm28470444editdlrm
TAP::Formatter::Session.3pm36030444editdlrm
TAP::Harness.3pm213000444editdlrm
TAP::Harness::Beyond.3pm191180444editdlrm
TAP::Harness::Env.3pm54670444editdlrm
TAP::Object.3pm44970444editdlrm
TAP::Parser.3pm422100444editdlrm
TAP::Parser::Aggregator.3pm80230444editdlrm
TAP::Parser::Grammar.3pm86470444editdlrm
TAP::Parser::Iterator.3pm49930444editdlrm
TAP::Parser::Iterator::Array.3pm37710444editdlrm
TAP::Parser::Iterator::Process.3pm46010444editdlrm
TAP::Parser::Iterator::Stream.3pm37120444editdlrm
TAP::Parser::IteratorFactory.3pm69040444editdlrm
TAP::Parser::Multiplexer.3pm46460444editdlrm
TAP::Parser::Result.3pm75120444editdlrm
TAP::Parser::Result::Bailout.3pm32930444editdlrm
TAP::Parser::Result::Comment.3pm31180444editdlrm
TAP::Parser::Result::Plan.3pm41730444editdlrm
TAP::Parser::Result::Pragma.3pm30730444editdlrm
TAP::Parser::Result::Test.3pm71140444editdlrm
TAP::Parser::Result::Unknown.3pm29730444editdlrm
TAP::Parser::Result::Version.3pm31540444editdlrm
TAP::Parser::Result::YAML.3pm30860444editdlrm
TAP::Parser::ResultFactory.3pm55230444editdlrm
TAP::Parser::Scheduler.3pm81130444editdlrm
TAP::Parser::Scheduler::Job.3pm43010444editdlrm
TAP::Parser::Scheduler::Spinner.3pm33460444editdlrm
TAP::Parser::Source.3pm81700444editdlrm
TAP::Parser::SourceHandler.3pm75590444editdlrm
TAP::Parser::SourceHandler::Executable.3pm52970444editdlrm
TAP::Parser::SourceHandler::File.3pm45670444editdlrm
TAP::Parser::SourceHandler::Handle.3pm44250444editdlrm
TAP::Parser::SourceHandler::Perl.3pm62620444editdlrm
TAP::Parser::SourceHandler::RawTAP.3pm44340444editdlrm
TAP::Parser::YAMLish::Reader.3pm39950444editdlrm
TAP::Parser::YAMLish::Writer.3pm48790444editdlrm
Template.3pm279090444editdlrm
Template::Base.3pm81490444editdlrm
Template::Config.3pm86870444editdlrm
Template::Constants.3pm78150444editdlrm
Template::Context.3pm266370444editdlrm
Template::Directive.3pm48210444editdlrm
Template::Document.3pm118290444editdlrm
Template::Exception.3pm67630444editdlrm
Template::FAQ.3pm145640444editdlrm
Template::Filters.3pm98170444editdlrm
Template::Grammar.3pm50390444editdlrm
Template::Iterator.3pm114130444editdlrm
Template::Manual.3pm63170444editdlrm
Template::Manual::Config.3pm795040444editdlrm
Template::Manual::Credits.3pm82460444editdlrm
Template::Manual::Directives.3pm772930444editdlrm
Template::Manual::Filters.3pm208100444editdlrm
Template::Manual::Internals.3pm234330444editdlrm
Template::Manual::Intro.3pm140920444editdlrm
Template::Manual::Plugins.3pm137800444editdlrm
Template::Manual::Syntax.3pm145490444editdlrm
Template::Manual::Variables.3pm331100444editdlrm
Template::Manual::Views.3pm259530444editdlrm
Template::Manual::VMethods.3pm281950444editdlrm
Template::Modules.3pm98270444editdlrm
Template::Namespace::Constants.3pm60020444editdlrm
Template::Parser.3pm99170444editdlrm
Template::Plugin.3pm109370444editdlrm
Template::Plugin::Assert.3pm54460444editdlrm
Template::Plugin::CGI.3pm61880444editdlrm
Template::Plugin::Datafile.3pm66010444editdlrm
Template::Plugin::Date.3pm95380444editdlrm
Template::Plugin::Directory.3pm119790444editdlrm
Template::Plugin::Dumper.3pm60780444editdlrm
Template::Plugin::File.3pm130090444editdlrm
Template::Plugin::Filter.3pm129360444editdlrm
Template::Plugin::Format.3pm48950444editdlrm
Template::Plugin::HTML.3pm78230444editdlrm
Template::Plugin::Image.3pm119500444editdlrm
Template::Plugin::Iterator.3pm50610444editdlrm
Template::Plugin::Math.3pm66230444editdlrm
Template::Plugin::Pod.3pm47840444editdlrm
Template::Plugin::Procedural.3pm56310444editdlrm
Template::Plugin::Scalar.3pm50320444editdlrm
Template::Plugin::String.3pm172630444editdlrm
Template::Plugin::Table.3pm111450444editdlrm
Template::Plugin::URL.3pm80800444editdlrm
Template::Plugin::View.3pm54790444editdlrm
Template::Plugin::Wrap.3pm64330444editdlrm
Template::Plugins.3pm97330444editdlrm
Template::Provider.3pm146780444editdlrm
Template::Service.3pm148130444editdlrm
Template::Stash.3pm119830444editdlrm
Template::Stash::Context.3pm71300444editdlrm
Template::Stash::XS.3pm66440444editdlrm
Template::Test.3pm155240444editdlrm
Template::Toolkit.3pm92270444editdlrm
Template::Tools.3pm50010444editdlrm
Template::Tools::tpage.3pm58060444editdlrm
Template::Tools::ttree.3pm165670444editdlrm
Template::Tutorial.3pm45660444editdlrm
Template::Tutorial::Datafile.3pm195390444editdlrm
Template::Tutorial::Web.3pm341180444editdlrm
Template::View.3pm126180444editdlrm
Template::VMethods.3pm46880444editdlrm
Term::ReadKey.3pm130290444editdlrm
Test2.3pm95560444editdlrm
Test2::API.3pm304240444editdlrm
Test2::API::Breakage.3pm49880444editdlrm
Test2::API::Context.3pm175740444editdlrm
Test2::API::Instance.3pm124040444editdlrm
Test2::API::Stack.3pm65680444editdlrm
Test2::Event.3pm91890444editdlrm
Test2::Event::Bail.3pm34700444editdlrm
Test2::Event::Diag.3pm33380444editdlrm
Test2::Event::Exception.3pm35200444editdlrm
Test2::Event::Generic.3pm76620444editdlrm
Test2::Event::Info.3pm42610444editdlrm
Test2::Event::Note.3pm33230444editdlrm
Test2::Event::Ok.3pm42550444editdlrm
Test2::Event::Plan.3pm39070444editdlrm
Test2::Event::Skip.3pm36650444editdlrm
Test2::Event::Subtest.3pm35730444editdlrm
Test2::Event::Waiting.3pm31070444editdlrm
Test2::Formatter.3pm52080444editdlrm
Test2::Formatter::TAP.3pm92550444editdlrm
Test2::Hub.3pm167550444editdlrm
Test2::Hub::Interceptor.3pm29370444editdlrm
Test2::Hub::Interceptor::Terminator.3pm29800444editdlrm
Test2::Hub::Subtest.3pm38030444editdlrm
Test2::IPC.3pm33240444editdlrm
Test2::IPC::Driver.3pm95120444editdlrm
Test2::IPC::Driver::Files.3pm38220444editdlrm
Test2::Transition.3pm184060444editdlrm
Test2::Util.3pm51230444editdlrm
Test2::Util::ExternalMeta.3pm55940444editdlrm
Test2::Util::HashBase.3pm74630444editdlrm
Test2::Util::Trace.3pm55770444editdlrm
Test::Builder.3pm269150444editdlrm
Test::Builder::Formatter.3pm36560444editdlrm
Test::Builder::IO::Scalar.3pm97400444editdlrm
Test::Builder::Module.3pm55670444editdlrm
Test::Builder::Tester.3pm115500444editdlrm
Test::Builder::Tester::Color.3pm31310444editdlrm
Test::Builder::TodoDiag.3pm31290444editdlrm
Test::Fatal.3pm93030444editdlrm
Test::HACKING.3pm92530444editdlrm
Test::Harness.3pm110280444editdlrm
Test::LeakTrace.3pm100220444editdlrm
Test::LeakTrace::JA.3pm123280444editdlrm
Test::LeakTrace::Script.3pm51400444editdlrm
Test::MockModule.3pm108180444editdlrm
Test::More.3pm432150444editdlrm
Test::More::UTF8.3pm36020444editdlrm
Test::RequiresInternet.3pm39440444editdlrm
Test::Simple.3pm91190444editdlrm
Test::Tester.3pm157810444editdlrm
Test::Tester::Capture.3pm29020444editdlrm
Test::Tester::CaptureRunner.3pm26730444editdlrm
Test::Tutorial.3pm242610444editdlrm
Test::use::ok.3pm38410444editdlrm
Test::Warnings.3pm142310444editdlrm
Text::Glob.3pm61060444editdlrm
Text::Template.3pm654990444editdlrm
Text::Template::Preprocess.3pm62700444editdlrm
Time::Zone.3pm34130444editdlrm
TimeDate.3pm23970444editdlrm
Try::Tiny.3pm203430444editdlrm
Types::Serialiser.3pm114730444editdlrm
Types::Serialiser::Error.3pm27050444editdlrm
version.3pm139370444editdlrm
version::Internals.3pm302870444editdlrm
WWW::Mechanize.3pm681960444editdlrm
WWW::Mechanize::Cookbook.3pm71590444editdlrm
WWW::Mechanize::Examples.3pm224900444editdlrm
WWW::Mechanize::FAQ.3pm243590444editdlrm
WWW::Mechanize::Image.3pm64900444editdlrm
WWW::Mechanize::Link.3pm65180444editdlrm
XML::NamespaceSupport.3pm130520444editdlrm
XML::Parser.3pm262960444editdlrm
XML::Parser::Expat.3pm267990444editdlrm
XML::Parser::Style::Debug.3pm44080444editdlrm
XML::Parser::Style::Objects.3pm48880444editdlrm
XML::Parser::Style::Stream.3pm59250444editdlrm
XML::Parser::Style::Subs.3pm48630444editdlrm
XML::Parser::Style::Tree.3pm55290444editdlrm
XML::SAX.3pm92290444editdlrm
XML::SAX::Base.3pm137040444editdlrm
XML::SAX::BuildSAXBase.3pm137000444editdlrm
XML::SAX::DocumentLocator.3pm52390444editdlrm
XML::SAX::Exception.3pm56220444editdlrm
XML::SAX::Expat.3pm64040444editdlrm
XML::SAX::Intro.3pm202200444editdlrm
XML::SAX::ParserFactory.3pm79190444editdlrm
XML::SAX::PurePerl.3pm61720444editdlrm
XML::SAX::PurePerl::Reader.3pm41030444editdlrm
XML::Simple.3pm655890444editdlrm
XML::Simple::FAQ.3pm272230444editdlrm
YAML.3pm299800444editdlrm
YAML::Any.3pm74870444editdlrm
YAML::Dumper.3pm47760444editdlrm
YAML::Dumper::Base.3pm46420444editdlrm
YAML::Error.3pm46810444editdlrm
YAML::Loader.3pm47660444editdlrm
YAML::Loader::Base.3pm46420444editdlrm
YAML::Marshall.3pm46400444editdlrm
YAML::Node.3pm67430444editdlrm
YAML::Syck.3pm108060444editdlrm
YAML::Tag.3pm44990444editdlrm
YAML::Types.3pm47160444editdlrm
Edit: /usr/local/share/man/man3/XML::Simple.3pm (65589B)
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "XML::Simple 3" .TH XML::Simple 3 "2015-12-04" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::Simple \- An API for simple XML files .SH "SYNOPSIS" .IX Header "SYNOPSIS" You really don't want to use this module in new code. If you ignore this warning and use it anyway, the \f(CW\*(C`qw(:strict)\*(C'\fR mode will save you a little pain. .PP .Vb 1 \& use XML::Simple qw(:strict); \& \& my $ref = XMLin([] [, ]); \& \& my $xml = XMLout($hashref [, ]); .Ve .PP Or the object oriented way: .PP .Vb 1 \& require XML::Simple qw(:strict); \& \& my $xs = XML::Simple\->new([]); \& \& my $ref = $xs\->XMLin([] [, ]); \& \& my $xml = $xs\->XMLout($hashref [, ]); .Ve .PP (or see \*(L"\s-1SAX SUPPORT\*(R"\s0 for 'the \s-1SAX\s0 way'). .PP Note, in these examples, the square brackets are used to denote optional items not to imply items should be supplied in arrayrefs. .SH "STATUS OF THIS MODULE" .IX Header "STATUS OF THIS MODULE" The use of this module in new code is discouraged. Other modules are available which provide more straightforward and consistent interfaces. In particular, XML::LibXML is highly recommended and XML::Twig is an excellent alternative. .PP The major problems with this module are the large number of options (some of which have unfortunate defaults) and the arbitrary ways in which these options interact \- often producing unexpected results. .PP Patches with bug fixes and documentation fixes are welcome, but new features are unlikely to be added. .SH "QUICK START" .IX Header "QUICK START" Say you have a script called \fBfoo\fR and a file of configuration options called \fBfoo.xml\fR containing the following: .PP .Vb 10 \& \& \&
10.0.0.101
\&
10.0.1.101
\&
\& \&
10.0.0.102
\&
\& \&
10.0.0.103
\&
10.0.1.103
\&
\&
.Ve .PP The following lines of code in \fBfoo\fR: .PP .Vb 1 \& use XML::Simple qw(:strict); \& \& my $config = XMLin(undef, KeyAttr => { server => \*(Aqname\*(Aq }, ForceArray => [ \*(Aqserver\*(Aq, \*(Aqaddress\*(Aq ]); .Ve .PP will 'slurp' the configuration options into the hashref \f(CW$config\fR (because no filename or \s-1XML\s0 string was passed as the first argument to \f(CW\*(C`XMLin()\*(C'\fR the name and location of the \s-1XML\s0 file will be inferred from name and location of the script). You can dump out the contents of the hashref using Data::Dumper: .PP .Vb 1 \& use Data::Dumper; \& \& print Dumper($config); .Ve .PP which will produce something like this (formatting has been adjusted for brevity): .PP .Vb 10 \& { \& \*(Aqlogdir\*(Aq => \*(Aq/var/log/foo/\*(Aq, \& \*(Aqdebugfile\*(Aq => \*(Aq/tmp/foo.debug\*(Aq, \& \*(Aqserver\*(Aq => { \& \*(Aqsahara\*(Aq => { \& \*(Aqosversion\*(Aq => \*(Aq2.6\*(Aq, \& \*(Aqosname\*(Aq => \*(Aqsolaris\*(Aq, \& \*(Aqaddress\*(Aq => [ \*(Aq10.0.0.101\*(Aq, \*(Aq10.0.1.101\*(Aq ] \& }, \& \*(Aqgobi\*(Aq => { \& \*(Aqosversion\*(Aq => \*(Aq6.5\*(Aq, \& \*(Aqosname\*(Aq => \*(Aqirix\*(Aq, \& \*(Aqaddress\*(Aq => [ \*(Aq10.0.0.102\*(Aq ] \& }, \& \*(Aqkalahari\*(Aq => { \& \*(Aqosversion\*(Aq => \*(Aq2.0.34\*(Aq, \& \*(Aqosname\*(Aq => \*(Aqlinux\*(Aq, \& \*(Aqaddress\*(Aq => [ \*(Aq10.0.0.103\*(Aq, \*(Aq10.0.1.103\*(Aq ] \& } \& } \& } .Ve .PP Your script could then access the name of the log directory like this: .PP .Vb 1 \& print $config\->{logdir}; .Ve .PP similarly, the second address on the server 'kalahari' could be referenced as: .PP .Vb 1 \& print $config\->{server}\->{kalahari}\->{address}\->[1]; .Ve .PP Note: If the mapping between the output of Data::Dumper and the print statements above is not obvious to you, then please refer to the 'references' tutorial (\s-1AKA: \s0\*(L"Mark's very short tutorial about references\*(R") at perlreftut. .PP In this example, the \f(CW\*(C`ForceArray\*(C'\fR option was used to list elements that might occur multiple times and should therefore be represented as arrayrefs (even when only one element is present). .PP The \f(CW\*(C`KeyAttr\*(C'\fR option was used to indicate that each \f(CW\*(C`\*(C'\fR element has a unique identifier in the \f(CW\*(C`name\*(C'\fR attribute. This allows you to index directly to a particular server record using the name as a hash key (as shown above). .PP For simple requirements, that's really all there is to it. If you want to store your \s-1XML\s0 in a different directory or file, or pass it in as a string or even pass it in via some derivative of an IO::Handle, you'll need to check out \&\*(L"\s-1OPTIONS\*(R"\s0. If you want to turn off or tweak the array folding feature (that neat little transformation that produced \f(CW$config\fR\->{server}) you'll find options for that as well. .PP If you want to generate \s-1XML \s0(for example to write a modified version of \&\f(CW$config\fR back out as \s-1XML\s0), check out \f(CW\*(C`XMLout()\*(C'\fR. .PP If your needs are not so simple, this may not be the module for you. In that case, you might want to read \*(L"\s-1WHERE TO FROM HERE\s0?\*(R". .SH "DESCRIPTION" .IX Header "DESCRIPTION" The XML::Simple module provides a simple \s-1API\s0 layer on top of an underlying \s-1XML\s0 parsing module (either XML::Parser or one of the \s-1SAX2\s0 parser modules). Two functions are exported: \f(CW\*(C`XMLin()\*(C'\fR and \f(CW\*(C`XMLout()\*(C'\fR. Note: you can explicitly request the lower case versions of the function names: \f(CW\*(C`xml_in()\*(C'\fR and \&\f(CW\*(C`xml_out()\*(C'\fR. .PP The simplest approach is to call these two functions directly, but an optional object oriented interface (see \*(L"\s-1OPTIONAL OO INTERFACE\*(R"\s0 below) allows them to be called as methods of an \fBXML::Simple\fR object. The object interface can also be used at either end of a \s-1SAX\s0 pipeline. .SS "\fIXMLin()\fP" .IX Subsection "XMLin()" Parses \s-1XML\s0 formatted data and returns a reference to a data structure which contains the same information in a more readily accessible form. (Skip down to \*(L"\s-1EXAMPLES\*(R"\s0 below, for more sample code). .PP \&\f(CW\*(C`XMLin()\*(C'\fR accepts an optional \s-1XML\s0 specifier followed by zero or more 'name => value' option pairs. The \s-1XML\s0 specifier can be one of the following: .IP "A filename" 4 .IX Item "A filename" If the filename contains no directory components \f(CW\*(C`XMLin()\*(C'\fR will look for the file in each directory in the SearchPath (see \*(L"\s-1OPTIONS\*(R"\s0 below) or in the current directory if the SearchPath option is not defined. eg: .Sp .Vb 1 \& $ref = XMLin(\*(Aq/etc/params.xml\*(Aq); .Ve .Sp Note, the filename '\-' can be used to parse from \s-1STDIN.\s0 .IP "undef" 4 .IX Item "undef" If there is no \s-1XML\s0 specifier, \f(CW\*(C`XMLin()\*(C'\fR will check the script directory and each of the SearchPath directories for a file with the same name as the script but with the extension '.xml'. Note: if you wish to specify options, you must specify the value 'undef'. eg: .Sp .Vb 1 \& $ref = XMLin(undef, ForceArray => 1); .Ve .IP "A string of \s-1XML\s0" 4 .IX Item "A string of XML" A string containing \s-1XML \s0(recognised by the presence of '<' and '>' characters) will be parsed directly. eg: .Sp .Vb 1 \& $ref = XMLin(\*(Aq\*(Aq); .Ve .IP "An IO::Handle object" 4 .IX Item "An IO::Handle object" An IO::Handle object will be read to \s-1EOF\s0 and its contents parsed. eg: .Sp .Vb 2 \& $fh = IO::File\->new(\*(Aq/etc/params.xml\*(Aq); \& $ref = XMLin($fh); .Ve .SS "\fIXMLout()\fP" .IX Subsection "XMLout()" Takes a data structure (generally a hashref) and returns an \s-1XML\s0 encoding of that structure. If the resulting \s-1XML\s0 is parsed using \f(CW\*(C`XMLin()\*(C'\fR, it should return a data structure equivalent to the original (see caveats below). .PP The \f(CW\*(C`XMLout()\*(C'\fR function can also be used to output the \s-1XML\s0 as \s-1SAX\s0 events see the \f(CW\*(C`Handler\*(C'\fR option and \*(L"\s-1SAX SUPPORT\*(R"\s0 for more details). .PP When translating hashes to \s-1XML,\s0 hash keys which have a leading '\-' will be silently skipped. This is the approved method for marking elements of a data structure which should be ignored by \f(CW\*(C`XMLout\*(C'\fR. (Note: If these items were not skipped the key names would be emitted as element or attribute names with a leading '\-' which would not be valid \s-1XML\s0). .SS "Caveats" .IX Subsection "Caveats" Some care is required in creating data structures which will be passed to \&\f(CW\*(C`XMLout()\*(C'\fR. Hash keys from the data structure will be encoded as either \s-1XML\s0 element names or attribute names. Therefore, you should use hash key names which conform to the relatively strict \s-1XML\s0 naming rules: .PP Names in \s-1XML\s0 must begin with a letter. The remaining characters may be letters, digits, hyphens (\-), underscores (_) or full stops (.). It is also allowable to include one colon (:) in an element name but this should only be used when working with namespaces (\fBXML::Simple\fR can only usefully work with namespaces when teamed with a \s-1SAX\s0 Parser). .PP You can use other punctuation characters in hash values (just not in hash keys) however \fBXML::Simple\fR does not support dumping binary data. .PP If you break these rules, the current implementation of \f(CW\*(C`XMLout()\*(C'\fR will simply emit non-compliant \s-1XML\s0 which will be rejected if you try to read it back in. (A later version of \fBXML::Simple\fR might take a more proactive approach). .PP Note also that although you can nest hashes and arrays to arbitrary levels, circular data structures are not supported and will cause \f(CW\*(C`XMLout()\*(C'\fR to die. .PP If you wish to 'round\-trip' arbitrary data structures from Perl to \s-1XML\s0 and back to Perl, then you should probably disable array folding (using the KeyAttr option) both with \f(CW\*(C`XMLout()\*(C'\fR and with \f(CW\*(C`XMLin()\*(C'\fR. If you still don't get the expected results, you may prefer to use XML::Dumper which is designed for exactly that purpose. .PP Refer to \*(L"\s-1WHERE TO FROM HERE\s0?\*(R" if \f(CW\*(C`XMLout()\*(C'\fR is too simple for your needs. .SH "OPTIONS" .IX Header "OPTIONS" \&\fBXML::Simple\fR supports a number of options (in fact as each release of \&\fBXML::Simple\fR adds more options, the module's claim to the name 'Simple' becomes increasingly tenuous). If you find yourself repeatedly having to specify the same options, you might like to investigate \*(L"\s-1OPTIONAL OO INTERFACE\*(R"\s0 below. .PP If you can't be bothered reading the documentation, refer to \&\*(L"\s-1STRICT MODE\*(R"\s0 to automatically catch common mistakes. .PP Because there are so many options, it's hard for new users to know which ones are important, so here are the two you really need to know about: .IP "\(bu" 4 check out \f(CW\*(C`ForceArray\*(C'\fR because you'll almost certainly want to turn it on .IP "\(bu" 4 make sure you know what the \f(CW\*(C`KeyAttr\*(C'\fR option does and what its default value is because it may surprise you otherwise (note in particular that 'KeyAttr' affects both \f(CW\*(C`XMLin\*(C'\fR and \f(CW\*(C`XMLout\*(C'\fR) .PP The option name headings below have a trailing 'comment' \- a hash followed by two pieces of metadata: .IP "\(bu" 4 Options are marked with '\fIin\fR' if they are recognised by \f(CW\*(C`XMLin()\*(C'\fR and \&'\fIout\fR' if they are recognised by \f(CW\*(C`XMLout()\*(C'\fR. .IP "\(bu" 4 Each option is also flagged to indicate whether it is: .Sp .Vb 7 \& \*(Aqimportant\*(Aq \- don\*(Aqt use the module until you understand this one \& \*(Aqhandy\*(Aq \- you can skip this on the first time through \& \*(Aqadvanced\*(Aq \- you can skip this on the second time through \& \*(AqSAX only\*(Aq \- don\*(Aqt worry about this unless you\*(Aqre using SAX (or \& alternatively if you need this, you also need SAX) \& \*(Aqseldom used\*(Aq \- you\*(Aqll probably never use this unless you were the \& person that requested the feature .Ve .PP The options are listed alphabetically: .PP Note: option names are no longer case sensitive so you can use the mixed case versions shown here; all lower case as required by versions 2.03 and earlier; or you can add underscores between the words (eg: key_attr). .SS "AttrIndent => 1 \fI# out \- handy\fP" .IX Subsection "AttrIndent => 1 # out - handy" When you are using \f(CW\*(C`XMLout()\*(C'\fR, enable this option to have attributes printed one-per-line with sensible indentation rather than all on one line. .SS "Cache => [ cache schemes ] \fI# in \- advanced\fP" .IX Subsection "Cache => [ cache schemes ] # in - advanced" Because loading the \fBXML::Parser\fR module and parsing an \s-1XML\s0 file can consume a significant number of \s-1CPU\s0 cycles, it is often desirable to cache the output of \&\f(CW\*(C`XMLin()\*(C'\fR for later reuse. .PP When parsing from a named file, \fBXML::Simple\fR supports a number of caching schemes. The 'Cache' option may be used to specify one or more schemes (using an anonymous array). Each scheme will be tried in turn in the hope of finding a cached pre-parsed representation of the \s-1XML\s0 file. If no cached copy is found, the file will be parsed and the first cache scheme in the list will be used to save a copy of the results. The following cache schemes have been implemented: .IP "storable" 4 .IX Item "storable" Utilises \fBStorable.pm\fR to read/write a cache file with the same name as the \&\s-1XML\s0 file but with the extension .stor .IP "memshare" 4 .IX Item "memshare" When a file is first parsed, a copy of the resulting data structure is retained in memory in the \fBXML::Simple\fR module's namespace. Subsequent calls to parse the same file will return a reference to this structure. This cached version will persist only for the life of the Perl interpreter (which in the case of mod_perl for example, may be some significant time). .Sp Because each caller receives a reference to the same data structure, a change made by one caller will be visible to all. For this reason, the reference returned should be treated as read-only. .IP "memcopy" 4 .IX Item "memcopy" This scheme works identically to 'memshare' (above) except that each caller receives a reference to a new data structure which is a copy of the cached version. Copying the data structure will add a little processing overhead, therefore this scheme should only be used where the caller intends to modify the data structure (or wishes to protect itself from others who might). This scheme uses \fBStorable.pm\fR to perform the copy. .PP Warning! The memory-based caching schemes compare the timestamp on the file to the time when it was last parsed. If the file is stored on an \s-1NFS\s0 filesystem (or other network share) and the clock on the file server is not exactly synchronised with the clock where your script is run, updates to the source \s-1XML\s0 file may appear to be ignored. .SS "ContentKey => 'keyname' \fI# in+out \- seldom used\fP" .IX Subsection "ContentKey => 'keyname' # in+out - seldom used" When text content is parsed to a hash value, this option lets you specify a name for the hash key to override the default 'content'. So for example: .PP .Vb 1 \& XMLin(\*(AqText\*(Aq, ContentKey => \*(Aqtext\*(Aq) .Ve .PP will parse to: .PP .Vb 1 \& { \*(Aqone\*(Aq => 1, \*(Aqtext\*(Aq => \*(AqText\*(Aq } .Ve .PP instead of: .PP .Vb 1 \& { \*(Aqone\*(Aq => 1, \*(Aqcontent\*(Aq => \*(AqText\*(Aq } .Ve .PP \&\f(CW\*(C`XMLout()\*(C'\fR will also honour the value of this option when converting a hashref to \s-1XML.\s0 .PP You can also prefix your selected key name with a '\-' character to have \&\f(CW\*(C`XMLin()\*(C'\fR try a little harder to eliminate unnecessary 'content' keys after array folding. For example: .PP .Vb 6 \& XMLin( \& \*(AqFirstSecond\*(Aq, \& KeyAttr => {item => \*(Aqname\*(Aq}, \& ForceArray => [ \*(Aqitem\*(Aq ], \& ContentKey => \*(Aq\-content\*(Aq \& ) .Ve .PP will parse to: .PP .Vb 6 \& { \& \*(Aqitem\*(Aq => { \& \*(Aqone\*(Aq => \*(AqFirst\*(Aq \& \*(Aqtwo\*(Aq => \*(AqSecond\*(Aq \& } \& } .Ve .PP rather than this (without the '\-'): .PP .Vb 6 \& { \& \*(Aqitem\*(Aq => { \& \*(Aqone\*(Aq => { \*(Aqcontent\*(Aq => \*(AqFirst\*(Aq } \& \*(Aqtwo\*(Aq => { \*(Aqcontent\*(Aq => \*(AqSecond\*(Aq } \& } \& } .Ve .SS "DataHandler => code_ref \fI# in \- \s-1SAX\s0 only\fP" .IX Subsection "DataHandler => code_ref # in - SAX only" When you use an \fBXML::Simple\fR object as a \s-1SAX\s0 handler, it will return a \&'simple tree' data structure in the same format as \f(CW\*(C`XMLin()\*(C'\fR would return. If this option is set (to a subroutine reference), then when the tree is built the subroutine will be called and passed two arguments: a reference to the \&\fBXML::Simple\fR object and a reference to the data tree. The return value from the subroutine will be returned to the \s-1SAX\s0 driver. (See \*(L"\s-1SAX SUPPORT\*(R"\s0 for more details). .SS "ForceArray => 1 \fI# in \- important\fP" .IX Subsection "ForceArray => 1 # in - important" This option should be set to '1' to force nested elements to be represented as arrays even when there is only one. Eg, with ForceArray enabled, this \&\s-1XML:\s0 .PP .Vb 3 \& \& value \& .Ve .PP would parse to this: .PP .Vb 5 \& { \& \*(Aqname\*(Aq => [ \& \*(Aqvalue\*(Aq \& ] \& } .Ve .PP instead of this (the default): .PP .Vb 3 \& { \& \*(Aqname\*(Aq => \*(Aqvalue\*(Aq \& } .Ve .PP This option is especially useful if the data structure is likely to be written back out as \s-1XML\s0 and the default behaviour of rolling single nested elements up into attributes is not desirable. .PP If you are using the array folding feature, you should almost certainly enable this option. If you do not, single nested elements will not be parsed to arrays and therefore will not be candidates for folding to a hash. (Given that the default value of 'KeyAttr' enables array folding, the default value of this option should probably also have been enabled too \- sorry). .SS "ForceArray => [ names ] \fI# in \- important\fP" .IX Subsection "ForceArray => [ names ] # in - important" This alternative (and preferred) form of the 'ForceArray' option allows you to specify a list of element names which should always be forced into an array representation, rather than the 'all or nothing' approach above. .PP It is also possible (since version 2.05) to include compiled regular expressions in the list \- any element names which match the pattern will be forced to arrays. If the list contains only a single regex, then it is not necessary to enclose it in an arrayref. Eg: .PP .Vb 1 \& ForceArray => qr/_list$/ .Ve .SS "ForceContent => 1 \fI# in \- seldom used\fP" .IX Subsection "ForceContent => 1 # in - seldom used" When \f(CW\*(C`XMLin()\*(C'\fR parses elements which have text content as well as attributes, the text content must be represented as a hash value rather than a simple scalar. This option allows you to force text content to always parse to a hash value even when there are no attributes. So for example: .PP .Vb 1 \& XMLin(\*(Aqtext1text2\*(Aq, ForceContent => 1) .Ve .PP will parse to: .PP .Vb 4 \& { \& \*(Aqx\*(Aq => { \*(Aqcontent\*(Aq => \*(Aqtext1\*(Aq }, \& \*(Aqy\*(Aq => { \*(Aqa\*(Aq => 2, \*(Aqcontent\*(Aq => \*(Aqtext2\*(Aq } \& } .Ve .PP instead of: .PP .Vb 4 \& { \& \*(Aqx\*(Aq => \*(Aqtext1\*(Aq, \& \*(Aqy\*(Aq => { \*(Aqa\*(Aq => 2, \*(Aqcontent\*(Aq => \*(Aqtext2\*(Aq } \& } .Ve .SS "GroupTags => { grouping tag => grouped tag } \fI# in+out \- handy\fP" .IX Subsection "GroupTags => { grouping tag => grouped tag } # in+out - handy" You can use this option to eliminate extra levels of indirection in your Perl data structure. For example this \s-1XML:\s0 .PP .Vb 7 \& \& \& /usr/bin \& /usr/local/bin \& /usr/X11/bin \& \& .Ve .PP Would normally be read into a structure like this: .PP .Vb 5 \& { \& searchpath => { \& dir => [ \*(Aq/usr/bin\*(Aq, \*(Aq/usr/local/bin\*(Aq, \*(Aq/usr/X11/bin\*(Aq ] \& } \& } .Ve .PP But when read in with the appropriate value for 'GroupTags': .PP .Vb 1 \& my $opt = XMLin($xml, GroupTags => { searchpath => \*(Aqdir\*(Aq }); .Ve .PP It will return this simpler structure: .PP .Vb 3 \& { \& searchpath => [ \*(Aq/usr/bin\*(Aq, \*(Aq/usr/local/bin\*(Aq, \*(Aq/usr/X11/bin\*(Aq ] \& } .Ve .PP The grouping element (\f(CW\*(C`\*(C'\fR in the example) must not contain any attributes or elements other than the grouped element. .PP You can specify multiple 'grouping element' to 'grouped element' mappings in the same hashref. If this option is combined with \f(CW\*(C`KeyAttr\*(C'\fR, the array folding will occur first and then the grouped element names will be eliminated. .PP \&\f(CW\*(C`XMLout\*(C'\fR will also use the grouptag mappings to re-introduce the tags around the grouped elements. Beware though that this will occur in all places that the 'grouping tag' name occurs \- you probably don't want to use the same name for elements as well as attributes. .SS "Handler => object_ref \fI# out \- \s-1SAX\s0 only\fP" .IX Subsection "Handler => object_ref # out - SAX only" Use the 'Handler' option to have \f(CW\*(C`XMLout()\*(C'\fR generate \s-1SAX\s0 events rather than returning a string of \s-1XML. \s0 For more details see \*(L"\s-1SAX SUPPORT\*(R"\s0 below. .PP Note: the current implementation of this option generates a string of \s-1XML\s0 and uses a \s-1SAX\s0 parser to translate it into \s-1SAX\s0 events. The normal encoding rules apply here \- your data must be \s-1UTF8\s0 encoded unless you specify an alternative encoding via the 'XMLDecl' option; and by the time the data reaches the handler object, it will be in \s-1UTF8\s0 form regardless of the encoding you supply. A future implementation of this option may generate the events directly. .SS "KeepRoot => 1 \fI# in+out \- handy\fP" .IX Subsection "KeepRoot => 1 # in+out - handy" In its attempt to return a data structure free of superfluous detail and unnecessary levels of indirection, \f(CW\*(C`XMLin()\*(C'\fR normally discards the root element name. Setting the 'KeepRoot' option to '1' will cause the root element name to be retained. So after executing this code: .PP .Vb 1 \& $config = XMLin(\*(Aq\*(Aq, KeepRoot => 1) .Ve .PP You'll be able to reference the tempdir as \&\f(CW\*(C`$config\->{config}\->{tempdir}\*(C'\fR instead of the default \&\f(CW\*(C`$config\->{tempdir}\*(C'\fR. .PP Similarly, setting the 'KeepRoot' option to '1' will tell \f(CW\*(C`XMLout()\*(C'\fR that the data structure already contains a root element name and it is not necessary to add another. .SS "KeyAttr => [ list ] \fI# in+out \- important\fP" .IX Subsection "KeyAttr => [ list ] # in+out - important" This option controls the 'array folding' feature which translates nested elements from an array to a hash. It also controls the 'unfolding' of hashes to arrays. .PP For example, this \s-1XML:\s0 .PP .Vb 4 \& \& \& \& .Ve .PP would, by default, parse to this: .PP .Vb 12 \& { \& \*(Aquser\*(Aq => [ \& { \& \*(Aqlogin\*(Aq => \*(Aqgrep\*(Aq, \& \*(Aqfullname\*(Aq => \*(AqGary R Epstein\*(Aq \& }, \& { \& \*(Aqlogin\*(Aq => \*(Aqstty\*(Aq, \& \*(Aqfullname\*(Aq => \*(AqSimon T Tyson\*(Aq \& } \& ] \& } .Ve .PP If the option 'KeyAttr => \*(L"login\*(R"' were used to specify that the 'login' attribute is a key, the same \s-1XML\s0 would parse to: .PP .Vb 10 \& { \& \*(Aquser\*(Aq => { \& \*(Aqstty\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqSimon T Tyson\*(Aq \& }, \& \*(Aqgrep\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqGary R Epstein\*(Aq \& } \& } \& } .Ve .PP The key attribute names should be supplied in an arrayref if there is more than one. \f(CW\*(C`XMLin()\*(C'\fR will attempt to match attribute names in the order supplied. \f(CW\*(C`XMLout()\*(C'\fR will use the first attribute name supplied when \&'unfolding' a hash into an array. .PP Note 1: The default value for 'KeyAttr' is ['name', 'key', 'id']. If you do not want folding on input or unfolding on output you must set this option to an empty list to disable the feature. .PP Note 2: If you wish to use this option, you should also enable the \&\f(CW\*(C`ForceArray\*(C'\fR option. Without 'ForceArray', a single nested element will be rolled up into a scalar rather than an array and therefore will not be folded (since only arrays get folded). .SS "KeyAttr => { list } \fI# in+out \- important\fP" .IX Subsection "KeyAttr => { list } # in+out - important" This alternative (and preferred) method of specifying the key attributes allows more fine grained control over which elements are folded and on which attributes. For example the option 'KeyAttr => { package => 'id' } will cause any package elements to be folded on the 'id' attribute. No other elements which have an 'id' attribute will be folded at all. .PP Note: \f(CW\*(C`XMLin()\*(C'\fR will generate a warning (or a fatal error in \*(L"\s-1STRICT MODE\*(R"\s0) if this syntax is used and an element which does not have the specified key attribute is encountered (eg: a 'package' element without an 'id' attribute, to use the example above). Warnings can be suppressed with the lexical \&\f(CW\*(C`no warnings;\*(C'\fR pragma or \f(CW\*(C`no warnings \*(AqXML::Simple\*(Aq;\*(C'\fR. .PP Two further variations are made possible by prefixing a '+' or a '\-' character to the attribute name: .PP The option 'KeyAttr => { user => \*(L"+login\*(R" }' will cause this \s-1XML:\s0 .PP .Vb 4 \& \& \& \& .Ve .PP to parse to this data structure: .PP .Vb 12 \& { \& \*(Aquser\*(Aq => { \& \*(Aqstty\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqSimon T Tyson\*(Aq, \& \*(Aqlogin\*(Aq => \*(Aqstty\*(Aq \& }, \& \*(Aqgrep\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqGary R Epstein\*(Aq, \& \*(Aqlogin\*(Aq => \*(Aqgrep\*(Aq \& } \& } \& } .Ve .PP The '+' indicates that the value of the key attribute should be copied rather than moved to the folded hash key. .PP A '\-' prefix would produce this result: .PP .Vb 12 \& { \& \*(Aquser\*(Aq => { \& \*(Aqstty\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqSimon T Tyson\*(Aq, \& \*(Aq\-login\*(Aq => \*(Aqstty\*(Aq \& }, \& \*(Aqgrep\*(Aq => { \& \*(Aqfullname\*(Aq => \*(AqGary R Epstein\*(Aq, \& \*(Aq\-login\*(Aq => \*(Aqgrep\*(Aq \& } \& } \& } .Ve .PP As described earlier, \f(CW\*(C`XMLout\*(C'\fR will ignore hash keys starting with a '\-'. .SS "NoAttr => 1 \fI# in+out \- handy\fP" .IX Subsection "NoAttr => 1 # in+out - handy" When used with \f(CW\*(C`XMLout()\*(C'\fR, the generated \s-1XML\s0 will contain no attributes. All hash key/values will be represented as nested elements instead. .PP When used with \f(CW\*(C`XMLin()\*(C'\fR, any attributes in the \s-1XML\s0 will be ignored. .SS "NoEscape => 1 \fI# out \- seldom used\fP" .IX Subsection "NoEscape => 1 # out - seldom used" By default, \f(CW\*(C`XMLout()\*(C'\fR will translate the characters '<', '>', '&' and \&'"' to '<', '>', '&' and '"' respectively. Use this option to suppress escaping (presumably because you've already escaped the data in some more sophisticated manner). .SS "NoIndent => 1 \fI# out \- seldom used\fP" .IX Subsection "NoIndent => 1 # out - seldom used" Set this option to 1 to disable \f(CW\*(C`XMLout()\*(C'\fR's default 'pretty printing' mode. With this option enabled, the \s-1XML\s0 output will all be on one line (unless there are newlines in the data) \- this may be easier for downstream processing. .SS "NoSort => 1 \fI# out \- seldom used\fP" .IX Subsection "NoSort => 1 # out - seldom used" Newer versions of XML::Simple sort elements and attributes alphabetically (*), by default. Enable this option to suppress the sorting \- possibly for backwards compatibility. .PP * Actually, sorting is alphabetical but 'key' attribute or element names (as in \&'KeyAttr') sort first. Also, when a hash of hashes is 'unfolded', the elements are sorted alphabetically by the value of the key field. .SS "NormaliseSpace => 0 | 1 | 2 \fI# in \- handy\fP" .IX Subsection "NormaliseSpace => 0 | 1 | 2 # in - handy" This option controls how whitespace in text content is handled. Recognised values for the option are: .IP "\(bu" 4 0 = (default) whitespace is passed through unaltered (except of course for the normalisation of whitespace in attribute values which is mandated by the \s-1XML\s0 recommendation) .IP "\(bu" 4 1 = whitespace is normalised in any value used as a hash key (normalising means removing leading and trailing whitespace and collapsing sequences of whitespace characters to a single space) .IP "\(bu" 4 2 = whitespace is normalised in all text content .PP Note: you can spell this option with a 'z' if that is more natural for you. .SS "NSExpand => 1 \fI# in+out handy \- \s-1SAX\s0 only\fP" .IX Subsection "NSExpand => 1 # in+out handy - SAX only" This option controls namespace expansion \- the translation of element and attribute names of the form 'prefix:name' to '{uri}name'. For example the element name 'xsl:template' might be expanded to: \&'{http://www.w3.org/1999/XSL/Transform}template'. .PP By default, \f(CW\*(C`XMLin()\*(C'\fR will return element names and attribute names exactly as they appear in the \s-1XML. \s0 Setting this option to 1 will cause all element and attribute names to be expanded to include their namespace prefix. .PP \&\fINote: You must be using a \s-1SAX\s0 parser for this option to work (ie: it does not work with XML::Parser)\fR. .PP This option also controls whether \f(CW\*(C`XMLout()\*(C'\fR performs the reverse translation from '{uri}name' back to 'prefix:name'. The default is no translation. If your data contains expanded names, you should set this option to 1 otherwise \&\f(CW\*(C`XMLout\*(C'\fR will emit \s-1XML\s0 which is not well formed. .PP \&\fINote: You must have the XML::NamespaceSupport module installed if you want \&\f(CI\*(C`XMLout()\*(C'\fI to translate URIs back to prefixes\fR. .SS "NumericEscape => 0 | 1 | 2 \fI# out \- handy\fP" .IX Subsection "NumericEscape => 0 | 1 | 2 # out - handy" Use this option to have 'high' (non-ASCII) characters in your Perl data structure converted to numeric entities (eg: €) in the \s-1XML\s0 output. Three levels are possible: .PP 0 \- default: no numeric escaping (\s-1OK\s0 if you're writing out \s-1UTF8\s0) .PP 1 \- only characters above 0xFF are escaped (ie: characters in the 0x80\-FF range are not escaped), possibly useful with \s-1ISO8859\-1\s0 output .PP 2 \- all characters above 0x7F are escaped (good for plain \s-1ASCII\s0 output) .SS "OutputFile => \fI# out \- handy\fP" .IX Subsection "OutputFile => # out - handy" The default behaviour of \f(CW\*(C`XMLout()\*(C'\fR is to return the \s-1XML\s0 as a string. If you wish to write the \s-1XML\s0 to a file, simply supply the filename using the \&'OutputFile' option. .PP This option also accepts an \s-1IO\s0 handle object \- especially useful in Perl 5.8.0 and later for output using an encoding other than \s-1UTF\-8,\s0 eg: .PP .Vb 2 \& open my $fh, \*(Aq>:encoding(iso\-8859\-1)\*(Aq, $path or die "open($path): $!"; \& XMLout($ref, OutputFile => $fh); .Ve .PP Note, XML::Simple does not require that the object you pass in to the OutputFile option inherits from IO::Handle \- it simply assumes the object supports a \f(CW\*(C`print\*(C'\fR method. .SS "ParserOpts => [ XML::Parser Options ] \fI# in \- don't use this\fP" .IX Subsection "ParserOpts => [ XML::Parser Options ] # in - don't use this" \&\fINote: This option is now officially deprecated. If you find it useful, email the author with an example of what you use it for. Do not use this option to set the ProtocolEncoding, that's just plain wrong \- fix the \s-1XML\s0\fR. .PP This option allows you to pass parameters to the constructor of the underlying XML::Parser object (which of course assumes you're not using \s-1SAX\s0). .SS "RootName => 'string' \fI# out \- handy\fP" .IX Subsection "RootName => 'string' # out - handy" By default, when \f(CW\*(C`XMLout()\*(C'\fR generates \s-1XML,\s0 the root element will be named \&'opt'. This option allows you to specify an alternative name. .PP Specifying either undef or the empty string for the RootName option will produce \s-1XML\s0 with no root elements. In most cases the resulting \s-1XML\s0 fragment will not be 'well formed' and therefore could not be read back in by \f(CW\*(C`XMLin()\*(C'\fR. Nevertheless, the option has been found to be useful in certain circumstances. .SS "SearchPath => [ list ] \fI# in \- handy\fP" .IX Subsection "SearchPath => [ list ] # in - handy" If you pass \f(CW\*(C`XMLin()\*(C'\fR a filename, but the filename include no directory component, you can use this option to specify which directories should be searched to locate the file. You might use this option to search first in the user's home directory, then in a global directory such as /etc. .PP If a filename is provided to \f(CW\*(C`XMLin()\*(C'\fR but SearchPath is not defined, the file is assumed to be in the current directory. .PP If the first parameter to \f(CW\*(C`XMLin()\*(C'\fR is undefined, the default SearchPath will contain only the directory in which the script itself is located. Otherwise the default SearchPath will be empty. .SS "StrictMode => 1 | 0 \fI# in+out seldom used\fP" .IX Subsection "StrictMode => 1 | 0 # in+out seldom used" This option allows you to turn \*(L"\s-1STRICT MODE\*(R"\s0 on or off for a particular call, regardless of whether it was enabled at the time XML::Simple was loaded. .SS "SuppressEmpty => 1 | '' | undef \fI# in+out \- handy\fP" .IX Subsection "SuppressEmpty => 1 | '' | undef # in+out - handy" This option controls what \f(CW\*(C`XMLin()\*(C'\fR should do with empty elements (no attributes and no content). The default behaviour is to represent them as empty hashes. Setting this option to a true value (eg: 1) will cause empty elements to be skipped altogether. Setting the option to 'undef' or the empty string will cause empty elements to be represented as the undefined value or the empty string respectively. The latter two alternatives are a little easier to test for in your code than a hash with no keys. .PP The option also controls what \f(CW\*(C`XMLout()\*(C'\fR does with undefined values. Setting the option to undef causes undefined values to be output as empty elements (rather than empty attributes), it also suppresses the generation of warnings about undefined values. Setting the option to a true value (eg: 1) causes undefined values to be skipped altogether on output. .SS "ValueAttr => [ names ] \fI# in \- handy\fP" .IX Subsection "ValueAttr => [ names ] # in - handy" Use this option to deal elements which always have a single attribute and no content. Eg: .PP .Vb 4 \& \& \& \& .Ve .PP Setting \f(CW\*(C`ValueAttr => [ \*(Aqvalue\*(Aq ]\*(C'\fR will cause the above \s-1XML\s0 to parse to: .PP .Vb 4 \& { \& colour => \*(Aqred\*(Aq, \& size => \*(AqXXL\*(Aq \& } .Ve .PP instead of this (the default): .PP .Vb 4 \& { \& colour => { value => \*(Aqred\*(Aq }, \& size => { value => \*(AqXXL\*(Aq } \& } .Ve .PP Note: This form of the ValueAttr option is not compatible with \f(CW\*(C`XMLout()\*(C'\fR \- since the attribute name is discarded at parse time, the original \s-1XML\s0 cannot be reconstructed. .SS "ValueAttr => { element => attribute, ... } \fI# in+out \- handy\fP" .IX Subsection "ValueAttr => { element => attribute, ... } # in+out - handy" This (preferred) form of the ValueAttr option requires you to specify both the element and the attribute names. This is not only safer, it also allows the original \s-1XML\s0 to be reconstructed by \f(CW\*(C`XMLout()\*(C'\fR. .PP Note: You probably don't want to use this option and the NoAttr option at the same time. .SS "Variables => { name => value } \fI# in \- handy\fP" .IX Subsection "Variables => { name => value } # in - handy" This option allows variables in the \s-1XML\s0 to be expanded when the file is read. (there is no facility for putting the variable names back if you regenerate \&\s-1XML\s0 using \f(CW\*(C`XMLout\*(C'\fR). .PP A 'variable' is any text of the form \f(CW\*(C`${name}\*(C'\fR which occurs in an attribute value or in the text content of an element. If 'name' matches a key in the supplied hashref, \f(CW\*(C`${name}\*(C'\fR will be replaced with the corresponding value from the hashref. If no matching key is found, the variable will not be replaced. Names must match the regex: \f(CW\*(C`[\ew.]+\*(C'\fR (ie: only 'word' characters and dots are allowed). .SS "VarAttr => 'attr_name' \fI# in \- handy\fP" .IX Subsection "VarAttr => 'attr_name' # in - handy" In addition to the variables defined using \f(CW\*(C`Variables\*(C'\fR, this option allows variables to be defined in the \s-1XML. A\s0 variable definition consists of an element with an attribute called 'attr_name' (the value of the \f(CW\*(C`VarAttr\*(C'\fR option). The value of the attribute will be used as the variable name and the text content of the element will be used as the value. A variable defined in this way will override a variable defined using the \f(CW\*(C`Variables\*(C'\fR option. For example: .PP .Vb 7 \& XMLin( \*(Aq \& /usr/local/apache \& ${prefix} \& ${exec_prefix}/bin \& \*(Aq, \& VarAttr => \*(Aqname\*(Aq, ContentKey => \*(Aq\-content\*(Aq \& ); .Ve .PP produces the following data structure: .PP .Vb 7 \& { \& dir => { \& prefix => \*(Aq/usr/local/apache\*(Aq, \& exec_prefix => \*(Aq/usr/local/apache\*(Aq, \& bindir => \*(Aq/usr/local/apache/bin\*(Aq, \& } \& } .Ve .SS "XMLDecl => 1 or XMLDecl => 'string' \fI# out \- handy\fP" .IX Subsection "XMLDecl => 1 or XMLDecl => 'string' # out - handy" If you want the output from \f(CW\*(C`XMLout()\*(C'\fR to start with the optional \s-1XML\s0 declaration, simply set the option to '1'. The default \s-1XML\s0 declaration is: .PP .Vb 1 \& .Ve .PP If you want some other string (for example to declare an encoding value), set the value of this option to the complete string you require. .SH "OPTIONAL OO INTERFACE" .IX Header "OPTIONAL OO INTERFACE" The procedural interface is both simple and convenient however there are a couple of reasons why you might prefer to use the object oriented (\s-1OO\s0) interface: .IP "\(bu" 4 to define a set of default values which should be used on all subsequent calls to \f(CW\*(C`XMLin()\*(C'\fR or \f(CW\*(C`XMLout()\*(C'\fR .IP "\(bu" 4 to override methods in \fBXML::Simple\fR to provide customised behaviour .PP The default values for the options described above are unlikely to suit everyone. The \s-1OO\s0 interface allows you to effectively override \fBXML::Simple\fR's defaults with your preferred values. It works like this: .PP First create an XML::Simple parser object with your preferred defaults: .PP .Vb 1 \& my $xs = XML::Simple\->new(ForceArray => 1, KeepRoot => 1); .Ve .PP then call \f(CW\*(C`XMLin()\*(C'\fR or \f(CW\*(C`XMLout()\*(C'\fR as a method of that object: .PP .Vb 2 \& my $ref = $xs\->XMLin($xml); \& my $xml = $xs\->XMLout($ref); .Ve .PP You can also specify options when you make the method calls and these values will be merged with the values specified when the object was created. Values specified in a method call take precedence. .PP Note: when called as methods, the \f(CW\*(C`XMLin()\*(C'\fR and \f(CW\*(C`XMLout()\*(C'\fR routines may be called as \f(CW\*(C`xml_in()\*(C'\fR or \f(CW\*(C`xml_out()\*(C'\fR. The method names are aliased so the only difference is the aesthetics. .SS "Parsing Methods" .IX Subsection "Parsing Methods" You can explicitly call one of the following methods rather than rely on the \&\f(CW\*(C`xml_in()\*(C'\fR method automatically determining whether the target to be parsed is a string, a file or a filehandle: .IP "parse_string(text)" 4 .IX Item "parse_string(text)" Works exactly like the \f(CW\*(C`xml_in()\*(C'\fR method but assumes the first argument is a string of \s-1XML \s0(or a reference to a scalar containing a string of \s-1XML\s0). .IP "parse_file(filename)" 4 .IX Item "parse_file(filename)" Works exactly like the \f(CW\*(C`xml_in()\*(C'\fR method but assumes the first argument is the name of a file containing \s-1XML.\s0 .IP "parse_fh(file_handle)" 4 .IX Item "parse_fh(file_handle)" Works exactly like the \f(CW\*(C`xml_in()\*(C'\fR method but assumes the first argument is a filehandle which can be read to get \s-1XML.\s0 .SS "Hook Methods" .IX Subsection "Hook Methods" You can make your own class which inherits from XML::Simple and overrides certain behaviours. The following methods may provide useful 'hooks' upon which to hang your modified behaviour. You may find other undocumented methods by examining the source, but those may be subject to change in future releases. .IP "handle_options(direction, name => value ...)" 4 .IX Item "handle_options(direction, name => value ...)" This method will be called when one of the parsing methods or the \f(CW\*(C`XMLout()\*(C'\fR method is called. The initial argument will be a string (either 'in' or 'out') and the remaining arguments will be name value pairs. .IP "\fIdefault_config_file()\fR" 4 .IX Item "default_config_file()" Calculates and returns the name of the file which should be parsed if no filename is passed to \f(CW\*(C`XMLin()\*(C'\fR (default: \f(CW\*(C`$0.xml\*(C'\fR). .IP "build_simple_tree(filename, string)" 4 .IX Item "build_simple_tree(filename, string)" Called from \f(CW\*(C`XMLin()\*(C'\fR or any of the parsing methods. Takes either a file name as the first argument or \f(CW\*(C`undef\*(C'\fR followed by a 'string' as the second argument. Returns a simple tree data structure. You could override this method to apply your own transformations before the data structure is returned to the caller. .IP "\fInew_hashref()\fR" 4 .IX Item "new_hashref()" When the 'simple tree' data structure is being built, this method will be called to create any required anonymous hashrefs. .IP "sorted_keys(name, hashref)" 4 .IX Item "sorted_keys(name, hashref)" Called when \f(CW\*(C`XMLout()\*(C'\fR is translating a hashref to \s-1XML. \s0 This routine returns a list of hash keys in the order that the corresponding attributes/elements should appear in the output. .IP "escape_value(string)" 4 .IX Item "escape_value(string)" Called from \f(CW\*(C`XMLout()\*(C'\fR, takes a string and returns a copy of the string with \&\s-1XML\s0 character escaping rules applied. .IP "escape_attr(string)" 4 .IX Item "escape_attr(string)" Called from \f(CW\*(C`XMLout()\*(C'\fR, to handle attribute values. By default, just calls \&\f(CW\*(C`escape_value()\*(C'\fR, but you can override this method if you want attributes escaped differently than text content. .IP "numeric_escape(string)" 4 .IX Item "numeric_escape(string)" Called from \f(CW\*(C`escape_value()\*(C'\fR, to handle non-ASCII characters (depending on the value of the NumericEscape option). .IP "copy_hash(hashref, extra_key => value, ...)" 4 .IX Item "copy_hash(hashref, extra_key => value, ...)" Called from \f(CW\*(C`XMLout()\*(C'\fR, when 'unfolding' a hash of hashes into an array of hashes. You might wish to override this method if you're using tied hashes and don't want them to get untied. .SS "Cache Methods" .IX Subsection "Cache Methods" XML::Simple implements three caching schemes ('storable', 'memshare' and \&'memcopy'). You can implement a custom caching scheme by implementing two methods \- one for reading from the cache and one for writing to it. .PP For example, you might implement a new 'dbm' scheme that stores cached data structures using the \s-1MLDBM\s0 module. First, you would add a \&\f(CW\*(C`cache_read_dbm()\*(C'\fR method which accepted a filename for use as a lookup key and returned a data structure on success, or undef on failure. Then, you would implement a \f(CW\*(C`cache_read_dbm()\*(C'\fR method which accepted a data structure and a filename. .PP You would use this caching scheme by specifying the option: .PP .Vb 1 \& Cache => [ \*(Aqdbm\*(Aq ] .Ve .SH "STRICT MODE" .IX Header "STRICT MODE" If you import the \fBXML::Simple\fR routines like this: .PP .Vb 1 \& use XML::Simple qw(:strict); .Ve .PP the following common mistakes will be detected and treated as fatal errors .IP "\(bu" 4 Failing to explicitly set the \f(CW\*(C`KeyAttr\*(C'\fR option \- if you can't be bothered reading about this option, turn it off with: KeyAttr => [ ] .IP "\(bu" 4 Failing to explicitly set the \f(CW\*(C`ForceArray\*(C'\fR option \- if you can't be bothered reading about this option, set it to the safest mode with: ForceArray => 1 .IP "\(bu" 4 Setting ForceArray to an array, but failing to list all the elements from the KeyAttr hash. .IP "\(bu" 4 Data error \- KeyAttr is set to say { part => 'partnum' } but the \s-1XML\s0 contains one or more elements without a 'partnum' attribute (or nested element). Note: if strict mode is not set but \f(CW\*(C`use warnings;\*(C'\fR is in force, this condition triggers a warning. .IP "\(bu" 4 Data error \- as above, but non-unique values are present in the key attribute (eg: more than one element with the same partnum). This will also trigger a warning if strict mode is not enabled. .IP "\(bu" 4 Data error \- as above, but value of key attribute (eg: partnum) is not a scalar string (due to nested elements etc). This will also trigger a warning if strict mode is not enabled. .SH "SAX SUPPORT" .IX Header "SAX SUPPORT" From version 1.08_01, \fBXML::Simple\fR includes support for \s-1SAX \s0(the Simple \s-1API\s0 for \s-1XML\s0) \- specifically \s-1SAX2.\s0 .PP In a typical \s-1SAX\s0 application, an \s-1XML\s0 parser (or \s-1SAX \s0'driver') module generates \&\s-1SAX\s0 events (start of element, character data, end of element, etc) as it parses an \s-1XML\s0 document and a 'handler' module processes the events to extract the required data. This simple model allows for some interesting and powerful possibilities: .IP "\(bu" 4 Applications written to the \s-1SAX API\s0 can extract data from huge \s-1XML\s0 documents without the memory overheads of a \s-1DOM\s0 or tree \s-1API.\s0 .IP "\(bu" 4 The \s-1SAX API\s0 allows for plug and play interchange of parser modules without having to change your code to fit a new module's \s-1API. A\s0 number of \s-1SAX\s0 parsers are available with capabilities ranging from extreme portability to blazing performance. .IP "\(bu" 4 A \s-1SAX \s0'filter' module can implement both a handler interface for receiving data and a generator interface for passing modified data on to a downstream handler. Filters can be chained together in 'pipelines'. .IP "\(bu" 4 One filter module might split a data stream to direct data to two or more downstream handlers. .IP "\(bu" 4 Generating \s-1SAX\s0 events is not the exclusive preserve of \s-1XML\s0 parsing modules. For example, a module might extract data from a relational database using \s-1DBI\s0 and pass it on to a \s-1SAX\s0 pipeline for filtering and formatting. .PP \&\fBXML::Simple\fR can operate at either end of a \s-1SAX\s0 pipeline. For example, you can take a data structure in the form of a hashref and pass it into a \&\s-1SAX\s0 pipeline using the 'Handler' option on \f(CW\*(C`XMLout()\*(C'\fR: .PP .Vb 3 \& use XML::Simple; \& use Some::SAX::Filter; \& use XML::SAX::Writer; \& \& my $ref = { \& .... # your data here \& }; \& \& my $writer = XML::SAX::Writer\->new(); \& my $filter = Some::SAX::Filter\->new(Handler => $writer); \& my $simple = XML::Simple\->new(Handler => $filter); \& $simple\->XMLout($ref); .Ve .PP You can also put \fBXML::Simple\fR at the opposite end of the pipeline to take advantage of the simple 'tree' data structure once the relevant data has been isolated through filtering: .PP .Vb 3 \& use XML::SAX; \& use Some::SAX::Filter; \& use XML::Simple; \& \& my $simple = XML::Simple\->new(ForceArray => 1, KeyAttr => [\*(Aqpartnum\*(Aq]); \& my $filter = Some::SAX::Filter\->new(Handler => $simple); \& my $parser = XML::SAX::ParserFactory\->parser(Handler => $filter); \& \& my $ref = $parser\->parse_uri(\*(Aqsome_huge_file.xml\*(Aq); \& \& print $ref\->{part}\->{\*(Aq555\-1234\*(Aq}; .Ve .PP You can build a filter by using an XML::Simple object as a handler and setting its DataHandler option to point to a routine which takes the resulting tree, modifies it and sends it off as \s-1SAX\s0 events to a downstream handler: .PP .Vb 5 \& my $writer = XML::SAX::Writer\->new(); \& my $filter = XML::Simple\->new( \& DataHandler => sub { \& my $simple = shift; \& my $data = shift; \& \& # Modify $data here \& \& $simple\->XMLout($data, Handler => $writer); \& } \& ); \& my $parser = XML::SAX::ParserFactory\->parser(Handler => $filter); \& \& $parser\->parse_uri($filename); .Ve .PP \&\fINote: In this last example, the 'Handler' option was specified in the call to \&\f(CI\*(C`XMLout()\*(C'\fI but it could also have been specified in the constructor\fR. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" If you don't care which parser module \fBXML::Simple\fR uses then skip this section entirely (it looks more complicated than it really is). .PP \&\fBXML::Simple\fR will default to using a \fB\s-1SAX\s0\fR parser if one is available or \&\fBXML::Parser\fR if \s-1SAX\s0 is not available. .PP You can dictate which parser module is used by setting either the environment variable '\s-1XML_SIMPLE_PREFERRED_PARSER\s0' or the package variable \&\f(CW$XML::Simple::PREFERRED_PARSER\fR to contain the module name. The following rules are used: .IP "\(bu" 4 The package variable takes precedence over the environment variable if both are defined. To force \fBXML::Simple\fR to ignore the environment settings and use its default rules, you can set the package variable to an empty string. .IP "\(bu" 4 If the 'preferred parser' is set to the string 'XML::Parser', then XML::Parser will be used (or \f(CW\*(C`XMLin()\*(C'\fR will die if XML::Parser is not installed). .IP "\(bu" 4 If the 'preferred parser' is set to some other value, then it is assumed to be the name of a \s-1SAX\s0 parser module and is passed to XML::SAX::ParserFactory. If \s-1XML::SAX\s0 is not installed, or the requested parser module is not installed, then \f(CW\*(C`XMLin()\*(C'\fR will die. .IP "\(bu" 4 If the 'preferred parser' is not defined at all (the normal default state), an attempt will be made to load \s-1XML::SAX\s0. If \s-1XML::SAX\s0 is installed, then a parser module will be selected according to XML::SAX::ParserFactory's normal rules (which typically means the last \s-1SAX\s0 parser installed). .IP "\(bu" 4 if the 'preferred parser' is not defined and \fB\s-1XML::SAX\s0\fR is not installed, then \fBXML::Parser\fR will be used. \f(CW\*(C`XMLin()\*(C'\fR will die if XML::Parser is not installed. .PP Note: The \fB\s-1XML::SAX\s0\fR distribution includes an \s-1XML\s0 parser written entirely in Perl. It is very portable but it is not very fast. You should consider installing XML::LibXML or XML::SAX::Expat if they are available for your platform. .SH "ERROR HANDLING" .IX Header "ERROR HANDLING" The \s-1XML\s0 standard is very clear on the issue of non-compliant documents. An error in parsing any single element (for example a missing end tag) must cause the whole document to be rejected. \fBXML::Simple\fR will die with an appropriate message if it encounters a parsing error. .PP If dying is not appropriate for your application, you should arrange to call \&\f(CW\*(C`XMLin()\*(C'\fR in an eval block and look for errors in $@. eg: .PP .Vb 2 \& my $config = eval { XMLin() }; \& PopUpMessage($@) if($@); .Ve .PP Note, there is a common misconception that use of \fBeval\fR will significantly slow down a script. While that may be true when the code being eval'd is in a string, it is not true of code like the sample above. .SH "EXAMPLES" .IX Header "EXAMPLES" When \f(CW\*(C`XMLin()\*(C'\fR reads the following very simple piece of \s-1XML:\s0 .PP .Vb 1 \& .Ve .PP it returns the following data structure: .PP .Vb 4 \& { \& \*(Aqusername\*(Aq => \*(Aqtestuser\*(Aq, \& \*(Aqpassword\*(Aq => \*(Aqfrodo\*(Aq \& } .Ve .PP The identical result could have been produced with this alternative \s-1XML:\s0 .PP .Vb 1 \& .Ve .PP Or this (although see 'ForceArray' option for variations): .PP .Vb 4 \& \& testuser \& frodo \& .Ve .PP Repeated nested elements are represented as anonymous arrays: .PP .Vb 9 \& \& \& joe@smith.com \& jsmith@yahoo.com \& \& \& bob@smith.com \& \& \& \& { \& \*(Aqperson\*(Aq => [ \& { \& \*(Aqemail\*(Aq => [ \& \*(Aqjoe@smith.com\*(Aq, \& \*(Aqjsmith@yahoo.com\*(Aq \& ], \& \*(Aqfirstname\*(Aq => \*(AqJoe\*(Aq, \& \*(Aqlastname\*(Aq => \*(AqSmith\*(Aq \& }, \& { \& \*(Aqemail\*(Aq => \*(Aqbob@smith.com\*(Aq, \& \*(Aqfirstname\*(Aq => \*(AqBob\*(Aq, \& \*(Aqlastname\*(Aq => \*(AqSmith\*(Aq \& } \& ] \& } .Ve .PP Nested elements with a recognised key attribute are transformed (folded) from an array into a hash keyed on the value of that attribute (see the \f(CW\*(C`KeyAttr\*(C'\fR option): .PP .Vb 5 \& \& \& \& \& \& \& { \& \*(Aqperson\*(Aq => { \& \*(Aqjbloggs\*(Aq => { \& \*(Aqfirstname\*(Aq => \*(AqJoe\*(Aq, \& \*(Aqlastname\*(Aq => \*(AqBloggs\*(Aq \& }, \& \*(Aqtsmith\*(Aq => { \& \*(Aqfirstname\*(Aq => \*(AqTom\*(Aq, \& \*(Aqlastname\*(Aq => \*(AqSmith\*(Aq \& }, \& \*(Aqjsmith\*(Aq => { \& \*(Aqfirstname\*(Aq => \*(AqJoe\*(Aq, \& \*(Aqlastname\*(Aq => \*(AqSmith\*(Aq \& } \& } \& } .Ve .PP The tag can be used to form anonymous arrays: .PP .Vb 6 \& \& Col 1Col 2Col 3 \& R1C1R1C2R1C3 \& R2C1R2C2R2C3 \& R3C1R3C2R3C3 \& \& \& { \& \*(Aqhead\*(Aq => [ \& [ \*(AqCol 1\*(Aq, \*(AqCol 2\*(Aq, \*(AqCol 3\*(Aq ] \& ], \& \*(Aqdata\*(Aq => [ \& [ \*(AqR1C1\*(Aq, \*(AqR1C2\*(Aq, \*(AqR1C3\*(Aq ], \& [ \*(AqR2C1\*(Aq, \*(AqR2C2\*(Aq, \*(AqR2C3\*(Aq ], \& [ \*(AqR3C1\*(Aq, \*(AqR3C2\*(Aq, \*(AqR3C3\*(Aq ] \& ] \& } .Ve .PP Anonymous arrays can be nested to arbitrary levels and as a special case, if the surrounding tags for an \s-1XML\s0 document contain only an anonymous array the arrayref will be returned directly rather than the usual hashref: .PP .Vb 5 \& \& Col 1Col 2 \& R1C1R1C2 \& R2C1R2C2 \& \& \& [ \& [ \*(AqCol 1\*(Aq, \*(AqCol 2\*(Aq ], \& [ \*(AqR1C1\*(Aq, \*(AqR1C2\*(Aq ], \& [ \*(AqR2C1\*(Aq, \*(AqR2C2\*(Aq ] \& ] .Ve .PP Elements which only contain text content will simply be represented as a scalar. Where an element has both attributes and text content, the element will be represented as a hashref with the text content in the 'content' key (see the \f(CW\*(C`ContentKey\*(C'\fR option): .PP .Vb 4 \& \& first \& second \& \& \& { \& \*(Aqone\*(Aq => \*(Aqfirst\*(Aq, \& \*(Aqtwo\*(Aq => { \*(Aqattr\*(Aq => \*(Aqvalue\*(Aq, \*(Aqcontent\*(Aq => \*(Aqsecond\*(Aq } \& } .Ve .PP Mixed content (elements which contain both text content and nested elements) will be not be represented in a useful way \- element order and significant whitespace will be lost. If you need to work with mixed content, then XML::Simple is not the right tool for your job \- check out the next section. .SH "WHERE TO FROM HERE?" .IX Header "WHERE TO FROM HERE?" \&\fBXML::Simple\fR is able to present a simple \s-1API\s0 because it makes some assumptions on your behalf. These include: .IP "\(bu" 4 You're not interested in text content consisting only of whitespace .IP "\(bu" 4 You don't mind that when things get slurped into a hash the order is lost .IP "\(bu" 4 You don't want fine-grained control of the formatting of generated \s-1XML\s0 .IP "\(bu" 4 You would never use a hash key that was not a legal \s-1XML\s0 element name .IP "\(bu" 4 You don't need help converting between different encodings .PP In a serious \s-1XML\s0 project, you'll probably outgrow these assumptions fairly quickly. This section of the document used to offer some advice on choosing a more powerful option. That advice has now grown into the 'Perl\-XML \s-1FAQ\s0' document which you can find at: .PP The advice in the \s-1FAQ\s0 boils down to a quick explanation of tree versus event based parsers and then recommends: .PP For event based parsing, use \s-1SAX \s0(do not set out to write any new code for XML::Parser's handler \s-1API \-\s0 it is obsolete). .PP For tree-based parsing, you could choose between the 'Perlish' approach of XML::Twig and more standards based \s-1DOM\s0 implementations \- preferably one with XPath support such as XML::LibXML. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBXML::Simple\fR requires either XML::Parser or \s-1XML::SAX\s0. .PP To generate documents with namespaces, XML::NamespaceSupport is required. .PP The optional caching functions require Storable. .PP Answers to Frequently Asked Questions about XML::Simple are bundled with this distribution as: XML::Simple::FAQ .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 1999\-2004 Grant McLean .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.