DateTime-Format-Builder-0.83/0000755000175000017500000000000013714034170015612 5ustar autarchautarchDateTime-Format-Builder-0.83/Makefile.PL0000644000175000017500000000325013714034170017564 0ustar autarchautarch# This Makefile.PL for DateTime-Format-Builder was generated by # Dist::Zilla::Plugin::DROLSKY::MakeMaker 1.09 # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.48. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Create DateTime parser classes and objects.", "AUTHOR" => "Dave Rolsky , Iain Truskett ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "DateTime-Format-Builder", "LICENSE" => "artistic_2", "NAME" => "DateTime::Format::Builder", "PREREQ_PM" => { "Carp" => 0, "DateTime" => "1.00", "DateTime::Format::Strptime" => "1.04", "Params::Validate" => "0.72", "Scalar::Util" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.96", "lib" => 0 }, "VERSION" => "0.83", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "DateTime" => "1.00", "DateTime::Format::Strptime" => "1.04", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Params::Validate" => "0.72", "Scalar::Util" => 0, "Test::More" => "0.96", "lib" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); DateTime-Format-Builder-0.83/META.yml0000644000175000017500000005575513714034170017104 0ustar autarchautarch--- abstract: 'Create DateTime parser classes and objects.' author: - 'Dave Rolsky ' - 'Iain Truskett ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::More: '0.96' lib: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: DateTime-Format-Builder provides: DateTime::Format::Builder: file: lib/DateTime/Format/Builder.pm version: '0.83' DateTime::Format::Builder::Parser: file: lib/DateTime/Format/Builder/Parser.pm version: '0.83' DateTime::Format::Builder::Parser::Dispatch: file: lib/DateTime/Format/Builder/Parser/Dispatch.pm version: '0.83' DateTime::Format::Builder::Parser::Quick: file: lib/DateTime/Format/Builder/Parser/Quick.pm version: '0.83' DateTime::Format::Builder::Parser::Regex: file: lib/DateTime/Format/Builder/Parser/Regex.pm version: '0.83' DateTime::Format::Builder::Parser::Strptime: file: lib/DateTime/Format/Builder/Parser/Strptime.pm version: '0.83' DateTime::Format::Builder::Parser::generic: file: lib/DateTime/Format/Builder/Parser/generic.pm version: '0.83' requires: Carp: '0' DateTime: '1.00' DateTime::Format::Strptime: '1.04' Params::Validate: '0.72' Scalar::Util: '0' parent: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/houseabsolute/DateTime-Format-Builder/issues homepage: https://metacpan.org/release/DateTime-Format-Builder repository: git://github.com/houseabsolute/DateTime-Format-Builder.git version: '0.83' x_Dist_Zilla: perl: version: '5.030001' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - LICENSE - Makefile.PL - README.md - cpanfile exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@DROLSKY/Git::GatherDir' version: '2.046' - class: Dist::Zilla::Plugin::ManifestSkip name: '@DROLSKY/ManifestSkip' version: '6.015' - class: Dist::Zilla::Plugin::License name: '@DROLSKY/License' version: '6.015' - class: Dist::Zilla::Plugin::ExecDir name: '@DROLSKY/ExecDir' version: '6.015' - class: Dist::Zilla::Plugin::ShareDir name: '@DROLSKY/ShareDir' version: '6.015' - class: Dist::Zilla::Plugin::Manifest name: '@DROLSKY/Manifest' version: '6.015' - class: Dist::Zilla::Plugin::CheckVersionIncrement name: '@DROLSKY/CheckVersionIncrement' version: '0.121750' - class: Dist::Zilla::Plugin::TestRelease name: '@DROLSKY/TestRelease' version: '6.015' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DROLSKY/ConfirmRelease' version: '6.015' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DROLSKY/UploadToCPAN' version: '6.015' - class: Dist::Zilla::Plugin::VersionFromMainModule config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/VersionFromMainModule' version: '0.04' - class: Dist::Zilla::Plugin::Authority name: '@DROLSKY/Authority' version: '1.009' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@DROLSKY/AutoPrereqs' version: '6.015' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@DROLSKY/CopyFilesFromBuild' version: '0.170880' - class: Dist::Zilla::Plugin::GitHub::Meta name: '@DROLSKY/GitHub::Meta' version: '0.47' - class: Dist::Zilla::Plugin::GitHub::Update config: Dist::Zilla::Plugin::GitHub::Update: metacpan: 1 name: '@DROLSKY/GitHub::Update' version: '0.47' - class: Dist::Zilla::Plugin::MetaResources name: '@DROLSKY/MetaResources' version: '6.015' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.015' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::Meta::Contributors name: '@DROLSKY/Meta::Contributors' version: '0.003' - class: Dist::Zilla::Plugin::MetaConfig name: '@DROLSKY/MetaConfig' version: '6.015' - class: Dist::Zilla::Plugin::MetaJSON name: '@DROLSKY/MetaJSON' version: '6.015' - class: Dist::Zilla::Plugin::MetaYAML name: '@DROLSKY/MetaYAML' version: '6.015' - class: Dist::Zilla::Plugin::NextRelease name: '@DROLSKY/NextRelease' version: '6.015' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DROLSKY/Test::More with subtest' version: '6.015' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Modules for use with tidyall' version: '6.015' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7' version: '6.015' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::DROLSKY phase: build run_under_travis: 0 skip: [] name: '@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY' version: '0.057' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::DROLSKY::Contributors - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch - Dist::Zilla::Plugin::DROLSKY::License - Dist::Zilla::Plugin::DROLSKY::TidyAll - Dist::Zilla::Plugin::DROLSKY::WeaverConfig - Pod::Weaver::PluginBundle::DROLSKY name: '@DROLSKY/PromptIfStale' version: '0.057' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - CFAERBER - DROLSKY - "DROLSKY's" - DTFB - Färber - Hoblitt - ICal - JHOBLITT - KELLAN - Kellan - McCrea - McGillis - Measham - PayPal - RICKM - Rolsky - "Rolsky's" - drolsky - durations - kickstarting - multilength - overrideable - params - postprocess - postprocessor - preprocess - preprocessing - preprocessor - strptime - workspace wordlist: Pod::Wordlist name: '@DROLSKY/Test::PodSpelling' version: '2.007005' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DROLSKY/PodSyntaxTests' version: '6.015' - class: Dist::Zilla::Plugin::DROLSKY::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 24 name: '@DROLSKY/DROLSKY::RunExtraTests' version: '1.09' - class: Dist::Zilla::Plugin::MojibakeTests name: '@DROLSKY/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes name: '@DROLSKY/Test::CPAN::Changes' version: '0.012' - class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON name: '@DROLSKY/Test::CPAN::Meta::JSON' version: '0.004' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@DROLSKY/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@DROLSKY/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::Portability config: Dist::Zilla::Plugin::Test::Portability: options: '' name: '@DROLSKY/Test::Portability' version: '2.001000' - class: Dist::Zilla::Plugin::Test::TidyAll name: '@DROLSKY/Test::TidyAll' version: '0.04' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@DROLSKY/Test::ReportPrereqs' version: '0.027' - class: Dist::Zilla::Plugin::Test::Version name: '@DROLSKY/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::DROLSKY::Contributors name: '@DROLSKY/DROLSKY::Contributors' version: '1.09' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.20.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@DROLSKY/Git::Contributors' version: '0.035' - class: Dist::Zilla::Plugin::SurgicalPodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@DROLSKY' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Plugin::SingleEncoding name: '@DROLSKY/SingleEncoding' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/List' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/Verbatim' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/header' version: '4.015' - class: Pod::Weaver::Section::Name name: '@DROLSKY/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@DROLSKY/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.015' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.015' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.015' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.015' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.015' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.015' - class: Pod::Weaver::Section::Collect name: TYPES version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@DROLSKY/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/postlude' version: '4.015' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SUPPORT' version: '1.06' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override SUPPORT' version: '0.05' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SOURCE' version: '1.06' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate DONATIONS' version: '1.06' - class: Pod::Weaver::Section::Authors name: '@DROLSKY/Authors' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@DROLSKY/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@DROLSKY/Legal' version: '4.015' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override Legal' version: '0.05' - class: Pod::Weaver::Section::Region name: '@DROLSKY/footer' version: '4.015' name: '@DROLSKY/SurgicalPodWeaver' version: '0.0023' - class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig name: '@DROLSKY/DROLSKY::WeaverConfig' version: '1.09' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@DROLSKY/README.md in build' version: '0.163250' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CONTRIBUTING.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: '0' location: build source_filename: CONTRIBUTING.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CONTRIBUTING.md' version: '0.014' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CODE_OF_CONDUCT.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: '0' location: build source_filename: CODE_OF_CONDUCT.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CODE_OF_CONDUCT.md' version: '0.014' - class: Dist::Zilla::Plugin::InstallGuide config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/InstallGuide' version: '1.200013' - class: Dist::Zilla::Plugin::CPANFile name: '@DROLSKY/CPANFile' version: '6.015' - class: Dist::Zilla::Plugin::DROLSKY::License name: '@DROLSKY/DROLSKY::License' version: '1.09' - class: Dist::Zilla::Plugin::CheckStrictVersion name: '@DROLSKY/CheckStrictVersion' version: '0.001' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@DROLSKY/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@DROLSKY/CheckPrereqsIndexed' version: '0.020' - class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch' version: '1.09' - class: Dist::Zilla::Plugin::EnsureChangesHasContent name: '@DROLSKY/EnsureChangesHasContent' version: '0.02' - class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts config: Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@DROLSKY/Git::CheckFor::MergeConflicts' version: '0.014' - class: Dist::Zilla::Plugin::DROLSKY::TidyAll name: '@DROLSKY/DROLSKY::TidyAll' version: '1.09' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@DROLSKY/Git::Check' version: '2.046' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit generated files' version: '2.046' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.83 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Git::Tag' version: '2.046' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@DROLSKY/Git::Push' version: '2.046' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 name: '@DROLSKY/BumpVersionAfterRelease' version: '0.018' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'Bump version after release' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: - (?^:.+) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit version bump' version: '2.046' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@DROLSKY/Push version bump' version: '2.046' - class: Dist::Zilla::Plugin::DROLSKY::MakeMaker config: Dist::Zilla::Plugin::MakeMaker: make_path: make version: '6.015' Dist::Zilla::Plugin::MakeMaker::Awesome: version: '0.48' Dist::Zilla::Role::TestRunner: default_jobs: 24 version: '6.015' name: '@DROLSKY/DROLSKY::MakeMaker' version: '1.09' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.015' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.015' x_authority: cpan:DROLSKY x_contributors: - 'Daisuke Maki ' - 'James Raspass ' x_generated_by_perl: v5.30.1 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: Artistic-2.0 DateTime-Format-Builder-0.83/Changes0000644000175000017500000001163013714034170017106 0ustar autarchautarch0.83 2020-08-09 - Switched to GitHub issues. 0.82 2019-03-03 - Removed use of Class::Factory::Util. That distro is poorly maintained (by me) and it has some issues with its use of Module::Build. This distro (DateTime-Format-Builder) really doesn't need to use Class::Factory::Util. 0.81 2013-04-02 - Fixes to pass tests with DateTime 1.00. 0.80 2010-03-14 - Remove the 00sig.t test, which seemed to cause random failures based on CPAN testers reports. - Lots of cleanup in test code. - Future releases will all increment by 0.01 (0.81, 0.82, etc). - No code changes. 0.7901 2007-09-01 - The memory-cycle.t test will fail if you have PadWalker and the current Devel::Cycle (1.07) installed. I forgot I had patched my local Devel::Cycle to fix this bug. 0.79 2007-08-30 - Fix several circular references in DateTime::Format::Builder::Parser. This would be triggered by any standard usage of DT::F::Builder. Reported by Carl Franks. RT #29034. 0.7807 2006-05-29 - Fix a test failure in on_fail_regex.t on Win32 (bug in the test code). Reported by Ben Thul. 0.7806 2004-09-09 - When DateTime::Format::Builder::Parser loaded worker classes, it ignored modules located under relative paths. This was fixed by using Class::Factory::Util for this functionality instead. 0.7805 2004-11-08 - DateTime::Format::Build::Parser caused an exception when run in taint mode. Reported by Curtis Hawthorne. 0.7805 2004-11-08 - DateTime::Format::Build::Parser caused an exception when run in taint mode. Reported by Curtis Hawthorne. 0.7804 2004-07-07 - No code or doc changes, just change the code in examples to ensure that PAUSE does not index it. 0.7803 2004-02-13 - Localize $_ before calling File::Find, otherwise it will be written over for caller. Patch from Leon Brocard. 0.7802 2004-02-13 - Add dependency on DateTime::Format::Strptime. 0.7801 2004-01-26 - New maintainer - Dave Rolsky - Switched to a different build/install sysstem (Module::Build instead of Module::Install) 0.78 2003-12-01 - Fix multigroup bug in Dispatch - Add Tivoli example. 0.77 2003-08-14 - Correct package name for Quick. - Augment license conditions. - Fixed timezones in fall.t and quick.t tests. 0.76 2003-08-10 - Fallthrough example and test added. - Quick parser added to simplify fallthrough stuff. - Rejigged internals to allow for on_fail argument to multi-parsers. 0.75 2003-06-29 - Silly MANIFEST.SKIP entry caused dispatch stuff to be skipped. 0.74 2003-06-28 - Dispatch Parser class added, which allows us to make groups of parsers and hop quickly to them. - length parameter can now be an arrayref, hence we can have a parser belong to more than one length group. - Version numbers are all identical now. - Regex Parser can call custom constructors. - Wrapped method only regards undef as a failure. 0.73 2003-06-24 - Exit parser more quickly if able. - Multiple same length parsers accepted. - Fixed some perl 5.005 testing problems. 0.72 2003-05-28 - Minor tweaks for the 'private' tag in META.yml 0.71 2003-05-23 - Massive doc (re)writing. - Examples tidied up. - Tutorial refactored. - Users of generic.pm get to subclass now rather than coderef. 0.69 2003-04-28 - DateTime::Format::Strptime is now supported. - To support the previous item, massive refactoring. - Minor API changes that shouldn't affect anyone. 0.64 2003-04-27 - Callbacks are given 'args' and 'self' keys. - Callbacks can be arrays of callbacks. 0.62 2003-04-20 - Fixed erroneous call to on_fail() - Added 'verbose' debugging capability. - Added 'constructor' option to create_class/import. - Avoid overwriting developers' own new() functions. - Complain if asked to overwrite methods. 0.60 2003-04-12 - Fixed missing '\' from a few '\d' in the docs. - Added ICal.pm example. - Added import() feature, to save lots of typing. - Completely revised documentation. - croak is same length is given twice. - Assorted refactoring, retouching. 0.25 2003-03-29 - Minor code cleanups. - Bug fix; 'extra' params were being ignored. - Doc fix; 'extra' params with 0 are not recommended. 0.24 2003-03-25 - First release! - Split POD into separate file. - Preprocess option for method building works. - Postprocess option per parser works. - Specification lists can now have coderefs in there. 0.23 2003-03-25 - Improved ancillary files. - Added basic use case test for new classes. - Assorted API changes. - create_class infers package name. - also creates specified methods rather than assumed ones. - Assorted POD updates. Still not complete. - Rejigged to only have an array of hashrefs. Simpler. - No inference of length/key stuff. - zero is now extra and is thus semantically different. - Preliminary pre/post processing per parser provided. 0.22 2003-03-21 - Initial (pre-actual release) version. DateTime-Format-Builder-0.83/CONTRIBUTING.md0000644000175000017500000000730713714034170020052 0ustar autarchautarch# CONTRIBUTING Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. Please note that if you have any questions or difficulties, you can reach the maintainer(s) through the bug queue described later in this document (preferred), or by emailing the releaser directly. You are not required to follow any of the steps in this document to submit a patch or bug report; these are just recommendations, intended to help you (and help us help you faster). The distribution is managed with [Dist::Zilla](https://metacpan.org/release/Dist-Zilla). However, you can still compile and test the code with the `MakeFile.PL` in the repository: perl Makefile.PL make make test You may need to satisfy some dependencies. The easiest way to satisfy dependencies is to install the last release. This is available at https://metacpan.org/release/DateTime-Format-Builder You can use [`cpanminus`](https://metacpan.org/pod/App::cpanminus) to do this without downloading the tarball first: $ cpanm --reinstall --installdeps --with-recommends DateTime::Format::Builder [`Dist::Zilla`](https://metacpan.org/pod/Dist::Zilla) is a very powerful authoring tool, but requires a number of author-specific plugins. If you would like to use it for contributing, install it from CPAN, then the following command to install the needed distros: $ dzil authordeps --missing | cpanm There may also be additional requirements not needed by the dzil build which are needed for tests or other development: $ dzil listdeps --author --missing | cpanm Or, you can use the 'dzil stale' command to install all requirements at once: $ cpanm Dist::Zilla::App::Command::stale $ dzil stale --all | cpanm You can also do this via cpanm directly: $ cpanm --reinstall --installdeps --with-develop --with-recommends DateTime::Format::Builder Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil test --release $ dzil xtest $ dzil listdeps --json $ dzil build --notgz You can learn more about Dist::Zilla at http://dzil.org/. The code for this distribution is [hosted on GitHub](https://github.com/houseabsolute/DateTime-Format-Builder). You can submit code changes by forking the repository, pushing your code changes to your clone, and then submitting a pull request. Please update the Changes file with a user-facing description of your changes as part of your work. See the GitHub documentation for [detailed instructions on pull requests](https://help.github.com/articles/creating-a-pull-request) If you have found a bug, but do not have an accompanying patch to fix it, you can submit an issue report [via the web](https://github.com/houseabsolute/DateTime-Format-Builder/issues). ## TidyAll This distribution uses [Code::TidyAll](https://metacpan.org/release/Code-TidyAll) to enforce a uniform coding style. This is tested as part of the author testing suite. You can install and run tidyall by running the following commands: $ cpanm Code::TidyAll $ tidyall -a Please run this before committing your changes and address any issues it brings up. ## Contributor Names If you send a patch or pull request, your name and email address will be included in the documentation as a contributor (using the attribution on the commit or patch), unless you specifically request for it not to be. If you wish to be listed under a different name or address, you should submit a pull request to the `.mailmap` file to contain the correct mapping. ## Generated By This file was generated via Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.014 from a template file originating in Dist-Zilla-PluginBundle-DROLSKY-1.09. DateTime-Format-Builder-0.83/LICENSE0000644000175000017500000002152013714034170016617 0ustar autarchautarchThis software is Copyright (c) 2020 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. DateTime-Format-Builder-0.83/README.md0000644000175000017500000005243413714034170017101 0ustar autarchautarch# NAME DateTime::Format::Builder - Create DateTime parser classes and objects. # VERSION version 0.83 # SYNOPSIS package DateTime::Format::Brief; use DateTime::Format::Builder ( parsers => { parse_datetime => [ { regex => qr/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, params => [qw( year month day hour minute second )], }, { regex => qr/^(\d{4})(\d\d)(\d\d)$/, params => [qw( year month day )], }, ], } ); # DESCRIPTION DateTime::Format::Builder creates DateTime parsers. Many string formats of dates and times are simple and just require a basic regular expression to extract the relevant information. Builder provides a simple way to do this without writing reams of structural code. Builder provides a number of methods, most of which you'll never need, or at least rarely need. They're provided more for exposing of the module's innards to any subclasses, or for when you need to do something slightly beyond what I expected. # TUTORIAL See [DateTime::Format::Builder::Tutorial](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3ATutorial). # ERROR HANDLING AND BAD PARSES Often, I will speak of `undef` being returned, however that's not strictly true. When a simple single specification is given for a method, the method isn't given a single parser directly. It's given a wrapper that will call `on_fail` if the single parser returns `undef`. The single parser must return `undef` so that a multiple parser can work nicely and actual errors can be thrown from any of the callbacks. Similarly, any multiple parsers will only call `on_fail` right at the end when it's tried all it could. `on_fail` (see [later](#on_fail)) is defined, by default, to throw an error. Multiple parser specifications can also specify `on_fail` with a coderef as an argument in the options block. This will take precedence over the inheritable and overrideable method. That said, don't throw real errors from callbacks in multiple parser specifications unless you really want parsing to stop right there and not try any other parsers. In summary: calling a **method** will result in either a `DateTime` object being returned or an error being thrown (unless you've overridden `on_fail` or `create_method`, or you've specified a `on_fail` key to a multiple parser specification). Individual **parsers** (be they multiple parsers or single parsers) will return either the `DateTime` object or `undef`. # SINGLE SPECIFICATIONS A single specification is a hash ref of instructions on how to create a parser. The precise set of keys and values varies according to parser type. There are some common ones though: - length **length** is an optional parameter that can be used to specify that this particular _regex_ is only applicable to strings of a certain fixed length. This can be used to make parsers more efficient. It's strongly recommended that any parser that can use this parameter does. You may happily specify the same length twice. The parsers will be tried in order of specification. You can also specify multiple lengths by giving it an arrayref of numbers rather than just a single scalar. If doing so, please keep the number of lengths to a minimum. If any specifications without _length_s are given and the particular _length_ parser fails, then the non-_length_ parsers are tried. This parameter is ignored unless the specification is part of a multiple parser specification. - label **label** provides a name for the specification and is passed to some of the callbacks about to mentioned. - on\_match and on\_fail **on\_match** and **on\_fail** are callbacks. Both routines will be called with parameters of: - input **input** is the input to the parser (after any preprocessing callbacks). - label **label** is the label of the parser if there is one. - self **self** is the object on which the method has been invoked (which may just be a class name). Naturally, you can then invoke your own methods on it do get information you want. - **args** is an arrayref of any passed arguments, if any. If there were no arguments, then this parameter is not given. These routines will be called depending on whether the **regex** match succeeded or failed. - preprocess **preprocess** is a callback provided for cleaning up input prior to parsing. It's given a hash as arguments with the following keys: - input **input** is the datetime string the parser was given (if using multiple specifications and an overall _preprocess_ then this is the date after it's been through that preprocessor). - parsed **parsed** is the state of parsing so far. Usually empty at this point unless an overall _preprocess_ was given. Items may be placed in it and will be given to any **postprocess**or and `DateTime->new` (unless the postprocessor deletes it). - self, args, label **self**, **args**, **label** as per _on\_match_ and _on\_fail_. The return value from the routine is what is given to the _regex_. Note that this is last code stop before the match. **Note**: mixing _length_ and a _preprocess_ that modifies the length of the input string is probably not what you meant to do. You probably meant to use the _multiple parser_ variant of _preprocess_ which is done **before** any length calculations. This `single parser` variant of _preprocess_ is performed **after** any length calculations. - postprocess **postprocess** is the last code stop before `DateTime->new` is called. It's given the same arguments as _preprocess_. This allows it to modify the parsed parameters after the parse and before the creation of the object. For example, you might use: { regex => qr/^(\d\d) (\d\d) (\d\d)$/, params => [qw( year month day )], postprocess => \&_fix_year, } where `_fix_year` is defined as: sub _fix_year { my %args = @_; my ( $date, $p ) = @args{qw( input parsed )}; $p->{year} += $p->{year} > 69 ? 1900 : 2000; return 1; } This will cause the two digit years to be corrected according to the cut off. If the year was '69' or lower, then it is made into 2069 (or 2045, or whatever the year was parsed as). Otherwise it is assumed to be 19xx. The [DateTime::Format::Mail](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AMail) module uses code similar to this (only it allows the cut off to be configured and it doesn't use Builder). **Note**: It is **very important** to return an explicit value from the _postprocess_ callback. If the return value is false then the parse is taken to have failed. If the return value is true, then the parse is taken to have succeeded and `DateTime->new` is called. See the documentation for the individual parsers for their valid keys. Parsers at the time of writing are: - [DateTime::Format::Builder::Parser::Regex](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3AParser%3A%3ARegex) - provides regular expression based parsing. - [DateTime::Format::Builder::Parser::Strptime](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3AParser%3A%3AStrptime) - provides strptime based parsing. ## Subroutines / coderefs as specifications. A single parser specification can be a coderef. This was added mostly because it could be and because I knew someone, somewhere, would want to use it. If the specification is a reference to a piece of code, be it a subroutine, anonymous, or whatever, then it's passed more or less straight through. The code should return `undef` in event of failure (or any false value, but `undef` is strongly preferred), or a true value in the event of success (ideally a `DateTime` object or some object that has the same interface). This all said, I generally wouldn't recommend using this feature unless you have to. ## Callbacks I mention a number of callbacks in this document. Any time you see a callback being mentioned, you can, if you like, substitute an arrayref of coderefs rather than having the straight coderef. # MULTIPLE SPECIFICATIONS These are very easily described as an array of single specifications. Note that if the first element of the array is an arrayref, then you're specifying options. - preprocess **preprocess** lets you specify a preprocessor that is called before any of the parsers are tried. This lets you do things like strip off timezones or any unnecessary data. The most common use people have for it at present is to get the input date to a particular length so that the _length_ is usable ([DateTime::Format::ICal](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AICal) would use it to strip off the variable length timezone). Arguments are as for the _single parser_ _preprocess_ variant with the exception that _label_ is never given. - on\_fail **on\_fail** should be a reference to a subroutine that is called if the parser fails. If this is not provided, the default action is to call `DateTime::Format::Builder::on_fail`, or the `on_fail` method of the subclass of DTFB that was used to create the parser. # EXECUTION FLOW Builder allows you to plug in a fair few callbacks, which can make following how a parse failed (or succeeded unexpectedly) somewhat tricky. ## For Single Specifications A single specification will do the following: User calls parser: my $dt = $class->parse_datetime($string); 1. _preprocess_ is called. It's given `$string` and a reference to the parsing workspace hash, which we'll call `$p`. At this point, `$p` is empty. The return value is used as `$date` for the rest of this single parser. Anything put in `$p` is also used for the rest of this single parser. 2. _regex_ is applied. 3. If _regex_ **did not** match, then _on\_fail_ is called (and is given `$date` and also _label_ if it was defined). Any return value is ignored and the next thing is for the single parser to return `undef`. If _regex_ **did** match, then _on\_match_ is called with the same arguments as would be given to _on\_fail_. The return value is similarly ignored, but we then move to step 4 rather than exiting the parser. 4. _postprocess_ is called with `$date` and a filled out `$p`. The return value is taken as a indication of whether the parse was a success or not. If it wasn't a success then the single parser will exit at this point, returning undef. 5. `DateTime->new` is called and the user is given the resultant `DateTime` object. See the section on [error handling](#error-handling-and-bad-parses) regarding the `undef`s mentioned above. ## For Multiple Specifications With multiple specifications: User calls parser: my $dt = $class->complex_parse($string); 1. The overall _preprocess_or is called and is given `$string` and the hashref `$p` (identically to the per parser _preprocess_ mentioned in the previous flow). If the callback modifies `$p` then a **copy** of `$p` is given to each of the individual parsers. This is so parsers won't accidentally pollute each other's workspace. 2. If an appropriate length specific parser is found, then it is called and the single parser flow (see the previous section) is followed, and the parser is given a copy of `$p` and the return value of the overall _preprocess_or as `$date`. If a `DateTime` object was returned so we go straight back to the user. If no appropriate parser was found, or the parser returned `undef`, then we progress to step 3! 3. Any non-_length_ based parsers are tried in the order they were specified. For each of those the single specification flow above is performed, and is given a copy of the output from the overall preprocessor. If a real `DateTime` object is returned then we exit back to the user. If no parser could parse, then an error is thrown. See the section on [error handling](#error-handling-and-bad-parses) regarding the `undef`s mentioned above. # METHODS In the general course of things you won't need any of the methods. Life often throws unexpected things at us so the methods are all available for use. ## import `import` is a wrapper for `create_class`. If you specify the _class_ option (see documentation for `create_class`) it will be ignored. ## create\_class This method can be used as the runtime equivalent of `import`. That is, it takes the exact same parameters as when one does: use DateTime::Format::Builder ( ... ) That can be (almost) equivalently written as: use DateTime::Format::Builder; DateTime::Format::Builder->create_class( ... ); The difference being that the first is done at compile time while the second is done at run time. In the tutorial I said there were only two parameters at present. I lied. There are actually three of them. - parsers **parsers** takes a hashref of methods and their parser specifications. See the [DateTime::Format::Builder::Tutorial](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3ATutorial) for details. Note that if you define a subroutine of the same name as one of the methods you define here, an error will be thrown. - constructor **constructor** determines whether and how to create a `new` function in the new class. If given a true value, a constructor is created. If given a false value, one isn't. If given an anonymous sub or a reference to a sub then that is used as `new`. The default is `1` (that is, create a constructor using our default code which simply creates a hashref and blesses it). If your class defines its own `new` method it will not be overwritten. If you define your own `new` and **also** tell Builder to define one an error will be thrown. - verbose **verbose** takes a value. If the value is `undef`, then logging is disabled. If the value is a filehandle then that's where logging will go. If it's a true value, then output will go to `STDERR`. Alternatively, call `$DateTime::Format::Builder::verbose` with the relevant value. Whichever value is given more recently is adhered to. Be aware that verbosity is a global setting. - class **class** is optional and specifies the name of the class in which to create the specified methods. If using this method in the guise of `import` then this field will cause an error so it is only of use when calling as `create_class`. - version **version** is also optional and specifies the value to give `$VERSION` in the class. It's generally not recommended unless you're combining with the _class_ option. A `ExtUtils::MakeMaker` / `CPAN` compliant version specification is much better. In addition to creating any of the methods it also creates a `new` method that can instantiate (or clone) objects. # SUBCLASSING In the rest of the documentation I've often lied in order to get some of the ideas across more easily. The thing is, this module's very flexible. You can get markedly different behaviour from simply subclassing it and overriding some methods. ## create\_method Given a parser coderef, returns a coderef that is suitable to be a method. The default action is to call `on_fail` in the event of a non-parse, but you can make it do whatever you want. ## on\_fail This is called in the event of a non-parse (unless you've overridden `create_method` to do something else. The single argument is the input string. The default action is to call `croak`. Above, where I've said parsers or methods throw errors, this is the method that is doing the error throwing. You could conceivably override this method to, say, return `undef`. # USING BUILDER OBJECTS aka USERS USING BUILDER The methods listed in the [METHODS](https://metacpan.org/pod/METHODS) section are all you generally need when creating your own class. Sometimes you may not want a full blown class to parse something just for this one program. Some methods are provided to make that task easier. ## new The basic constructor. It takes no arguments, merely returns a new `DateTime::Format::Builder` object. my $parser = DateTime::Format::Builder->new; If called as a method on an object (rather than as a class method), then it clones the object. my $clone = $parser->new; ## clone Provided for those who prefer an explicit `clone` method rather than using `new` as an object method. my $clone_of_clone = $clone->clone; ## parser Given either a single or multiple parser specification, sets the object to have a parser based on that specification. $parser->parser( regex => qr/^ (\d{4}) (\d\d) (\d\d) $/x; params => [qw( year month day )], ); The arguments given to `parser` are handed directly to `create_parser`. The resultant parser is passed to `set_parser`. If called as an object method, it returns the object. If called as a class method, it creates a new object, sets its parser and returns that object. ## set\_parser Sets the parser of the object to the given parser. $parser->set_parser($coderef); Note: this method does not take specifications. It also does not take anything except coderefs. Luckily, coderefs are what most of the other methods produce. The method return value is the object itself. ## get\_parser Returns the parser the object is using. my $code = $parser->get_parser; ## parse\_datetime Given a string, it calls the parser and returns the `DateTime` object that results. my $dt = $parser->parse_datetime('1979 07 16'); The return value, if not a `DateTime` object, is whatever the parser wants to return. Generally this means that if the parse failed an error will be thrown. ## format\_datetime If you call this function, it will throw an error. # LONGER EXAMPLES Some longer examples are provided in the distribution. These implement some of the common parsing DateTime modules using Builder. Each of them are, or were, drop in replacements for the modules at the time of writing them. # THANKS Dave Rolsky (DROLSKY) for kickstarting the DateTime project, writing [DateTime::Format::ICal](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AICal) and [DateTime::Format::MySQL](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AMySQL), and some much needed review. Joshua Hoblitt (JHOBLITT) for the concept, some of the API, impetus for writing the multi-length code (both one length with multiple parsers and single parser with multiple lengths), blame for the Regex custom constructor code, spotting a bug in Dispatch, and more much needed review. Kellan Elliott-McCrea (KELLAN) for even more review, suggestions, [DateTime::Format::W3CDTF](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AW3CDTF) and the encouragement to rewrite these docs almost 100%! Claus Färber (CFAERBER) for having me get around to fixing the auto-constructor writing, providing the 'args'/'self' patch, and suggesting the multi-callbacks. Rick Measham (RICKM) for [DateTime::Format::Strptime](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AStrptime) which Builder now supports. Matthew McGillis for pointing out that `on_fail` overriding should be simpler. Simon Cozens (SIMON) for saying it was cool. # SEE ALSO `datetime@perl.org` mailing list. http://datetime.perl.org/ [perl](https://metacpan.org/pod/perl), [DateTime](https://metacpan.org/pod/DateTime), [DateTime::Format::Builder::Tutorial](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3ATutorial), [DateTime::Format::Builder::Parser](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3ABuilder%3A%3AParser) # SUPPORT Bugs may be submitted at [https://github.com/houseabsolute/DateTime-Format-Builder/issues](https://github.com/houseabsolute/DateTime-Format-Builder/issues). I am also usually active on IRC as 'autarch' on `irc://irc.perl.org`. # SOURCE The source code repository for DateTime-Format-Builder can be found at [https://github.com/houseabsolute/DateTime-Format-Builder](https://github.com/houseabsolute/DateTime-Format-Builder). # DONATIONS If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer. Please note that **I am not suggesting that you must do this** in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me. Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time (let's all have a chuckle at that together). To donate, log into PayPal and send money to autarch@urth.org, or use the button at [https://www.urth.org/fs-donation.html](https://www.urth.org/fs-donation.html). # AUTHORS - Dave Rolsky - Iain Truskett # CONTRIBUTORS - Daisuke Maki - James Raspass # COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The full text of the license can be found in the `LICENSE` file included with this distribution. DateTime-Format-Builder-0.83/perltidyrc0000644000175000017500000000113313714034170017714 0ustar autarchautarch-l=78 -i=4 -ci=4 -se -b -bar -boc -vt=0 -vtc=0 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nolq -npro -nsfs --blank-lines-before-packages=0 --opening-hash-brace-right --no-outdent-long-comments --iterations=2 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" # This appears to be needed with recent Perl::Tidy versions and # Code::TidyAll. Otherwise it somehow turns UTF-8 POD text into # ISO-8859-1. Setting this to utf8 doesn't work. This is almost certainly # because of https://github.com/houseabsolute/perl-code-tidyall/issues/84 --character-encoding=none DateTime-Format-Builder-0.83/META.json0000644000175000017500000010726313714034170017244 0ustar autarchautarch{ "abstract" : "Create DateTime parser classes and objects.", "author" : [ "Dave Rolsky ", "Iain Truskett " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "DateTime-Format-Builder", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Code::TidyAll" : "0.56", "Code::TidyAll::Plugin::SortLines::Naturally" : "0.000003", "Code::TidyAll::Plugin::Test::Vars" : "0.02", "Parallel::ForkManager" : "1.19", "Perl::Critic" : "1.126", "Perl::Tidy" : "20160302", "Pod::Wordlist" : "0", "Test::CPAN::Changes" : "0.19", "Test::CPAN::Meta::JSON" : "0.16", "Test::Code::TidyAll" : "0.50", "Test::EOL" : "0", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Portability::Files" : "0", "Test::Spelling" : "0.12", "Test::Vars" : "0.009", "Test::Version" : "2.05" } }, "runtime" : { "requires" : { "Carp" : "0", "DateTime" : "1.00", "DateTime::Format::Strptime" : "1.04", "Params::Validate" : "0.72", "Scalar::Util" : "0", "parent" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::More" : "0.96", "lib" : "0" } } }, "provides" : { "DateTime::Format::Builder" : { "file" : "lib/DateTime/Format/Builder.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser" : { "file" : "lib/DateTime/Format/Builder/Parser.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser::Dispatch" : { "file" : "lib/DateTime/Format/Builder/Parser/Dispatch.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser::Quick" : { "file" : "lib/DateTime/Format/Builder/Parser/Quick.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser::Regex" : { "file" : "lib/DateTime/Format/Builder/Parser/Regex.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser::Strptime" : { "file" : "lib/DateTime/Format/Builder/Parser/Strptime.pm", "version" : "0.83" }, "DateTime::Format::Builder::Parser::generic" : { "file" : "lib/DateTime/Format/Builder/Parser/generic.pm", "version" : "0.83" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/houseabsolute/DateTime-Format-Builder/issues" }, "homepage" : "https://metacpan.org/release/DateTime-Format-Builder", "repository" : { "type" : "git", "url" : "git://github.com/houseabsolute/DateTime-Format-Builder.git", "web" : "https://github.com/houseabsolute/DateTime-Format-Builder" } }, "version" : "0.83", "x_Dist_Zilla" : { "perl" : { "version" : "5.030001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", "Makefile.PL", "README.md", "cpanfile" ], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@DROLSKY/Git::GatherDir", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@DROLSKY/ManifestSkip", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@DROLSKY/License", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@DROLSKY/ExecDir", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@DROLSKY/ShareDir", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@DROLSKY/Manifest", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::CheckVersionIncrement", "name" : "@DROLSKY/CheckVersionIncrement", "version" : "0.121750" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@DROLSKY/TestRelease", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@DROLSKY/ConfirmRelease", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@DROLSKY/UploadToCPAN", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::VersionFromMainModule", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/VersionFromMainModule", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@DROLSKY/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@DROLSKY/AutoPrereqs", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "@DROLSKY/CopyFilesFromBuild", "version" : "0.170880" }, { "class" : "Dist::Zilla::Plugin::GitHub::Meta", "name" : "@DROLSKY/GitHub::Meta", "version" : "0.47" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "config" : { "Dist::Zilla::Plugin::GitHub::Update" : { "metacpan" : 1 } }, "name" : "@DROLSKY/GitHub::Update", "version" : "0.47" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@DROLSKY/MetaResources", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.015" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::Meta::Contributors", "name" : "@DROLSKY/Meta::Contributors", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@DROLSKY/MetaConfig", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@DROLSKY/MetaJSON", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@DROLSKY/MetaYAML", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@DROLSKY/NextRelease", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@DROLSKY/Test::More with subtest", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Modules for use with tidyall", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::DROLSKY" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY", "version" : "0.057" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 1, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [ "Dist::Zilla::Plugin::DROLSKY::Contributors", "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "Dist::Zilla::Plugin::DROLSKY::License", "Dist::Zilla::Plugin::DROLSKY::TidyAll", "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "Pod::Weaver::PluginBundle::DROLSKY" ] } }, "name" : "@DROLSKY/PromptIfStale", "version" : "0.057" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "config" : { "Dist::Zilla::Plugin::Test::PodSpelling" : { "directories" : [ "bin", "lib" ], "spell_cmd" : "", "stopwords" : [ "CFAERBER", "DROLSKY", "DROLSKY's", "DTFB", "F\u00e4rber", "Hoblitt", "ICal", "JHOBLITT", "KELLAN", "Kellan", "McCrea", "McGillis", "Measham", "PayPal", "RICKM", "Rolsky", "Rolsky's", "drolsky", "durations", "kickstarting", "multilength", "overrideable", "params", "postprocess", "postprocessor", "preprocess", "preprocessing", "preprocessor", "strptime", "workspace" ], "wordlist" : "Pod::Wordlist" } }, "name" : "@DROLSKY/Test::PodSpelling", "version" : "2.007005" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@DROLSKY/PodSyntaxTests", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 24 } }, "name" : "@DROLSKY/DROLSKY::RunExtraTests", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::MojibakeTests", "name" : "@DROLSKY/MojibakeTests", "version" : "0.8" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes" } }, "name" : "@DROLSKY/Test::CPAN::Changes", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Meta::JSON", "name" : "@DROLSKY/Test::CPAN::Meta::JSON", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@DROLSKY/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@DROLSKY/Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::Test::Portability", "config" : { "Dist::Zilla::Plugin::Test::Portability" : { "options" : "" } }, "name" : "@DROLSKY/Test::Portability", "version" : "2.001000" }, { "class" : "Dist::Zilla::Plugin::Test::TidyAll", "name" : "@DROLSKY/Test::TidyAll", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@DROLSKY/Test::ReportPrereqs", "version" : "0.027" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "@DROLSKY/Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors", "name" : "@DROLSKY/DROLSKY::Contributors", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.20.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@DROLSKY/Git::Contributors", "version" : "0.035" }, { "class" : "Dist::Zilla::Plugin::SurgicalPodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@DROLSKY" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@DROLSKY/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/List", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/Verbatim", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/header", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@DROLSKY/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@DROLSKY/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "TYPES", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@DROLSKY/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SUPPORT", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::AllowOverride", "name" : "@DROLSKY/allow override SUPPORT", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SOURCE", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate DONATIONS", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@DROLSKY/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@DROLSKY/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@DROLSKY/Legal", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::AllowOverride", "name" : "@DROLSKY/allow override Legal", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/footer", "version" : "4.015" } ] } }, "name" : "@DROLSKY/SurgicalPodWeaver", "version" : "0.0023" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "name" : "@DROLSKY/DROLSKY::WeaverConfig", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "@DROLSKY/README.md in build", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CONTRIBUTING.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CONTRIBUTING.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CONTRIBUTING.md", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CODE_OF_CONDUCT.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CODE_OF_CONDUCT.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CODE_OF_CONDUCT.md", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/InstallGuide", "version" : "1.200013" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@DROLSKY/CPANFile", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::License", "name" : "@DROLSKY/DROLSKY::License", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::CheckStrictVersion", "name" : "@DROLSKY/CheckStrictVersion", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@DROLSKY/CheckSelfDependency", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@DROLSKY/CheckPrereqsIndexed", "version" : "0.020" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::EnsureChangesHasContent", "name" : "@DROLSKY/EnsureChangesHasContent", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::CheckFor::MergeConflicts", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll", "name" : "@DROLSKY/DROLSKY::TidyAll", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "tidyall.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Check", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "tidyall.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit generated files", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.83", "tag_format" : "v%V", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Git::Tag", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Push", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 } }, "name" : "@DROLSKY/BumpVersionAfterRelease", "version" : "0.018" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "Bump version after release" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [ "(?^:.+)" ], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit version bump", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@DROLSKY/Push version bump", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::MakeMaker", "config" : { "Dist::Zilla::Plugin::MakeMaker" : { "make_path" : "make", "version" : "6.015" }, "Dist::Zilla::Plugin::MakeMaker::Awesome" : { "version" : "0.48" }, "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 24, "version" : "6.015" } }, "name" : "@DROLSKY/DROLSKY::MakeMaker", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.015" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.015" } }, "x_authority" : "cpan:DROLSKY", "x_contributors" : [ "Daisuke Maki ", "James Raspass " ], "x_generated_by_perl" : "v5.30.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.19", "x_spdx_expression" : "Artistic-2.0" } DateTime-Format-Builder-0.83/CODE_OF_CONDUCT.md0000644000175000017500000000625313714034170020417 0ustar autarchautarch# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at autarch@urth.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org DateTime-Format-Builder-0.83/examples/0000755000175000017500000000000013714034170017430 5ustar autarchautarchDateTime-Format-Builder-0.83/examples/ICal.pm0000644000175000017500000000724613714034170020607 0ustar autarchautarch# we need to comment this out or PAUSE might index it # pack age DateTime::Format::ICal; use strict; use DateTime; # Builder relevant stuff starts here. use DateTime::Format::Builder parsers => { parse_datetime => [ [ preprocess => \&_parse_tz ], { length => 15, params => [qw( year month day hour minute second )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/, }, { length => 13, params => [qw( year month day hour minute )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)$/, }, { length => 11, params => [qw( year month day hour )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)$/, }, { length => 8, params => [qw( year month day )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)$/, }, ], }; sub _parse_tz { my %args = @_; my ( $date, $p ) = @args{qw( input parsed )}; if ( $date =~ s/^TZID=([^:]+):// ) { $p->{time_zone} = $1; } # Z at end means UTC elsif ( $date =~ s/Z$// ) { $p->{time_zone} = 'UTC'; } else { $p->{time_zone} = 'floating'; } return $date; } # Builder relevant stuff ends here. sub parse_duration { my ( $self, $dur ) = @_; my @units = qw( weeks days hours minutes seconds ); $dur =~ m{ ([\+\-])? # Sign P # 'P' for period? This is our magic character) (?: (?:(\d+)W)? # Weeks (?:(\d+)D)? # Days )? (?: T # Time prefix (?:(\d+)H)? # Hours (?:(\d+)M)? # Minutes (?:(\d+)S)? # Seconds )? }x; my $sign = $1; my %units; $units{weeks} = $2 if defined $2; $units{days} = $3 if defined $3; $units{hours} = $4 if defined $4; $units{minutes} = $5 if defined $5; $units{seconds} = $6 if defined $6; die "Invalid ICal duration string ($dur)\n" unless %units; if ( $sign eq '-' ) { $_ *= -1 foreach values %units; } return DateTime::Duration->new(%units); } sub format_datetime { my ( $self, $dt ) = @_; my $tz = $dt->time_zone; unless ( $tz->is_floating || $tz->is_utc || $tz->name ) { $dt = $dt->clone->set_time_zone('UTC'); $tz = $dt->time_zone; } my $base = ( $dt->hour || $dt->min || $dt->sec ? sprintf( '%04d%02d%02dT%02d%02d%02d', $dt->year, $dt->month, $dt->day, $dt->hour, $dt->minute, $dt->second ) : sprintf( '%04d%02d%02d', $dt->year, $dt->month, $dt->day ) ); return $base if $tz->is_floating; return $base . 'Z' if $tz->is_utc; return 'TZID=' . $tz->name . ':' . $base; } sub format_duration { my ( $self, $duration ) = @_; die "Cannot represent years or months in an iCal duration\n" if $duration->delta_months; # simple string for 0-length durations return '+PT0S' unless $duration->delta_days || $duration->delta_seconds; my $ical = $duration->is_positive ? '+' : '-'; $ical .= 'P'; if ( $duration->delta_days ) { $ical .= $duration->weeks . 'W' if $duration->weeks; $ical .= $duration->days . 'D' if $duration->days; } if ( $duration->delta_seconds ) { $ical .= 'T'; $ical .= $duration->hours . 'H' if $duration->hours; $ical .= $duration->minutes . 'M' if $duration->minutes; $ical .= $duration->seconds . 'S' if $duration->seconds; } return $ical; } 1; DateTime-Format-Builder-0.83/examples/Simple.pm0000644000175000017500000000152513714034170021222 0ustar autarchautarchpackage DateTime::Format::Simple; use DateTime::Format::Builder ( parsers => { parse_datetime => [ { params => [qw( year month mday hours mins secs fsecs ampm )], regex => qr[^ (\d{4}) \s*-?\s* (\d{2}) \s*-?\s* (\d{2}) \s* (?:-?\s* (\d{1,2}) :? (\d{2}) (?::? (\d{2}) )? )? (?:\. (\d+) ) ? # fsecs (?:\s* ([aApP]\.?[mM]\.?) )? $ ]x, }, { # mm/dd/yyyy, mm-dd-yyyy, [hh:mm[:ss[.nnn]]] [am/pm] params => [qw( month mday year hours mins secs fsecs ampm )], regex => qr#^ (\d{1,2})[-/](\d{1,2})[-/](\d{4}) (?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)? (?:\.(\d+))? (?:\s*([aApP]\.?[mM]\.?))? $ #x }, ] } ); DateTime-Format-Builder-0.83/examples/MySQL.pm0000644000175000017500000001124313714034170020734 0ustar autarchautarch# we need to comment this out or PAUSE might index it # pack age DateTime::Format::MySQL; use strict; use DateTime; # Builder relevant stuff starts here. use DateTime::Format::Builder ( parsers => { parse_date => { params => [qw( year month day )], regex => qr/^(\d{1,4})-(\d\d)-(\d\d)$/, }, parse_datetime => { params => [qw( year month day hour minute second )], regex => qr/^(\d{1,4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/, extra => { time_zone => 'floating' }, }, parse_timestamp => [ { length => 14, params => [qw( year month day hour minute second )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, }, { length => 12, params => [qw( year month day hour minute second )], regex => qr/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, postprocess => \&_fix_2_digit_year, }, { length => 10, params => [qw( year month day hour minute )], regex => qr/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, postprocess => \&_fix_2_digit_year, }, { length => 8, params => [qw( year month day )], regex => qr/^(\d\d\d\d)(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, }, { length => 6, params => [qw( year month day )], regex => qr/^(\d\d)(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, postprocess => \&_fix_2_digit_year, }, { length => 4, params => [qw( year month )], regex => qr/^(\d\d)(\d\d)$/, extra => { time_zone => 'floating' }, postprocess => \&_fix_2_digit_year, }, { length => 2, params => [qw( year )], regex => qr/^(\d\d)$/, extra => { time_zone => 'floating' }, postprocess => \&_fix_2_digit_year, }, ], }, ); sub _fix_2_digit_year { my %p = @_; $p{parsed}{year} += $p{parsed}{year} <= 69 ? 2000 : 1900; } # Builder relevant stuff ends here. sub format_date { my ( $self, $dt ) = @_; return $dt->ymd('-'); } sub format_time { my ( $self, $dt ) = @_; return $dt->hms(':'); } sub format_datetime { my ( $self, $dt ) = @_; return $self->format_date($dt) . ' ' . $self->format_time($dt); } 1; __END__ =head1 NAME DateTime::Format::MySQL - Parse and format MySQL dates and times =head1 SYNOPSIS use DateTime::Format::MySQL; my $dt = DateTime::Format::MySQL->parse_datetime( '2003-01-16 23:12:01' ); # 2003-01-16 23:12:01 DateTime::Format::MySQL->format_datetime($dt); =head1 DESCRIPTION This module understands the formats used by MySQL for its DATE, DATETIME, TIME, and TIMESTAMP data types. It can be used to parse these formats in order to create DateTime objects, and it can take a DateTime object and produce a string representing it in the MySQL format. =head1 METHODS This class offers the following methods. All of the parsing methods set the returned DateTime object's time zone to the floating time zone, because MySQL does not provide time zone information. =over 4 =item * parse_datetime($string) =item * parse_date($string) =item * parse_timestamp($string) Given a value of the appropriate type, this method will return a new C object. If given an improperly formatted string, this method may die. =item * format_date($datetime) =item * format_time($datetime) =item * format_datetime($datetime) Given a C object, this methods returns an appropriately formatted string. =back =head1 SUPPORT Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. =head1 AUTHOR Dave Rolsky =head1 COPYRIGHT Copyright (c) 2003 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO datetime@perl.org mailing list http://datetime.perl.org/ =cut DateTime-Format-Builder-0.83/examples/Tivoli.pm0000644000175000017500000000131713714034170021236 0ustar autarchautarch# we need to comment this out or PAUSE might index it # pack age DateTime::Format::Tivoli; use DateTime::Format::Builder ( parsers => { parse_datetime => { strptime => '%h %e %k:%M:%S %Y', }, }, ); sub format_datetime { my ( $self, $dt ) = @_; my $z = $dt->clone->set_time_zone('GMT'); return $z->strftime('%h %e %k:%M:%S %Y'); } package main; my $parser = DateTime::Format::Tivoli->new(); my @dates = ( 'Nov 5 22:49:45 2003', '27/Apr/2003:19:45:11 -0400' ); for my $date (@dates) { my $dt = $parser->parse_datetime($date)->set_time_zone('Australia/Sydney'); print "$date => ", $dt->datetime, " => ", $parser->format_datetime($dt), "\n"; } DateTime-Format-Builder-0.83/examples/W3CDTF.pm0000644000175000017500000001067313714034170020727 0ustar autarchautarch# we need to comment this out or PAUSE might index it # pack age DateTime::Format::W3CDTF; use strict; use DateTime::Format::Builder ( parsers => { parse_datetime => [ [ preprocess => \&_parse_tz ], { params => [qw( year month day hour minute second)], regex => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)\.(\d\d)$/, length => 22, }, { params => [qw( year month day hour minute second)], regex => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)$/, length => 19, }, { params => [qw( year month day hour minute)], regex => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)$/, length => 16, }, { params => [qw( year month day )], regex => qr/^(\d{4})-(\d\d)-(\d\d)$/, length => 10, }, { params => [qw( year month )], regex => qr/^(\d{4})-(\d\d)$/, length => 7, extra => { day => 1 }, }, { params => [qw( year )], regex => qr/^(\d\d\d\d)$/, length => 4, extra => { month => 1, day => 1 } } ] } ); sub _parse_tz { my %args = @_; my ( $date, $p ) = @args{qw( input parsed )}; if ( $date =~ s/([+-]\d\d:\d\d)$// ) { $p->{time_zone} = $1; } # Z at end means UTC elsif ( $date =~ s/Z$// ) { $p->{time_zone} = 'UTC'; } else { $p->{time_zone} = 'floating'; } return $date; } sub format_datetime { my ( $self, $dt ) = @_; my $base = ( $dt->hour || $dt->min || $dt->sec ? sprintf( '%04d-%02d-%02dT%02d:%02d:%02d', $dt->year, $dt->month, $dt->day, $dt->hour, $dt->minute, $dt->second ) : sprintf( '%04d-%02d-%02d', $dt->year, $dt->month, $dt->day ) ); my $tz = $dt->time_zone; return $base if $tz->is_floating; # if there is a time component if ( $dt->hour || $dt->min || $dt->sec ) { return $base . 'Z' if $tz->is_utc; if ( $tz->{'offset'} ) { return $base . offset_as_string( $tz->{'offset'} ); } } else { return $base; } } # minor offset_as_string variant w/ : # sub offset_as_string { my $offset = shift; return undef unless defined $offset; my $sign = $offset < 0 ? '-' : '+'; my $hours = $offset / ( 60 * 60 ); $hours = abs($hours) % 24; my $mins = ( $offset % ( 60 * 60 ) ) / 60; my $secs = $offset % 60; return ( $secs ? sprintf( '%s%02d:%02d:%02d', $sign, $hours, $mins, $secs ) : sprintf( '%s%02d:%02d', $sign, $hours, $mins ) ); } 1; __END__ =head1 NAME DateTime::Format::W3CDTF - Parse and format W3CDTF datetime strings =head1 SYNOPSIS use DateTime::Format::W3CDTF; my $f = DateTime::Format::W3CDTF->new; my $dt = $f->parse_datetime( '2003-02-15T13:50:05-05:00' ); # 2003-02-15T13:50:05-05:00 $f->format_datetime($dt); =head1 DESCRIPTION This module understands the W3CDTF date/time format, an ISO 8601 profile, defined at http://www.w3.org/TR/NOTE-datetime. This format as the native date format of RSS 1.0. It can be used to parse these formats in order to create the appropriate objects. =head1 METHODS This API is currently experimental and may change in the future. =over 4 =item * parse_datetime($string) Given a W3CDTF datetime string, this method will return a new C object. If given an improperly formatted string, this method may die. =item * format_datetime($datetime) Given a C object, this methods returns a W3CDTF datetime string. =back =head1 SUPPORT Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. =head1 AUTHOR Kellan Elliott-McCrea This module was inspired by C =head1 COPYRIGHT Copyright (c) 2003 Kellan Elliott-McCrea. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO datetime@perl.org mailing list http://datetime.perl.org/ =cut DateTime-Format-Builder-0.83/examples/Apache.pm0000644000175000017500000000252313714034170021151 0ustar autarchautarch# we need to comment this out or PAUSE might index it # pack age DateTime::Format::Apache; use DateTime::Format::Builder ( parsers => { parse_datetime => { strptime => '%e/%b/%Y:%H:%M:%S %z', # params => [qw( day month year hour minute second time_zone )], # regex => qr{ ^ # (\d+)/(\w{3})/(\d{4}) # : # (\d\d):(\d\d):(\d\d) # \s # ([+-]\d{4}) # $ }x, # postprocess => sub { # my %args = @_; # $args{parsed}{month} = month_to_num( $args{parsed}{month} ); # 1; # }, }, }, ); sub month_to_num { my $wanted = shift; my %months; my $lang = DateTime::Language->new( language => 'en' ); my $i; $months{$_} = ++$i for @{ $lang->month_abbreviations }; return $months{$wanted}; } sub format_datetime { my ( $self, $dt ) = @_; return $dt->strftime("%e/%b/%Y:%H:%M:%S %z"); } package main; my $parser = DateTime::Format::Apache->new(); my @dates = ( '27/Feb/2003:19:45:11 -0400', '27/Apr/2003:19:45:11 -0400' ); for my $date (@dates) { my $dt = $parser->parse_datetime($date)->set_time_zone('Australia/Sydney'); print "$date => ", $dt->datetime, " => ", $parser->format_datetime($dt), "\n"; } DateTime-Format-Builder-0.83/examples/Fall.pm0000644000175000017500000000151113714034170020642 0ustar autarchautarch#!/usr/bin/perl -w use strict; =pod This example shows a simple fall through parser that tries a few of the other formatting modules, _then_ fails. =cut package DateTime::Format::Fall; use DateTime::Format::HTTP; use DateTime::Format::Mail; use DateTime::Format::IBeat; use DateTime::Format::Builder ( parsers => { parse_datetime => [ sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) }; }, sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) }; }, sub { eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) }; }, ] } ); package main; for ( '@d19.07.03 @704', '20030719T155345', 'gibberish' ) { print DateTime::Format::Fall->parse_datetime($_)->datetime, "\n"; } DateTime-Format-Builder-0.83/lib/0000755000175000017500000000000013714034170016360 5ustar autarchautarchDateTime-Format-Builder-0.83/lib/DateTime/0000755000175000017500000000000013714034170020054 5ustar autarchautarchDateTime-Format-Builder-0.83/lib/DateTime/Format/0000755000175000017500000000000013714034170021304 5ustar autarchautarchDateTime-Format-Builder-0.83/lib/DateTime/Format/Builder/0000755000175000017500000000000013714034170022672 5ustar autarchautarchDateTime-Format-Builder-0.83/lib/DateTime/Format/Builder/Parser/0000755000175000017500000000000013714034170024126 5ustar autarchautarchDateTime-Format-Builder-0.83/lib/DateTime/Format/Builder/Parser/Quick.pm0000644000175000017500000000703713714034170025547 0ustar autarchautarchpackage DateTime::Format::Builder::Parser::Quick; use strict; use warnings; our $VERSION = '0.83'; our %dispatch_data; use Params::Validate qw( SCALAR OBJECT CODEREF validate ); use parent qw( DateTime::Format::Builder::Parser ); __PACKAGE__->valid_params( Quick => { type => SCALAR | OBJECT, callbacks => { good_classname => sub { ( ref $_[0] ) or ( $_[0] =~ /^\w+[:'\w+]*\w+/ ); }, } }, method => { optional => 1, type => SCALAR | CODEREF, }, ); sub create_parser { my ( $self, %args ) = @_; my $class = $args{Quick}; my $method = $args{method}; $method = 'parse_datetime' unless defined $method; eval "use $class"; die $@ if $@; return sub { my ( $self, $date ) = @_; return unless defined $date; my $rv = eval { $class->$method($date) }; return $rv if defined $rv; return; }; } 1; # ABSTRACT: Use another formatter, simply __END__ =pod =encoding UTF-8 =head1 NAME DateTime::Format::Builder::Parser::Quick - Use another formatter, simply =head1 VERSION version 0.83 =head1 SYNOPSIS use DateTime::Format::Builder ( parsers => { parse_datetime => [ { Quick => 'DateTime::Format::HTTP' }, { Quick => 'DateTime::Format::Mail' }, { Quick => 'DateTime::Format::IBeat' }, ] } ); # is the same as use DateTime::Format::HTTP; use DateTime::Format::Mail; use DateTime::Format::IBeat; use DateTime::Format::Builder ( parsers => { parse_datetime => [ sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) } }, sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) } }, sub { eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) } }, ] } ); (These two pieces of code can both be found in the test suite; one as F, the other as F.) =head1 DESCRIPTION C adds a parser that allows some shortcuts when writing fairly standard and mundane calls to other formatting modules. =head1 SPECIFICATION C has two keys, one optional. The C keyword should have an argument of either an object or a class name. If it's a class name then the class is Cd. The C keyword is optional with a default of C. It's either name of the method to invoke on the object, or a reference to a piece of code. In any case, the resultant code ends up looking like: my $rv = $Quick->$method($date); =head1 SEE ALSO C mailing list. http://datetime.perl.org/ L, L, L =head1 SUPPORT Bugs may be submitted at L. I am also usually active on IRC as 'autarch' on C. =head1 SOURCE The source code repository for DateTime-Format-Builder can be found at L. =head1 AUTHORS =over 4 =item * Dave Rolsky =item * Iain Truskett =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The full text of the license can be found in the F file included with this distribution. =cut DateTime-Format-Builder-0.83/lib/DateTime/Format/Builder/Parser/Regex.pm0000644000175000017500000001122013714034170025532 0ustar autarchautarchpackage DateTime::Format::Builder::Parser::Regex; use strict; use warnings; our $VERSION = '0.83'; use Params::Validate qw( validate ARRAYREF SCALARREF HASHREF CODEREF ); use parent 'DateTime::Format::Builder::Parser::generic'; __PACKAGE__->valid_params( # How to match params => { type => ARRAYREF, # mapping $1,$2,... to new args }, regex => { type => SCALARREF, callbacks => { 'is a regex' => sub { ref(shift) eq 'Regexp' } } }, # How to create extra => { type => HASHREF, optional => 1, }, constructor => { type => CODEREF | ARRAYREF, optional => 1, callbacks => { 'array has 2 elements' => sub { ref( $_[0] ) eq 'ARRAY' ? ( @{ $_[0] } == 2 ) : 1; } } }, ); sub do_match { my $self = shift; my $date = shift; my @matches = $date =~ $self->{regex}; return @matches ? \@matches : undef; } sub post_match { my $self = shift; my ( $date, $matches, $p ) = @_; # Fill %p from match @{$p}{ @{ $self->{params} } } = @$matches; return; } sub make { my $self = shift; my ( $date, $dt, $p ) = @_; my @args = ( %$p, %{ $self->{extra} } ); if ( my $cons = $self->{constructor} ) { if ( ref $cons eq 'ARRAY' ) { my ( $class, $method ) = @$cons; return $class->$method(@args); } elsif ( ref $cons eq 'CODE' ) { return $self->$cons(@args); } } else { return DateTime->new(@args); } } sub create_parser { my ( $self, %args ) = @_; $args{extra} ||= {}; unless ( ref $self ) { $self = $self->new(%args); } # Create our parser return $self->generic_parser( ( map { exists $args{$_} ? ( $_ => $args{$_} ) : () } qw( on_match on_fail preprocess postprocess ) ), label => $args{label}, ); } 1; # ABSTRACT: Regex based date parsing __END__ =pod =encoding UTF-8 =head1 NAME DateTime::Format::Builder::Parser::Regex - Regex based date parsing =head1 VERSION version 0.83 =head1 SYNOPSIS my $parser = DateTime::Format::Builder->create_parser( regex => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/, params => [qw( year month day hour minute second )], ); =head1 SPECIFICATION In addition to the L, C supports: =over 4 =item * regex B is a regular expression that should capture elements of the datetime string. This is a required element. This is the key whose presence indicates it's a specification that belongs to this class. =item * params B is an arrayref of key names. The captures from the regex are mapped to these (C<$1> to the first element, C<$2> to the second, and so on) and handed to C<< DateTime->new >>. This is a required element. =item * extra B is a hashref of extra arguments you wish to give to C<< DateTime->new >>. For example, you could set the C or C to defaults: extra => { year => 2004, time_zone => "Australia/Sydney" }, =item * B is either an arrayref or a coderef. If an arrayref then the first element is a class name or object, and the second element is a method name (or coderef since Perl allows that sort of thing). The arguments to the call are anything in C<$p> and anything given in the C option above. If only a coderef is supplied, then it is called with arguments of C<$self>, C<$p> and C. In short: $self->$coderef( %{$p}, %{ $self->{extra} } ); The method is expected to return a valid L object, or C in event of failure, but can conceivably return anything it likes. So long as it's 'true'. =back =head1 SEE ALSO C mailing list. http://datetime.perl.org/ L, L, L =head1 SUPPORT Bugs may be submitted at L. I am also usually active on IRC as 'autarch' on C. =head1 SOURCE The source code repository for DateTime-Format-Builder can be found at L. =head1 AUTHORS =over 4 =item * Dave Rolsky =item * Iain Truskett =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The full text of the license can be found in the F file included with this distribution. =cut DateTime-Format-Builder-0.83/lib/DateTime/Format/Builder/Parser/generic.pm0000644000175000017500000001223613714034170026104 0ustar autarchautarchpackage DateTime::Format::Builder::Parser::generic; use strict; use warnings; our $VERSION = '0.83'; use Carp; use Params::Validate qw( validate SCALAR CODEREF UNDEF ); sub new { my $class = shift; bless {@_}, $class; } sub generic_parser { my $class = shift; my %args = validate( @_, { ( map { $_ => { type => CODEREF, optional => 1 } } qw( on_match on_fail preprocess postprocess ) ), label => { type => SCALAR | UNDEF, optional => 1 }, } ); my $label = $args{label}; my $callback = ( exists $args{on_match} or exists $args{on_fail} ) ? 1 : undef; return sub { my ( $self, $date, $p, @args ) = @_; return unless defined $date; my %p; %p = %$p if $p; # Look! A Copy! my %param = ( self => $self, ( defined $label ? ( label => $label ) : () ), ( @args ? ( args => \@args ) : () ), ); # Preprocess - can modify $date and fill %p if ( $args{preprocess} ) { $date = $args{preprocess} ->( input => $date, parsed => \%p, %param ); } my $rv = $class->do_match( $date, @args ) if $class->can('do_match'); # Funky callback thing if ($callback) { my $type = defined $rv ? "on_match" : "on_fail"; $args{$type}->( input => $date, %param ) if $args{$type}; } return unless defined $rv; my $dt; $dt = $class->post_match( $date, $rv, \%p ) if $class->can('post_match'); # Allow post processing. Return undef if regarded as failure if ( $args{postprocess} ) { my $rv = $args{postprocess}->( parsed => \%p, input => $date, post => $dt, %param, ); return unless $rv; } # A successful match! $dt = $class->make( $date, $dt, \%p ) if $class->can('make'); return $dt; }; } { no strict 'refs'; for (qw( valid_params params )) { *$_ = *{"DateTime::Format::Builder::Parser::$_"}; } } 1; # ABSTRACT: Useful routines __END__ =pod =encoding UTF-8 =head1 NAME DateTime::Format::Builder::Parser::generic - Useful routines =head1 VERSION version 0.83 =head1 METHODS =head2 Useful =head3 new Standard constructor. Returns a blessed hash; any arguments are placed in the hash. This is useful for storing information between methods. =head3 generic_parser This is a method provided solely for the benefit of C implementations. It semi-neatly abstracts a lot of the work involved. Basically, it takes parameters matching the assorted callbacks from the parser declarations and makes a coderef out of it all. Currently recognized callbacks are: =over 4 =item * on_match =item * on_fail =item * preprocess =item * postprocess =back =head2 Methods for subclassing These are methods you should define when writing your own subclass. B: these methods do not exist in this class. There is no point trying to call C<< $self->SUPER::do_match( ... ) >>. =head3 do_match C is the first phase. Arguments are the date and @args. C, C