Build.PL000644000765000024 352612206306510 16445 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009# ========================================================================= # THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA. # DO NOT EDIT DIRECTLY. # ========================================================================= use 5.008_001; use strict; use warnings; use utf8; use Module::Build; use File::Basename; use File::Spec; use CPAN::Meta; use CPAN::Meta::Prereqs; my %args = ( license => 'perl', dynamic_config => 0, configure_requires => { 'Module::Build' => 0.38, }, name => 'DateTime-Format-Pg', module_name => 'DateTime::Format::Pg', allow_pureperl => 0, script_files => [glob('script/*'), glob('bin/*')], c_source => [qw()], PL_files => {}, test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/', recursive_test_files => 1, ); if (-d 'share') { $args{share_dir} = 'share'; } my $builder = Module::Build->subclass( class => 'MyBuilder', code => q{ sub ACTION_distmeta { die "Do not run distmeta. Install Minilla and `minil install` instead.\n"; } sub ACTION_installdeps { die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n"; } } )->new(%args); $builder->create_build_script(); my $mbmeta = CPAN::Meta->load_file('MYMETA.json'); my $meta = CPAN::Meta->load_file('META.json'); my $prereqs_hash = CPAN::Meta::Prereqs->new( $meta->prereqs )->with_merged_prereqs( CPAN::Meta::Prereqs->new($mbmeta->prereqs) )->as_string_hash; my $mymeta = CPAN::Meta->new( { %{$meta->as_struct}, prereqs => $prereqs_hash } ); print "Merging cpanfile prereqs to MYMETA.yml\n"; $mymeta->save('MYMETA.yml', { version => 1.4 }); print "Merging cpanfile prereqs to MYMETA.json\n"; $mymeta->save('MYMETA.json', { version => 2 }); Changes000644000765000024 640212206306510 16440 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009Revision history for Perl extension DateTime::Format::Pg. 0.16009 2013-08-25T04:51:15Z - Fix typos [pr #2] (dsteinbrunner) - Migrate to using Minilla for packaging 0.16008 Fri Nov 25 09:20:00 2011 - Work with [+-]hh:mm:ss time offsets. Reported by Rod Tailor (rt #72706) 0.16007 Wed Dec 26 15:30:00 2012 - Fix ISO parsing (rt 51074, https://github.com/lestrrat/DateTime-Format-Pg/pull/1) - Why I have not noticed this PR, I have no clue 0.16006 Fri May 27 09:00:00 2011 - Repository moved to github - Postgres 8.4 apprently now allows infinity dates. Applied patch by cmckay (rt #68473) 0.16005 Wed Jun 23 12:15:00 2010 - Fix edge case in fractional seconds (rt #58612). Patch by Andrew Whatson 0.16004 Mon Jul 06 12:00:00 2009 - Ship with proper META.yml (rt #47604) 0.16003 Fri Mar 27 09:30:00 2009 - Fix handling of BC (rt #44594). Patch by Jonas Lijegren. 0.16002 Tue Aug 13 08:00:00 2008 - Remove non-ascii byte sequence from Pg.pm (sorry, Claus). This fixes a failure report from CPAN testers - Updated Module::Install while we're at it 0.16001 Tue May 22 21:00:00 2007 - Attempt to get this right (#27222, reported by GHENRY). We now allow two hour digits to contain a preceding zero, but for hours with more than 3 digits, a preceding zero is an error. 0.16 Tue May 22 12:00:00 2007 - Fix handling of intervals > 99 hours. (#27222, reported by GHENRY) - Migrate to Module::Install 0.15 Fri Mar 23 12:00:00 2007 - Fix s/infinite/infinity/g (#25181, reported by Neil Bertram / CFAERBER)) 0.14 Thu Mar 22 20:30:00 2007 - Fix self circling (format -> parse) (#25642, reported by ANDREMAR) 0.13 Mon Jul 10 16:00:00 2006 - stupid me cut n' pasted POD tests from other package. yuck. 0.12 Wed Jul 05 18:00:00 2006 - No code change. - Add pod tests. 0.11 Sat Apr 01 07:09:00 2006 - Fix fractional seconds when formatting DT::Duration to Pg intervals (bug #18487) 0.10 Sat Jan 07 09:40:00 2006 - Refactor parse_duration() + add tests (David Wheeler) 0.09 Fri Sep 03 06:00:00 2005 - support infinite, -infinite for parse_timestamp(tz) and format_datetime, format_timestamp (Daisuke Maki) 0.08 Wed Mar 16 16:00:00 2005 - fixed parse_time (John Siracusa, bug #8516) - format_interval was missing (CEESHEK, bug #11898) - format_duration did not work as a class method (CEESHEK, bug #11898) 0.07 Sun Aug 08 00:00:00 2004 - fixed handling of numerical timezones without minutes (reported by Daisuke Maki) 0.06 Sun Jun 20 00:00:00 2004 - use nanoseconds when formatting times (bug #6557) 0.05 Wed Jul 16 00:00:00 2003 - updated for DateTime 0.13 (use nanoseconds instead of fractional_seconds) 0.04 Fri May 30 00:00:00 2003 - runs more happily while warnings are enabled (koschei) - updated for DT::Format::Builder 0.72 (koschei/cfaerber) 0.03 Sun May 11 00:00:00 2003 - support for BC dates - automatic tests (not complete) - complete rewrite of time zone handling - added methods to parse/format intervals - make use of DT::Format::Builder's new features in 0.70 0.01 Sat Apr 19 00:00:00 2003 - original version; created by h2xs 1.22 with options -X -n DateTime::Format::Pg $Id: Changes 4436 2010-06-23 03:14:18Z lestrrat $ LICENSE000644000765000024 5010112206306510 16165 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009Terms of Perl itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --------------------------------------------------------------------------- The General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS --------------------------------------------------------------------------- The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End META.json000644000765000024 375612206306510 16577 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009{ "abstract" : "Parse and format PostgreSQL dates and times", "author" : [ "Daisuke Maki " ], "dynamic_config" : 0, "generated_by" : "Minilla/v0.6.4", "license" : "perl_5", "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "DateTime-Format-Pg", "no_index" : { "directory" : [ "t", "xt", "inc", "share", "eg", "examples", "author" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.36", "Test::More" : "0" } }, "configure" : { "requires" : { "CPAN::Meta" : "0", "CPAN::Meta::Prereqs" : "0", "Module::Build" : "0.38" } }, "develop" : { "requires" : { "Test::CPAN::Meta" : "0", "Test::MinimumVersion" : "0.10108", "Test::Pod" : "1.41", "Test::Spellunker" : "v0.2.7" } }, "runtime" : { "requires" : { "DateTime" : "0.10", "DateTime::Format::Builder" : "0.72", "DateTime::TimeZone" : "0.05" } } }, "provides" : { "DateTime::Format::Pg" : { "file" : "lib/DateTime/Format/Pg.pm", "version" : "0.16009" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/lestrrat/DateTime-Format-Pg/issues" }, "homepage" : "https://github.com/lestrrat/DateTime-Format-Pg", "repository" : { "url" : "git://github.com/lestrrat/DateTime-Format-Pg.git", "web" : "https://github.com/lestrrat/DateTime-Format-Pg" } }, "version" : "0.16009", "x_contributors" : [ "Vasily Chekalkin ", "David Steinbrunner ", "Daisuke Maki " ] } Makefile000644000765000024 5624312206306510 16635 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009# This Makefile is for the DateTime::Format::Pg extension to perl. # # It was generated automatically by MakeMaker version # 6.66 (Revision: 66600) from the contents of # Makefile.PL. Don't edit this file, edit Makefile.PL instead. # # ANY CHANGES MADE HERE WILL BE LOST! # # MakeMaker ARGV: () # # MakeMaker Parameters: # ABSTRACT => q[Parse and format PostgreSQL dates and times] # AUTHOR => [q[Daisuke Maki ]] # BUILD_REQUIRES => { Test::More=>q[0], ExtUtils::MakeMaker=>q[6.36] } # CONFIGURE_REQUIRES => { } # DISTNAME => q[DateTime-Format-Pg] # LICENSE => q[perl] # NAME => q[DateTime::Format::Pg] # NO_META => q[1] # PREREQ_PM => { DateTime::TimeZone=>q[0.05], DateTime::Format::Builder=>q[0.72], ExtUtils::MakeMaker=>q[6.36], DateTime=>q[0.10], Test::More=>q[0] } # TEST_REQUIRES => { } # VERSION => q[0.16008] # VERSION_FROM => q[lib/DateTime/Format/Pg.pm] # dist => { } # realclean => { FILES=>q[MYMETA.yml] } # --- MakeMaker post_initialize section: # --- MakeMaker const_config section: # These definitions are from config.sh (via /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1/darwin-2level/Config.pm). # They may have been overridden via Makefile.PL or on the command line. AR = ar CC = cc CCCDLFLAGS = CCDLFLAGS = DLEXT = bundle DLSRC = dl_dlopen.xs EXE_EXT = FULL_AR = /usr/bin/ar LD = env MACOSX_DEPLOYMENT_TARGET=10.3 cc LDDLFLAGS = -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector LDFLAGS = -fstack-protector -L/usr/local/lib LIBC = LIB_EXT = .a OBJ_EXT = .o OSNAME = darwin OSVERS = 12.4.0 RANLIB = ranlib SITELIBEXP = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/site_perl/5.18.1 SITEARCHEXP = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/site_perl/5.18.1/darwin-2level SO = dylib VENDORARCHEXP = VENDORLIBEXP = # --- MakeMaker constants section: AR_STATIC_ARGS = cr DIRFILESEP = / DFSEP = $(DIRFILESEP) NAME = DateTime::Format::Pg NAME_SYM = DateTime_Format_Pg VERSION = 0.16008 VERSION_MACRO = VERSION VERSION_SYM = 0_16008 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" XS_VERSION = 0.16008 XS_VERSION_MACRO = XS_VERSION XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\" INST_ARCHLIB = blib/arch INST_SCRIPT = blib/script INST_BIN = blib/bin INST_LIB = blib/lib INST_MAN1DIR = blib/man1 INST_MAN3DIR = blib/man3 MAN1EXT = 1 MAN3EXT = 3 INSTALLDIRS = site DESTDIR = PREFIX = $(SITEPREFIX) PERLPREFIX = /Users/daisuke/.plenv/versions/5.18.1 SITEPREFIX = /Users/daisuke/.plenv/versions/5.18.1 VENDORPREFIX = INSTALLPRIVLIB = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1 DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB) INSTALLSITELIB = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/site_perl/5.18.1 DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB) INSTALLVENDORLIB = DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB) INSTALLARCHLIB = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1/darwin-2level DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB) INSTALLSITEARCH = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/site_perl/5.18.1/darwin-2level DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH) INSTALLVENDORARCH = DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH) INSTALLBIN = /Users/daisuke/.plenv/versions/5.18.1/bin DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN) INSTALLSITEBIN = /Users/daisuke/.plenv/versions/5.18.1/bin DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN) INSTALLVENDORBIN = DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN) INSTALLSCRIPT = /Users/daisuke/.plenv/versions/5.18.1/bin DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT) INSTALLSITESCRIPT = /Users/daisuke/.plenv/versions/5.18.1/bin DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT) INSTALLVENDORSCRIPT = DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT) INSTALLMAN1DIR = /Users/daisuke/.plenv/versions/5.18.1/man/man1 DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR) INSTALLSITEMAN1DIR = /Users/daisuke/.plenv/versions/5.18.1/man/man1 DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR) INSTALLVENDORMAN1DIR = DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR) INSTALLMAN3DIR = /Users/daisuke/.plenv/versions/5.18.1/man/man3 DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR) INSTALLSITEMAN3DIR = /Users/daisuke/.plenv/versions/5.18.1/man/man3 DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR) INSTALLVENDORMAN3DIR = DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR) PERL_LIB = PERL_ARCHLIB = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1/darwin-2level LIBPERL_A = libperl.a FIRST_MAKEFILE = Makefile MAKEFILE_OLD = Makefile.old MAKE_APERL_FILE = Makefile.aperl PERLMAINCC = $(CC) PERL_INC = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1/darwin-2level/CORE PERL = /Users/daisuke/.plenv/versions/5.18.1/bin/perl5.18.1 "-Iinc" FULLPERL = /Users/daisuke/.plenv/versions/5.18.1/bin/perl5.18.1 "-Iinc" ABSPERL = $(PERL) PERLRUN = $(PERL) FULLPERLRUN = $(FULLPERL) ABSPERLRUN = $(ABSPERL) PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)" FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)" ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)" PERL_CORE = 0 PERM_DIR = 755 PERM_RW = 644 PERM_RWX = 755 MAKEMAKER = /Users/daisuke/.plenv/versions/5.18.1/lib/perl5/5.18.1/ExtUtils/MakeMaker.pm MM_VERSION = 6.66 MM_REVISION = 66600 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. MAKE = make FULLEXT = DateTime/Format/Pg BASEEXT = Pg PARENT_NAME = DateTime::Format DLBASE = $(BASEEXT) VERSION_FROM = lib/DateTime/Format/Pg.pm OBJECT = LDFROM = $(OBJECT) LINKTYPE = dynamic BOOTDEP = # Handy lists of source code files: XS_FILES = C_FILES = O_FILES = H_FILES = MAN1PODS = MAN3PODS = lib/DateTime/Format/Pg.pm # Where is the Config information that we are using/depend on CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h # Where to build things INST_LIBDIR = $(INST_LIB)/DateTime/Format INST_ARCHLIBDIR = $(INST_ARCHLIB)/DateTime/Format INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) INST_STATIC = INST_DYNAMIC = INST_BOOT = # Extra linker info EXPORT_LIST = PERL_ARCHIVE = PERL_ARCHIVE_AFTER = TO_INST_PM = lib/DateTime/Format/Pg.pm PM_TO_BLIB = lib/DateTime/Format/Pg.pm \ blib/lib/DateTime/Format/Pg.pm # --- MakeMaker platform_constants section: MM_Unix_VERSION = 6.66 PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc # --- MakeMaker tool_autosplit section: # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$$$ARGV[0], $$$$ARGV[1], 0, 1, 1)' -- # --- MakeMaker tool_xsubpp section: # --- MakeMaker tools_other section: SHELL = /bin/sh CHMOD = chmod CP = cp MV = mv NOOP = $(TRUE) NOECHO = @ RM_F = rm -f RM_RF = rm -rf TEST_F = test -f TOUCH = touch UMASK_NULL = umask 0 DEV_NULL = > /dev/null 2>&1 MKPATH = $(ABSPERLRUN) -MExtUtils::Command -e 'mkpath' -- EQUALIZE_TIMESTAMP = $(ABSPERLRUN) -MExtUtils::Command -e 'eqtime' -- FALSE = false TRUE = true ECHO = echo ECHO_N = echo -n UNINST = 0 VERBINST = 0 MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install([ from_to => {@ARGV}, verbose => '\''$(VERBINST)'\'', uninstall_shadows => '\''$(UNINST)'\'', dir_mode => '\''$(PERM_DIR)'\'' ]);' -- DOC_INSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'perllocal_install' -- UNINSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'uninstall' -- WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'warn_if_old_packlist' -- MACROSTART = MACROEND = USEMAKEFILE = -f FIXIN = $(ABSPERLRUN) -MExtUtils::MY -e 'MY->fixin(shift)' -- # --- MakeMaker makemakerdflt section: makemakerdflt : all $(NOECHO) $(NOOP) # --- MakeMaker dist section: TAR = COPY_EXTENDED_ATTRIBUTES_DISABLE=1 COPYFILE_DISABLE=1 tar TARFLAGS = cvf ZIP = zip ZIPFLAGS = -r COMPRESS = gzip --best SUFFIX = .gz SHAR = shar PREOP = $(NOECHO) $(NOOP) POSTOP = $(NOECHO) $(NOOP) TO_UNIX = $(NOECHO) $(NOOP) CI = ci -u RCS_LABEL = rcs -Nv$(VERSION_SYM): -q DIST_CP = best DIST_DEFAULT = tardist DISTNAME = DateTime-Format-Pg DISTVNAME = DateTime-Format-Pg-0.16008 # --- MakeMaker macro section: # --- MakeMaker depend section: # --- MakeMaker cflags section: # --- MakeMaker const_loadlibs section: # --- MakeMaker const_cccmd section: # --- MakeMaker post_constants section: # --- MakeMaker pasthru section: PASTHRU = LIBPERL_A="$(LIBPERL_A)"\ LINKTYPE="$(LINKTYPE)"\ PREFIX="$(PREFIX)" # --- MakeMaker special_targets section: .SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) .PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir # --- MakeMaker c_o section: # --- MakeMaker xs_c section: # --- MakeMaker xs_o section: # --- MakeMaker top_targets section: all :: pure_all manifypods $(NOECHO) $(NOOP) pure_all :: config pm_to_blib subdirs linkext $(NOECHO) $(NOOP) subdirs :: $(MYEXTLIB) $(NOECHO) $(NOOP) config :: $(FIRST_MAKEFILE) blibdirs $(NOECHO) $(NOOP) help : perldoc ExtUtils::MakeMaker # --- MakeMaker blibdirs section: blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists $(NOECHO) $(NOOP) # Backwards compat with 6.18 through 6.25 blibdirs.ts : blibdirs $(NOECHO) $(NOOP) $(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_LIBDIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_LIBDIR) $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHLIB) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHLIB) $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_AUTODIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_AUTODIR) $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHAUTODIR) $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_BIN) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_BIN) $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_SCRIPT) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_SCRIPT) $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN1DIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN1DIR) $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL $(NOECHO) $(MKPATH) $(INST_MAN3DIR) $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN3DIR) $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists # --- MakeMaker linkext section: linkext :: $(LINKTYPE) $(NOECHO) $(NOOP) # --- MakeMaker dlsyms section: # --- MakeMaker dynamic section: dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) $(NOECHO) $(NOOP) # --- MakeMaker dynamic_bs section: BOOTSTRAP = # --- MakeMaker dynamic_lib section: # --- MakeMaker static section: ## $(INST_PM) has been moved to the all: target. ## It remains here for awhile to allow for old usage: "make static" static :: $(FIRST_MAKEFILE) $(INST_STATIC) $(NOECHO) $(NOOP) # --- MakeMaker static_lib section: # --- MakeMaker manifypods section: POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" POD2MAN = $(POD2MAN_EXE) manifypods : pure_all \ lib/DateTime/Format/Pg.pm $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \ lib/DateTime/Format/Pg.pm $(INST_MAN3DIR)/DateTime::Format::Pg.$(MAN3EXT) # --- MakeMaker processPL section: # --- MakeMaker installbin section: # --- MakeMaker subdirs section: # none # --- MakeMaker clean_subdirs section: clean_subdirs : $(NOECHO) $(NOOP) # --- MakeMaker clean section: # Delete temporary files but do not touch installed files. We don't delete # the Makefile here so a later make realclean still has a makefile to use. clean :: clean_subdirs - $(RM_F) \ MYMETA.json $(BASEEXT).bso \ core $(INST_ARCHAUTODIR)/extralibs.ld \ perl$(EXE_EXT) mon.out \ *perl.core $(MAKE_APERL_FILE) \ lib$(BASEEXT).def $(BOOTSTRAP) \ core.[0-9][0-9] core.[0-9] \ tmon.out *$(OBJ_EXT) \ pm_to_blib.ts $(BASEEXT).def \ perl core.*perl.*.? \ core.[0-9][0-9][0-9][0-9][0-9] so_locations \ perl.exe *$(LIB_EXT) \ $(INST_ARCHAUTODIR)/extralibs.all $(BASEEXT).exp \ core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] \ perlmain.c $(BASEEXT).x \ MYMETA.yml pm_to_blib \ blibdirs.ts - $(RM_RF) \ blib - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) # --- MakeMaker realclean_subdirs section: realclean_subdirs : $(NOECHO) $(NOOP) # --- MakeMaker realclean section: # Delete temporary files (via clean) and also delete dist files realclean purge :: clean realclean_subdirs - $(RM_F) \ $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - $(RM_RF) \ $(DISTVNAME) MYMETA.yml # --- MakeMaker metafile section: metafile : $(NOECHO) $(NOOP) # --- MakeMaker signature section: signature : cpansign -s # --- MakeMaker dist_basics section: distclean :: realclean distcheck $(NOECHO) $(NOOP) distcheck : $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck skipcheck : $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck manifest : $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest veryclean : realclean $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old # --- MakeMaker dist_core section: dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \ -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' -- tardist : $(DISTVNAME).tar$(SUFFIX) $(NOECHO) $(NOOP) uutardist : $(DISTVNAME).tar$(SUFFIX) uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu $(DISTVNAME).tar$(SUFFIX) : distdir $(PREOP) $(TO_UNIX) $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(COMPRESS) $(DISTVNAME).tar $(POSTOP) zipdist : $(DISTVNAME).zip $(NOECHO) $(NOOP) $(DISTVNAME).zip : distdir $(PREOP) $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) $(RM_RF) $(DISTVNAME) $(POSTOP) shdist : distdir $(PREOP) $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar $(RM_RF) $(DISTVNAME) $(POSTOP) # --- MakeMaker distdir section: create_distdir : $(RM_RF) $(DISTVNAME) $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" distdir : create_distdir $(NOECHO) $(NOOP) # --- MakeMaker dist_test section: disttest : distdir cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL cd $(DISTVNAME) && $(MAKE) $(PASTHRU) cd $(DISTVNAME) && $(MAKE) test $(PASTHRU) # --- MakeMaker dist_ci section: ci : $(PERLRUN) "-MExtUtils::Manifest=maniread" \ -e "@all = keys %{ maniread() };" \ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});" # --- MakeMaker distmeta section: distmeta : create_distdir metafile $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -e q{META.yml};' \ -e 'eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) }' \ -e ' or print "Could not add META.yml to MANIFEST: $$$${'\''@'\''}\n"' -- $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -f q{META.json};' \ -e 'eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) }' \ -e ' or print "Could not add META.json to MANIFEST: $$$${'\''@'\''}\n"' -- # --- MakeMaker distsignature section: distsignature : create_distdir $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \ -e ' or print "Could not add SIGNATURE to MANIFEST: $$$${'\''@'\''}\n"' -- $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE cd $(DISTVNAME) && cpansign -s # --- MakeMaker install section: install :: pure_install doc_install $(NOECHO) $(NOOP) install_perl :: pure_perl_install doc_perl_install $(NOECHO) $(NOOP) install_site :: pure_site_install doc_site_install $(NOECHO) $(NOOP) install_vendor :: pure_vendor_install doc_vendor_install $(NOECHO) $(NOOP) pure_install :: pure_$(INSTALLDIRS)_install $(NOECHO) $(NOOP) doc_install :: doc_$(INSTALLDIRS)_install $(NOECHO) $(NOOP) pure__install : pure_site_install $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site doc__install : doc_site_install $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site pure_perl_install :: all $(NOECHO) $(MOD_INSTALL) \ read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \ write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \ $(INST_LIB) $(DESTINSTALLPRIVLIB) \ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ $(INST_BIN) $(DESTINSTALLBIN) \ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR) $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ $(SITEARCHEXP)/auto/$(FULLEXT) pure_site_install :: all $(NOECHO) $(MOD_INSTALL) \ read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \ write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \ $(INST_LIB) $(DESTINSTALLSITELIB) \ $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \ $(INST_BIN) $(DESTINSTALLSITEBIN) \ $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR) $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ $(PERL_ARCHLIB)/auto/$(FULLEXT) pure_vendor_install :: all $(NOECHO) $(MOD_INSTALL) \ read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \ write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \ $(INST_LIB) $(DESTINSTALLVENDORLIB) \ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ $(INST_BIN) $(DESTINSTALLVENDORBIN) \ $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \ $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) doc_perl_install :: all $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) -$(NOECHO) $(DOC_INSTALL) \ "Module" "$(NAME)" \ "installed into" "$(INSTALLPRIVLIB)" \ LINKTYPE "$(LINKTYPE)" \ VERSION "$(VERSION)" \ EXE_FILES "$(EXE_FILES)" \ >> $(DESTINSTALLARCHLIB)/perllocal.pod doc_site_install :: all $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) -$(NOECHO) $(DOC_INSTALL) \ "Module" "$(NAME)" \ "installed into" "$(INSTALLSITELIB)" \ LINKTYPE "$(LINKTYPE)" \ VERSION "$(VERSION)" \ EXE_FILES "$(EXE_FILES)" \ >> $(DESTINSTALLARCHLIB)/perllocal.pod doc_vendor_install :: all $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) -$(NOECHO) $(DOC_INSTALL) \ "Module" "$(NAME)" \ "installed into" "$(INSTALLVENDORLIB)" \ LINKTYPE "$(LINKTYPE)" \ VERSION "$(VERSION)" \ EXE_FILES "$(EXE_FILES)" \ >> $(DESTINSTALLARCHLIB)/perllocal.pod uninstall :: uninstall_from_$(INSTALLDIRS)dirs $(NOECHO) $(NOOP) uninstall_from_perldirs :: $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist uninstall_from_sitedirs :: $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist uninstall_from_vendordirs :: $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist # --- MakeMaker force section: # Phony target to force checking subdirectories. FORCE : $(NOECHO) $(NOOP) # --- MakeMaker perldepend section: # --- MakeMaker makefile section: # We take a very conservative approach here, but it's worth it. # We move Makefile to Makefile.old here to avoid gnu make looping. $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) $(PERLRUN) Makefile.PL $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" $(FALSE) # --- MakeMaker staticmake section: # --- MakeMaker makeaperl section --- MAP_TARGET = perl FULLPERL = /Users/daisuke/.plenv/versions/5.18.1/bin/perl5.18.1 $(MAP_TARGET) :: static $(MAKE_APERL_FILE) $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) $(NOECHO) $(PERLRUNINST) \ Makefile.PL DIR= \ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= # --- MakeMaker test section: TEST_VERBOSE=0 TEST_TYPE=test_$(LINKTYPE) TEST_FILE = test.pl TEST_FILES = t/*.t TESTDB_SW = -d testdb :: testdb_$(LINKTYPE) test :: $(TEST_TYPE) subdirs-test subdirs-test :: $(NOECHO) $(NOOP) test_dynamic :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) testdb_dynamic :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-Iinc" "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE) test_ : test_dynamic test_static :: test_dynamic testdb_static :: testdb_dynamic # --- MakeMaker ppd section: # Creates a PPD (Perl Package Description) for a binary distribution. ppd : $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd $(NOECHO) $(ECHO) ' Parse and format PostgreSQL dates and times' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' Daisuke Maki <daisuke@endeworks.jp>' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) '' >> $(DISTNAME).ppd # --- MakeMaker pm_to_blib section: pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM) $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \ lib/DateTime/Format/Pg.pm blib/lib/DateTime/Format/Pg.pm $(NOECHO) $(TOUCH) pm_to_blib # --- MakeMaker selfdocument section: # --- MakeMaker postamble section: # End. # Postamble by Module::Install 1.06 README.md000644000765000024 3112412206306510 16443 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009# NAME DateTime::Format::Pg - Parse and format PostgreSQL dates and times # SYNOPSIS use DateTime::Format::Pg; my $dt = DateTime::Format::Pg->parse_datetime( '2003-01-16 23:12:01' ); # 2003-01-16 23:12:01 DateTime::Format::Pg->format_datetime($dt); # DESCRIPTION This module understands the formats used by PostgreSQL for its DATE, TIME, TIMESTAMP, and INTERVAL data types. It can be used to parse these formats in order to create `DateTime` or `DateTime::Duration` objects, and it can take a `DateTime` or `DateTime::Duration` object and produce a string representing it in a format accepted by PostgreSQL. # CONSTRUCTORS The following methods can be used to create `DateTime::Format::Pg` objects. - new( name => value, ... ) Creates a new `DateTime::Format::Pg` instance. This is generally not required for simple operations. If you wish to use a different parsing style from the default then it is more comfortable to create an object. my $parser = DateTime::Format::Pg->new() my $copy = $parser->new( 'european' => 1 ); This method accepts the following options: - european If european is set to non-zero, dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL). This option only has an effect if PostgreSQL is set to output dates in the 'PostgreSQL' (DATE only) and 'SQL' (DATE and TIMESTAMP) styles. Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default. - server\_tz This option can be set to a `DateTime::TimeZone` object or a string that contains a time zone name. This value must be set to the same value as the PostgreSQL server's time zone in order to parse TIMESTAMP WITH TIMEZONE values in the 'PostgreSQL', 'SQL', and 'German' formats correctly. Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default. - clone() This method is provided for those who prefer to explicitly clone via a method called `clone()`. my $clone = $original->clone(); If called as a class method it will die. # METHODS This class provides the following methods. The parse\_datetime, parse\_duration, format\_datetime, and format\_duration methods are general-purpose methods provided for compatibility with other `DateTime::Format` modules. The other methods are specific to the corresponding PostgreSQL date/time data types. The names of these methods are derived from the name of the PostgreSQL data type. (Note: Prior to PostgreSQL 7.3, the TIMESTAMP type was equivalent to the TIMESTAMP WITH TIME ZONE type. This data type corresponds to the format/parse\_timestamp\_with\_time\_zone method but not to the format/parse\_timestamp method.) ## PARSING METHODS This class provides the following parsing methods. As a general rule, the parsing methods accept input in any format that the PostgreSQL server can produce. However, if PostgreSQL's DateStyle is set to 'SQL' or 'PostgreSQL', dates can only be parsed correctly if the 'european' option is set correctly (i.e. same as the PostgreSQL server). The same is true for time zones and the 'australian\_timezones' option in all modes but 'ISO'. The default DateStyle, 'ISO', will always produce unambiguous results and is also parsed most efficiently by this parser class. I strongly recommend using this setting unless you have a good reason not to. - parse\_datetime($string,...) Given a string containing a date and/or time representation, this method will return a new `DateTime` object. If the input string does not contain a date, it is set to 1970-01-01. If the input string does not contain a time, it is set to 00:00:00. If the input string does not contain a time zone, it is set to the floating time zone. If given an improperly formatted string, this method may die. - parse\_timestamptz($string,...) - parse\_timestamp\_with\_time\_zone($string,...) Given a string containing a timestamp (date and time) representation, this method will return a new `DateTime` object. This method is suitable for the TIMESTAMPTZ (or TIMESTAMP WITH TIME ZONE) type. If the input string does not contain a time zone, it is set to the floating time zone. Please note that PostgreSQL does not actually store a time zone along with the TIMESTAMP WITH TIME ZONE (or TIMESTAMPTZ) type but will just return a time stamp converted for the server's local time zone. If given an improperly formatted string, this method may die. - parse\_timestamp($string,...) - parse\_timestamp\_without\_time\_zone($string,...) Similar to the functions above, but always returns a `DateTime` object with a floating time zone. This method is suitable for the TIMESTAMP (or TIMESTAMP WITHOUT TIME ZONE) type. If the server does return a time zone, it is ignored. If given an improperly formatted string, this method may die. - parse\_timetz($string,...) - parse\_time\_with\_time\_zone($string,...) Given a string containing a time representation, this method will return a new `DateTime` object. The date is set to 1970-01-01. This method is suitable for the TIMETZ (or TIME WITH TIME ZONE) type. If the input string does not contain a time zone, it is set to the floating time zone. Please note that PostgreSQL stores a numerical offset with its TIME WITH TIME ZONE (or TIMETZ) type. It does not store a time zone name (such as 'Europe/Rome'). If given an improperly formatted string, this method may die. - parse\_time($string,...) - parse\_time\_without\_time\_zone($string,...) Similar to the functions above, but always returns an `DateTime` object with a floating time zone. If the server returns a time zone, it is ignored. This method is suitable for use with the TIME (or TIME WITHOUT TIME ZONE) type. This ensures that the resulting `DateTime` object will always have the time zone expected by your application. If given an improperly formatted string, this method may die. - parse\_date($string,...) Given a string containing a date representation, this method will return a new `DateTime` object. The time is set to 00:00:00 (floating time zone). This method is suitable for the DATE type. If given an improperly formatted string, this method may die. - parse\_duration($string) - parse\_interval($string) Given a string containing a duration (SQL type INTERVAL) representation, this method will return a new `DateTime::Duration` object. If given an improperly formatted string, this method may die. ## FORMATTING METHODS This class provides the following formatting methods. The output is always in the format mandated by the SQL standard (derived from ISO 8601), which is parsed by PostgreSQL unambiguously in all DateStyle modes. - format\_datetime($datetime,...) Given a `DateTime` object, this method returns a string appropriate as input for all date and date/time types of PostgreSQL. It will contain date and time. If the time zone of the `DateTime` part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. Otherwise, the numerical offset of the time zone is used. - format\_time($datetime,...) - format\_time\_without\_time\_zone($datetime,...) Given a `DateTime` object, this method returns a string appropriate as input for the TIME type (also known as TIME WITHOUT TIME ZONE), which will contain the local time of the `DateTime` object and no time zone. - format\_timetz($datetime) - format\_time\_with\_time\_zone($datetime) Given a `DateTime` object, this method returns a string appropriate as input for the TIME WITH TIME ZONE type (also known as TIMETZ), which will contain the local part of the `DateTime` object and a numerical time zone. You should not use the TIME WITH TIME ZONE type to store dates with floating time zones. If the time zone of the `DateTime` part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. - format\_date($datetime) Given a `DateTime` object, this method returns a string appropriate as input for the DATE type, which will contain the date part of the `DateTime` object. - format\_timestamp($datetime) - format\_timestamp\_without\_time\_zone($datetime) Given a `DateTime` object, this method returns a string appropriate as input for the TIMESTAMP type (also known as TIMESTAMP WITHOUT TIME ZONE), which will contain the local time of the `DateTime` object and no time zone. - format\_timestamptz($datetime) - format\_timestamp\_with\_time\_zone($datetime) Given a `DateTime` object, this method returns a string appropriate as input for the TIMESTAMP WITH TIME ZONE type, which will contain the local part of the `DateTime` object and a numerical time zone. You should not use the TIMESTAMP WITH TIME ZONE type to store dates with floating time zones. If the time zone of the `DateTime` part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. - format\_duration($du) - format\_interval($du) Given a `DateTime::Duration` object, this method returns a string appropriate as input for the INTERVAL type. # LIMITATIONS Some output formats of PostgreSQL have limitations that can only be passed on by this class. As a general rules, none of these limitations apply to the 'ISO' output format. It is strongly recommended to use this format (and to use PostgreSQL's to\_char function when another output format that's not supposed to be handled by a parser of this class is desired). 'ISO' is the default but you are advised to explicitly set it at the beginning of the session by issuing a SET DATESTYLE TO 'ISO'; command in case the server administrator changes that setting. When formatting DateTime objects, this class always uses a format that's handled unambiguously by PostgreSQL. ## TIME ZONES If DateStyle is set to 'PostgreSQL', 'SQL', or 'German', PostgreSQL does not send numerical time zones for the TIMESTAMPTZ (or TIMESTAMP WITH TIME ZONE) type. Unfortunatly, the time zone names used instead can be ambiguous: For example, 'EST' can mean -0500, +1000, or +1100. You must set the 'server\_tz' variable to a time zone that is identical to that of the PostgreSQL server. If the server is set to a different time zone (or the underlying operating system interprets the time zone differently), the parser will return wrong times. You can avoid such problems by setting the server's time zone to UTC using the SET TIME ZONE 'UTC' command and setting 'server\_tz' parameter to 'UTC' (or by using the ISO output format, of course). ## EUROPEAN DATES For the SQL (for DATE and TIMSTAMP\[TZ\]) and the PostgreSQL (for DATE) output format, the server can send dates in both European-style 'dd/mm/yyyy' and in US-style 'mm/dd/yyyy' format. In order to parse these dates correctly, you have to pass the 'european' option to the constructor or to the `parse_xxx` routines. This problem does not occur when using the ISO or German output format (and for PostgreSQL with TIMESTAMP\[TZ\] as month names are used then). ## INTERVAL ELEMENTS `DateTime::Duration` stores months, days, minutes and seconds separately. PostgreSQL only stores months and seconds and disregards the irregular length of days due to DST switching and the irregular length of minutes due to leap seconds. Therefore, it is not possible to store `DateTime::Duration` objects as SQL INTERVALs without the loss of some information. ## NEGATIVE INTERVALS In the SQL and German output formats, the server does not send an indication of the sign with intervals. This means that '1 month ago' and '1 month' are both returned as '1 mon'. This problem can only be avoided by using the 'ISO' or 'PostgreSQL' output format. # SUPPORT Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. # AUTHOR Daisuke Maki # AUTHOR EMERITUS Claus A. Faerber # COPYRIGHT Copyright (c) 2003 Claus A. Faerber. Copyright (c) 2005-2007 Daisuke Maki 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. # SEE ALSO datetime@perl.org mailing list http://datetime.perl.org/ cpanfile000644000765000024 31712206306510 16630 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009requires 'DateTime', '0.10'; requires 'DateTime::Format::Builder', '0.72'; requires 'DateTime::TimeZone', '0.05'; on build => sub { requires 'ExtUtils::MakeMaker', '6.36'; requires 'Test::More'; }; Pg.pm000644000765000024 6401112206306510 21563 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/lib/DateTime/Formatpackage DateTime::Format::Pg; use strict; use vars qw ($VERSION); use Carp; use DateTime 0.13; use DateTime::Duration; use DateTime::Format::Builder 0.72; use DateTime::TimeZone 0.06; use DateTime::TimeZone::UTC; use DateTime::TimeZone::Floating; $VERSION = '0.16009'; $VERSION = eval $VERSION; our @ISA = ('DateTime::Format::Builder'); =head1 NAME DateTime::Format::Pg - Parse and format PostgreSQL dates and times =head1 SYNOPSIS use DateTime::Format::Pg; my $dt = DateTime::Format::Pg->parse_datetime( '2003-01-16 23:12:01' ); # 2003-01-16 23:12:01 DateTime::Format::Pg->format_datetime($dt); =head1 DESCRIPTION This module understands the formats used by PostgreSQL for its DATE, TIME, TIMESTAMP, and INTERVAL data types. It can be used to parse these formats in order to create C or C objects, and it can take a C or C object and produce a string representing it in a format accepted by PostgreSQL. =head1 CONSTRUCTORS The following methods can be used to create C objects. =over 4 =item * new( name => value, ... ) Creates a new C instance. This is generally not required for simple operations. If you wish to use a different parsing style from the default then it is more comfortable to create an object. my $parser = DateTime::Format::Pg->new() my $copy = $parser->new( 'european' => 1 ); This method accepts the following options: =over 8 =item * european If european is set to non-zero, dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL). This option only has an effect if PostgreSQL is set to output dates in the 'PostgreSQL' (DATE only) and 'SQL' (DATE and TIMESTAMP) styles. Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default. =item * server_tz This option can be set to a C object or a string that contains a time zone name. This value must be set to the same value as the PostgreSQL server's time zone in order to parse TIMESTAMP WITH TIMEZONE values in the 'PostgreSQL', 'SQL', and 'German' formats correctly. Note that you don't have to set this option if the PostgreSQL server has been set to use the 'ISO' format, which is the default. =back =cut sub _add_param { my ($to,%param) = @_; foreach(keys %param) { if($_ eq 'european') { $$to{'_european'} = $param{$_}; } elsif($_ eq 'server_tz') { $$to{'_server_tz'} = $param{$_}; } else { croak("Unknown option $_." ); } } } sub european { my ($self,%param) = @_; return $param{'european'} if exists $param{'european'}; return $self->{'_european'} if ref $self; } sub server_tz { my ($self,%param) = @_; return $param{''} if (ref($param{'server_tz'})) =~ /TimeZone/; return DateTime::TimeZone->new('name' => $param{''}) if exists $param{'server_tz'}; return ((ref $self) && $self->{'_server_tz'}); } sub new { my $class = shift; my $self = bless {}, ref($class)||$class; if (ref $class) { $self->{'_european'} = ( scalar $class->{'_european'} ); } _add_param($self,@_); return $self; } =item * clone() This method is provided for those who prefer to explicitly clone via a method called C. my $clone = $original->clone(); If called as a class method it will die. =back =cut sub clone { my $self = shift; croak('Calling object method as class method!') unless ref $self; return $self->new(); } sub _create_infinity { my $self = shift; my %p = @_; if ($p{sign}) { return DateTime::Infinite::Past->new; } else { return DateTime::Infinite::Future->new; } } # infinite datetimes my $pg_infinity = { regex => qr/^(-)?infinity$/, params => [ qw(sign) ], constructor => \&_create_infinity, }; # Dates (without time zone) # # see EncodeDateOnly() in # pgsql-server/src/backend/utils/adt/datetime.c # # 2003-04-18 (USE_ISO_DATES) # my $pg_dateonly_iso = { regex => qr/^(\d{4,})-(\d{2,})-(\d{2,})( BC)?$/, params => [ qw( year month day era ) ], postprocess => \&_fix_era, }; # 18/04/2003 (USE_SQL_DATES, EuroDates) # 18-04-2003 (USE_POSTGRES_DATES, EuroDates) # 04/18/2003 (USE_SQL_DATES, !EuroDates) # 04-18-2003 (USE_POSTGRES_DATES, !EuroDates) # my $pg_dateonly_sql = { regex => qr/^(\d{2,})[\/-](\d{2,})[\/-](\d{4,})( BC)?$/, params => [ qw( month day year era) ], postprocess => [ \&_fix_era, \&_fix_eu ], }; # 18.04.2003 (USE_GERMAN_DATES) # my $pg_dateonly_german = { regex => qr/^(\d{2,})\.(\d{2,})\.(\d{4,})( BC)?$/, params => [ qw( day month year era ) ], postprocess => \&_fix_era }; # Times (with/without time zone) # # see EncodeTimeOnly() in # pgsql-server/src/backend/utils/adt/datetime.c # # 17:20:24.373942+02 # (NB: always uses numerical tz) # my $pg_timeonly = { regex => qr/^T?(\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? *([-\+][\d:]+)?$/, params => [ qw( hour minute second nanosecond time_zone) ], extra => { year => '1970' }, postprocess => [ \&_fix_timezone, \&_fix_nanosecond ], }; # Timestamps (with/without time zone) # # see EncodeDateTime() in # pgsql-server/src/backend/utils/adt/datetime.c # # 2003-04-18 17:20:24.373942+02 (USE_ISO_DATES) # (NB: always uses numerical tz) # my $pg_datetime_iso = { regex => qr/^(\d{4,})-(\d{2,})-(\d{2,})[ T](\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? *([-\+][\d:]+)?( BC)?$/, params => [ qw( year month day hour minute second nanosecond time_zone era) ], postprocess => [ \&_fix_era, \&_fix_timezone, \&_fix_nanosecond ], }; # Fri 18 Apr 17:20:24.373942 2003 CEST (USE_POSTGRES_DATES, EuroDates) # my $pg_datetime_pg_eu = { regex => qr/^\S{3,} (\d{2,}) (\S{3,}) (\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? (\d{4,}) *((?:[-\+][\d:]+)|(?:\S+))?( BC)?$/, params => [ qw( day month hour minute second nanosecond year time_zone era ) ], postprocess => [ \&_fix_era, \&_fix_timezone, \&_fix_nanosecond ], }; # Fri Apr 18 17:20:24.373942 2003 CEST (USE_POSTGRES_DATES, !EuroDates) # my $pg_datetime_pg_us = { regex => qr/^\S{3,} (\S{3,}) (\s{2,}) (\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? (\d{4,}) *((?:[-\+][\d:]+)|(?:\S+))?( BC)?$/, params => [ qw( month day hour minute second nanosecond year time_zone era ) ], postprocess => [ \&_fix_era, \&_fix_month_names, \&_fix_timezone, \&_fix_nanosecond ], }; # 18/04/2003 17:20:24.373942 CEST (USE_SQL_DATES, EuroDates) # 04/18/2003 17:20:24.373942 CEST (USE_SQL_DATES, !EuroDates) # my $pg_datetime_sql = { regex => qr/^(\d{2,})\/(\d{2,})\/(\d{4,}) (\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? *((?:[-\+][\d:]+)|(?:\S+))?( BC)?$/, params => [ qw( month day year hour minute second nanosecond time_zone era ) ], postprocess => [ \&_fix_era, \&_fix_eu, \&_fix_timezone, \&_fix_nanosecond ], }; # 18.04.2003 17:20:24.373942 CEST (USE_GERMAN_DATES) # my $pg_datetime_german = { regex => qr/^(\d{2,})\.(\d{2,})\.(\d{4,}) (\d{2,}):(\d{2,}):(\d{2,})(\.\d+)? *((?:[-\+][\d:]+)|(?:\S+))?( BC)?$/, params => [ qw( day month year hour minute second nanosecond time_zone era ) ], postprocess => [ \&_fix_era, \&_fix_timezone, \&_fix_nanosecond ], }; # Helper functions # # Fix BC dates (1 BC => year 0, 2 BC => year -1) # sub _fix_era { my %args = @_; my $era = (delete $args{'parsed'}->{'era'}) || ''; if ($era =~ m/BC/) { $args{'parsed'}->{'year'} = 1-$args{'parsed'}->{'year'} } return 1; } # Fix European dates (swap month and day) # sub _fix_eu { my %args = @_; if($args{'self'}->european(@{$args{'args'}}) ) { my $save = $args{'parsed'}->{'month'}; $args{'parsed'}->{'month'} = $args{'parsed'}->{'day'}; $args{'parsed'}->{'day'} = $save; } return 1; } # Fix month names (name => numeric) # my %months = ( 'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4, 'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8, 'sep' => 9, 'oct' =>10, 'nov' =>11, 'dec' =>12, ); sub _fix_month_names { my %args = @_; $args{'parsed'}->{'month'} = $months{lc( $args{'parsed'}->{'month'} )}; return $args{'parsed'}->{'month'} ? 1 : undef; } # Fix time zones # sub _fix_timezone { my %args = @_; my %param = $args{'args'} ? (@{$args{'args'}}) : (); if($param{'_force_tz'}) { $args{'parsed'}->{'time_zone'} = $param{'_force_tz'}; } elsif(!defined($args{'parsed'}->{'time_zone'})) { # For very early and late dates, PostgreSQL always returns times in # UTC and does not tell us that it did so. # if ( $args{'parsed'}->{'year'} < 1901 || ( $args{'parsed'}->{'year'} == 1901 && ($args{'parsed'}->{'month'} < 12 || $args{'parsed'}->{'day'} < 14) ) || $args{'parsed'}->{'year'} > 2038 || ( $args{'parsed'}->{'year'} == 2038 && ($args{'parsed'}->{'month'} > 01 || $args{'parsed'}->{'day'} > 18) ) ) { $args{'parsed'}->{'time_zone'} = DateTime::TimeZone::UTC->new(); } # DT->new() does not like undef time_zone params, which are generated # by the regexps # else { delete $args{'parsed'}->{'time_zone'}; } } # Numerical time zone # elsif($args{'parsed'}->{'time_zone'} =~ m/^([-\+])(\d+)(?::(\d+))?(?::(\d+))?$/) { my $tz; if (length($2) == 2) { # regular hour notation my ($min, $sec) = ($3 || '00', $4 || '00'); $tz = sprintf "%s%02d:%02d:%02d", $1, $2, $min, $sec; } else { $tz = "$1$2"; } $args{'parsed'}->{'time_zone'} = $tz; } # Non-numerical time zone returned, which can be ambiguous :( # else { # XXX This barfs because 'self' may not necessarily be initialized # Need to fix it my $stz = $args{'self'}->_server_tz($args{'args'} ? @{$args{'args'}} : ()); $args{'parsed'}->{'time_zone'} = $stz || 'floating'; } return 1; } # Fix fractional seconds # sub _fix_nanosecond { my %args = @_; if(defined $args{'parsed'}->{'nanosecond'}) { $args{'parsed'}->{'nanosecond'} *= 1.0E9; } else { delete $args{'parsed'}->{'nanosecond'} }; return 1; } # Parser generation # DateTime::Format::Builder->create_class ( parsers => { parse_date => [ $pg_dateonly_iso, $pg_dateonly_sql, $pg_dateonly_german, $pg_infinity ], parse_timetz => [ $pg_timeonly, ], parse_timestamptz => [ $pg_datetime_iso, $pg_datetime_pg_eu, $pg_datetime_pg_us, $pg_datetime_sql, $pg_datetime_german, $pg_infinity ], parse_datetime => [ $pg_datetime_iso, $pg_datetime_pg_eu, $pg_datetime_pg_us, $pg_datetime_sql, $pg_datetime_german, $pg_dateonly_iso, $pg_dateonly_german, $pg_dateonly_sql, $pg_timeonly, $pg_infinity], } ); =head1 METHODS This class provides the following methods. The parse_datetime, parse_duration, format_datetime, and format_duration methods are general-purpose methods provided for compatibility with other C modules. The other methods are specific to the corresponding PostgreSQL date/time data types. The names of these methods are derived from the name of the PostgreSQL data type. (Note: Prior to PostgreSQL 7.3, the TIMESTAMP type was equivalent to the TIMESTAMP WITH TIME ZONE type. This data type corresponds to the format/parse_timestamp_with_time_zone method but not to the format/parse_timestamp method.) =head2 PARSING METHODS This class provides the following parsing methods. As a general rule, the parsing methods accept input in any format that the PostgreSQL server can produce. However, if PostgreSQL's DateStyle is set to 'SQL' or 'PostgreSQL', dates can only be parsed correctly if the 'european' option is set correctly (i.e. same as the PostgreSQL server). The same is true for time zones and the 'australian_timezones' option in all modes but 'ISO'. The default DateStyle, 'ISO', will always produce unambiguous results and is also parsed most efficiently by this parser class. I strongly recommend using this setting unless you have a good reason not to. =over 4 =item * parse_datetime($string,...) Given a string containing a date and/or time representation, this method will return a new C object. If the input string does not contain a date, it is set to 1970-01-01. If the input string does not contain a time, it is set to 00:00:00. If the input string does not contain a time zone, it is set to the floating time zone. If given an improperly formatted string, this method may die. =cut # sub parse_datetime { # *** created automatically *** # } =item * parse_timestamptz($string,...) =item * parse_timestamp_with_time_zone($string,...) Given a string containing a timestamp (date and time) representation, this method will return a new C object. This method is suitable for the TIMESTAMPTZ (or TIMESTAMP WITH TIME ZONE) type. If the input string does not contain a time zone, it is set to the floating time zone. Please note that PostgreSQL does not actually store a time zone along with the TIMESTAMP WITH TIME ZONE (or TIMESTAMPTZ) type but will just return a time stamp converted for the server's local time zone. If given an improperly formatted string, this method may die. =cut # sub parse_timestamptz { # *** created automatically *** # } *parse_timestamp_with_time_zone = \&parse_timestamptz; =item * parse_timestamp($string,...) =item * parse_timestamp_without_time_zone($string,...) Similar to the functions above, but always returns a C object with a floating time zone. This method is suitable for the TIMESTAMP (or TIMESTAMP WITHOUT TIME ZONE) type. If the server does return a time zone, it is ignored. If given an improperly formatted string, this method may die. =cut sub parse_timestamp { parse_timestamptz(@_,'_force_tz' => DateTime::TimeZone::Floating->new()); } *parse_timestamp_without_time_zone = \&parse_timestamp; =item * parse_timetz($string,...) =item * parse_time_with_time_zone($string,...) Given a string containing a time representation, this method will return a new C object. The date is set to 1970-01-01. This method is suitable for the TIMETZ (or TIME WITH TIME ZONE) type. If the input string does not contain a time zone, it is set to the floating time zone. Please note that PostgreSQL stores a numerical offset with its TIME WITH TIME ZONE (or TIMETZ) type. It does not store a time zone name (such as 'Europe/Rome'). If given an improperly formatted string, this method may die. =cut # sub parse_timetz { # *** created automatically *** # } *parse_time_with_time_zone = \&parse_timetz; =item * parse_time($string,...) =item * parse_time_without_time_zone($string,...) Similar to the functions above, but always returns an C object with a floating time zone. If the server returns a time zone, it is ignored. This method is suitable for use with the TIME (or TIME WITHOUT TIME ZONE) type. This ensures that the resulting C object will always have the time zone expected by your application. If given an improperly formatted string, this method may die. =cut sub parse_time { parse_timetz(@_,'_force_tz' => 'floating'); } *parse_time_without_time_zone = \&parse_time; =item * parse_date($string,...) Given a string containing a date representation, this method will return a new C object. The time is set to 00:00:00 (floating time zone). This method is suitable for the DATE type. If given an improperly formatted string, this method may die. =cut # sub parse_date { # *** generated automatically *** # } =item * parse_duration($string) =item * parse_interval($string) Given a string containing a duration (SQL type INTERVAL) representation, this method will return a new C object. If given an improperly formatted string, this method may die. =cut sub parse_duration { my ($self, $string) = @_; my ($year, $mon, $day, $sgn, $hour, $min, $sec, $frc, $ago) = $string =~ m{ \A # Start of string. (?:\@\s*)? # Optional leading @. (?:([-+]?\d+)\s+years?\s*)? # years (?:([-+]?\d+)\s+mons?\s*)? # months (?:([-+]?\d+)\s+days?\s*)? # days (?: # Start h/m/s # hours (?:([-+])?([0-9]\d|[1-9]\d{2,}(?=:)|\d+(?=\s+hour))(?:\s+hours?)?\s*)? # minutes (?::?((?<=:)[012345]\d|\d+(?=\s+mins?))(?:\s+mins?)?\s*)? # seconds (?::?((?<=:)[012345]\d|\d+(?=\.|\s+secs?))(\.\d+)?(?:\s+secs?)?\s*)? ?) # End hh:mm:ss (ago)? # Optional inversion \z # End of string }xms or croak "Invalid interval string $string"; # NB: We can't just pass our values to new() because it treats all # arguments as negative if we have a single negative component. # PostgreSQL might return mixed signs, e.g. '1 mon -1day'. my $du = DateTime::Duration->new; # Define for calculations $_ ||= 0 for $sec, $frc, $min, $day, $mon; # DT::Duration only stores years, days, months, seconds (and # nanoseconds) $mon += 12 * $year if $year; $min += 60 * $hour if $hour; # HH:MM:SS.FFFF share a single sign if ($sgn && $sgn eq '-') { $_ *= -1 for $min, $sec, $frc; } $du->add( months => $mon, days => $day, minutes => $min, seconds => $sec, nanoseconds => $frc * DateTime::Duration::MAX_NANOSECONDS, ); return $ago ? $du->inverse : $du; } *parse_interval = \&parse_duration; =back =head2 FORMATTING METHODS This class provides the following formatting methods. The output is always in the format mandated by the SQL standard (derived from ISO 8601), which is parsed by PostgreSQL unambiguously in all DateStyle modes. =over 4 =item * format_datetime($datetime,...) Given a C object, this method returns a string appropriate as input for all date and date/time types of PostgreSQL. It will contain date and time. If the time zone of the C part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. Otherwise, the numerical offset of the time zone is used. =cut *format_datetime = \&format_timestamptz; =item * format_time($datetime,...) =item * format_time_without_time_zone($datetime,...) Given a C object, this method returns a string appropriate as input for the TIME type (also known as TIME WITHOUT TIME ZONE), which will contain the local time of the C object and no time zone. =cut sub _format_fractional { my $ns = shift->nanosecond; return $ns ? sprintf(".%09d", "$ns") : '' } sub format_time { my ($self,$dt,%param) = @_; return $dt->hms(':')._format_fractional($dt); } *format_time_without_time_zone = \&format_time; =item * format_timetz($datetime) =item * format_time_with_time_zone($datetime) Given a C object, this method returns a string appropriate as input for the TIME WITH TIME ZONE type (also known as TIMETZ), which will contain the local part of the C object and a numerical time zone. You should not use the TIME WITH TIME ZONE type to store dates with floating time zones. If the time zone of the C part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. =cut sub _format_time_zone { my $dt = shift; return '' if $dt->time_zone->is_floating; return &DateTime::TimeZone::offset_as_string($dt->offset); } sub format_timetz { my ($self,$dt) = @_; return $dt->hms(':')._format_fractional($dt)._format_time_zone($dt); } *format_time_with_time_zone = \&format_timetz; =item * format_date($datetime) Given a C object, this method returns a string appropriate as input for the DATE type, which will contain the date part of the C object. =cut sub format_date { my ($self,$dt) = @_; if($dt->is_infinite) { return $dt->isa('DateTime::Infinite::Future') ? 'infinity' : '-infinity'; } elsif($dt->year()<=0) { return sprintf('%04d-%02d-%02d BC', 1-$dt->year(), $dt->month(), $dt->day()); } else { return $dt->ymd('-'); } } =item * format_timestamp($datetime) =item * format_timestamp_without_time_zone($datetime) Given a C object, this method returns a string appropriate as input for the TIMESTAMP type (also known as TIMESTAMP WITHOUT TIME ZONE), which will contain the local time of the C object and no time zone. =cut sub format_timestamp { my ($self,$dt,%param) = @_; if($dt->is_infinite) { return $dt->isa('DateTime::Infinite::Future') ? 'infinity' : '-infinity'; } elsif($dt->year()<=0) { return sprintf('%04d-%02d-%02d %s BC', 1-$dt->year(), $dt->month(), $dt->day(), $dt->hms(':')._format_fractional($dt)); } else { return $dt->ymd('-').' '.$dt->hms(':')._format_fractional($dt); } } *format_timestamp_without_time_zone = \&format_timestamp; =item * format_timestamptz($datetime) =item * format_timestamp_with_time_zone($datetime) Given a C object, this method returns a string appropriate as input for the TIMESTAMP WITH TIME ZONE type, which will contain the local part of the C object and a numerical time zone. You should not use the TIMESTAMP WITH TIME ZONE type to store dates with floating time zones. If the time zone of the C part is floating, the resulting string will contain no time zone, which will result in the server's time zone being used. =cut sub format_timestamptz { my ($self,$dt,%param) = @_; if($dt->is_infinite) { return $dt->isa('DateTime::Infinite::Future') ? 'infinity' : '-infinity'; } elsif($dt->year()<=0) { return sprintf('%04d-%02d-%02d', 1-$dt->year(), $dt->month(), $dt->day()). ' '. $dt->hms(':'). _format_fractional($dt). _format_time_zone($dt). ' BC'; } else { return $dt->ymd('-').' '.$dt->hms(':'). _format_fractional($dt). _format_time_zone($dt); } } *format_timestamp_with_time_zone = \&format_timestamptz; =item * format_duration($du) =item * format_interval($du) Given a C object, this method returns a string appropriate as input for the INTERVAL type. =cut sub format_duration { shift if UNIVERSAL::isa($_[0], __PACKAGE__) || $_[0] eq __PACKAGE__; my($du,%param) = @_; croak 'DateTime::Duration object expected' unless UNIVERSAL::isa($du,'DateTime::Duration'); my %deltas = $du->deltas(); my $output = '@'; if($deltas{'nanoseconds'}) { $deltas{'seconds'} = sprintf('%f', $deltas{'seconds'} + $deltas{'nanoseconds'} / DateTime::Duration::MAX_NANOSECONDS); } foreach(qw(months days minutes seconds)) { $output .= ' '.$deltas{$_}.' '.$_ if $deltas{$_}; } $output .= ' 0' if(length($output)<=2); return $output; } *format_interval = \&format_duration; =back =cut 1; __END__ =head1 LIMITATIONS Some output formats of PostgreSQL have limitations that can only be passed on by this class. As a general rules, none of these limitations apply to the 'ISO' output format. It is strongly recommended to use this format (and to use PostgreSQL's to_char function when another output format that's not supposed to be handled by a parser of this class is desired). 'ISO' is the default but you are advised to explicitly set it at the beginning of the session by issuing a SET DATESTYLE TO 'ISO'; command in case the server administrator changes that setting. When formatting DateTime objects, this class always uses a format that's handled unambiguously by PostgreSQL. =head2 TIME ZONES If DateStyle is set to 'PostgreSQL', 'SQL', or 'German', PostgreSQL does not send numerical time zones for the TIMESTAMPTZ (or TIMESTAMP WITH TIME ZONE) type. Unfortunatly, the time zone names used instead can be ambiguous: For example, 'EST' can mean -0500, +1000, or +1100. You must set the 'server_tz' variable to a time zone that is identical to that of the PostgreSQL server. If the server is set to a different time zone (or the underlying operating system interprets the time zone differently), the parser will return wrong times. You can avoid such problems by setting the server's time zone to UTC using the SET TIME ZONE 'UTC' command and setting 'server_tz' parameter to 'UTC' (or by using the ISO output format, of course). =head2 EUROPEAN DATES For the SQL (for DATE and TIMSTAMP[TZ]) and the PostgreSQL (for DATE) output format, the server can send dates in both European-style 'dd/mm/yyyy' and in US-style 'mm/dd/yyyy' format. In order to parse these dates correctly, you have to pass the 'european' option to the constructor or to the C routines. This problem does not occur when using the ISO or German output format (and for PostgreSQL with TIMESTAMP[TZ] as month names are used then). =head2 INTERVAL ELEMENTS C stores months, days, minutes and seconds separately. PostgreSQL only stores months and seconds and disregards the irregular length of days due to DST switching and the irregular length of minutes due to leap seconds. Therefore, it is not possible to store C objects as SQL INTERVALs without the loss of some information. =head2 NEGATIVE INTERVALS In the SQL and German output formats, the server does not send an indication of the sign with intervals. This means that '1 month ago' and '1 month' are both returned as '1 mon'. This problem can only be avoided by using the 'ISO' or 'PostgreSQL' output format. =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 Daisuke Maki Edaisuke@endeworks.jpE =head1 AUTHOR EMERITUS Claus A. Faerber =head1 COPYRIGHT Copyright (c) 2003 Claus A. Faerber. Copyright (c) 2005-2007 Daisuke Maki 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 1basic.t000644000765000024 54212206306510 16716 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: 1basic.t 1039 2003-05-30 14:04:49Z cfaerber $ use Test::More tests => 3; BEGIN { use_ok('DateTime::Format::Pg') }; { my $dt = DateTime::Format::Pg->parse_datetime('2003-01-01 19:00:00.123+09:30'); isa_ok($dt,'DateTime'); } { eval { my $dt = DateTime::Format::Pg->parse_datetime('THIS DATE IS INVALID'); fail(); } || pass(); } 2new-param.t000644000765000024 56012206306510 17525 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: 2new-param.t 1039 2003-05-30 14:04:49Z cfaerber $ use Test::More tests => 2; use DateTime::Format::Pg 0.02; my $p_eu = DateTime::Format::Pg->new( 'european' => 1); my $p_us = DateTime::Format::Pg->new( 'european' => 0); $dt = $p_eu->parse_date('26-04-2003'); is($dt->ymd(), '2003-04-26'); $dt = $p_us->parse_date('04-26-2003'); is($dt->ymd(), '2003-04-26'); 99-pod-coverage.t000644000765000024 40012206306510 20357 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t#!perl use Test::More; BEGIN { eval "use Test::Pod"; eval "use Test::Pod::Coverage"; if ($@) { plan(skip_all => "Test::Pod::Coverage required for testing POD"); eval "sub all_pod_coverage_ok {}"; } } all_pod_coverage_ok(); 99-pod.t000644000765000024 37612206306510 16602 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse Test::More; BEGIN { eval "use Test::Pod"; if ($@) { plan skip_all => "Test::Pod required for testing POD"; eval "sub all_pod_files_ok {}"; eval "sub all_pod_files {}"; } } all_pod_files_ok(all_pod_files(qw(blib)));format_date.t000644000765000024 135412206306510 20063 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: format_date.t 1039 2003-05-30 14:04:49Z cfaerber $ use Test::More tests => 5; use DateTime 0.10; use DateTime::Format::Pg 0.02; %tests = ( '2003-07-01' => { year => 2003, month => 7, day => 1, }, '1900-01-01' => { year => 1900, month => 1, day => 1, }, '0001-12-24 BC' => { year => 0, month => 12, day => 24, }, ); foreach my $result (keys %tests) { my $dt = DateTime->new( %{$tests{$result}} ); is( DateTime::Format::Pg->format_date($dt), $result ); } is( DateTime::Format::Pg->format_date(DateTime::Infinite::Future->new), 'infinity' ); is( DateTime::Format::Pg->format_date(DateTime::Infinite::Past->new), '-infinity' ); format_datetime.t000644000765000024 403512206306510 20741 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: format_datetime.t 3645 2007-03-23 03:01:42Z lestrrat $ use Test::More tests => 11; use DateTime 0.10; use DateTime::TimeZone; use DateTime::Format::Pg 0.02; %tests = ( '2003-07-01 04:05:06+0200' => { year => 2003, month => 7, day => 1, hour => 4, minute => 5, second => 6, time_zone => 'Europe/Berlin' }, '2003-01-01 04:05:06+0100' => { year => 2003, month => 1, day => 1, hour => 4, minute => 5, second => 6, time_zone => 'Europe/Berlin' }, '2003-07-01 04:05:06' => { year => 2003, month => 7, day => 1, hour => 4, minute => 5, second => 6, time_zone => 'floating' }, '2003-07-01 04:05:06+0000' => { year => 2003, month => 7, day => 1, hour => 4, minute => 5, second => 6, time_zone => 'UTC' }, '1901-01-01 02:00:00+0100' => { year => 1901, month => 1, day => 1, hour => 2, minute => 0, second => 0, time_zone => '+01:00' }, '0001-12-24 02:00:00+0100 BC' => { year => 0, month => 12, day => 24, hour => 2, minute => 0, second => 0, time_zone => '+01:00' }, '0001-12-24 02:00:00.000001234+0100 BC' => { year => 0, month => 12, day => 24, hour => 2, minute => 0, nanosecond=> 1234, second => 0, time_zone => '+01:00' }, ); foreach my $result (keys %tests) { my $dt = DateTime->new( %{$tests{$result}} ); is( DateTime::Format::Pg->format_datetime($dt), $result ); } is( DateTime::Format::Pg->format_datetime(DateTime::Infinite::Future->new), 'infinity' ); is( DateTime::Format::Pg->format_timestamp(DateTime::Infinite::Future->new), 'infinity' ); is( DateTime::Format::Pg->format_datetime(DateTime::Infinite::Past->new), '-infinity' ); is( DateTime::Format::Pg->format_timestamp(DateTime::Infinite::Past->new), '-infinity' ); format_fractional.t000644000765000024 105512206306510 21266 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse strict; use warnings; use Test::More tests => 1; use DateTime; use DateTime::Format::Pg; my $dt1 = DateTime->new( year => 2010, month => 6, day => 21, hour => 10, minute => 11, second => 9, nanosecond => 66727999, time_zone => 'Australia/Brisbane', ); my $ts1 = DateTime::Format::Pg->format_datetime($dt1); my $dt2 = DateTime::Format::Pg->parse_datetime($ts1); my $ts2 = DateTime::Format::Pg->format_datetime($dt2); is($ts1, $ts2, 'fractional timestamptz was parsed/formatted correctly'); format_interval.t000644000765000024 123212206306510 20765 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: format_interval.t 3403 2006-03-31 22:04:06Z lestrrat $ use Test::More tests => 4; use DateTime 0.10; use DateTime::Duration; use DateTime::Format::Pg 0.02; %tests = ( '@ 43 months 1 days' => { years => 3, months => 7, days => 1, }, '@ 210 days' => { weeks => 30, }, '@ 121 minutes 61 seconds' => { hours => 1, minutes => 61, seconds => 61, }, '@ 1 months 0.000003 seconds' => { months => 1, nanoseconds => 3000, }, ); foreach my $result (keys %tests) { my $dt = DateTime::Duration->new( %{$tests{$result}} ); is( DateTime::Format::Pg->format_interval($dt), $result ); } parse_date.t000644000765000024 366012206306510 17707 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_date.t 1039 2003-05-30 14:04:49Z cfaerber $ use Test::More tests => 18; use DateTime 0.10; use DateTime::TimeZone 0.12; use DateTime::Format::Pg 0.02; my $dt; # ISO # $dt = DateTime::Format::Pg->parse_date('2003-04-26'); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('1900-01-01'); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('0001-12-24 BC'); is($dt->ymd(), '0000-12-24'); # PostgreSQL # $dt = DateTime::Format::Pg->parse_date('26-04-2003', 'european' => 1); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('01-01-1900', 'european' => 1); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('24-12-0001 BC', 'european' => 1); is($dt->ymd(), '0000-12-24'); $dt = DateTime::Format::Pg->parse_date('04-26-2003', 'european' => 0); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('01-01-1900', 'european' => 0); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('12-24-0001 BC', 'european' => 0); is($dt->ymd(), '0000-12-24'); # SQL # $dt = DateTime::Format::Pg->parse_date('26/04/2003', 'european' => 1); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('01/01/1900', 'european' => 1); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('24/12/0001 BC', 'european' => 1); is($dt->ymd(), '0000-12-24'); $dt = DateTime::Format::Pg->parse_date('04/26/2003', 'european' => 0); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('01/01/1900', 'european' => 0); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('12/24/0001 BC', 'european' => 0); is($dt->ymd(), '0000-12-24'); # German # $dt = DateTime::Format::Pg->parse_date('26.04.2003'); is($dt->ymd(), '2003-04-26'); $dt = DateTime::Format::Pg->parse_date('01.01.1900'); is($dt->ymd(), '1900-01-01'); $dt = DateTime::Format::Pg->parse_date('24.12.0001 BC'); is($dt->ymd(), '0000-12-24'); parse_datetime.t000644000765000024 107512206306510 20564 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_datetime.t 1046 2003-07-16 13:42:35Z cfaerber $ use Test::More tests => 8; use DateTime::Format::Pg 0.02; { my $dt = DateTime::Format::Pg->parse_datetime('2003-01-02 19:18:17.123+09:30'); is($dt->year(), 2003, 'year'); is($dt->month(), 01, 'month'); is($dt->day(), 02, 'day'); is($dt->hour(), 19, 'hour'); is($dt->minute(), 18, 'minute'); is($dt->second(), 17, 'second'); is($dt->nanosecond(), 123000000, 'nanosecond'); is($dt->offset(), (9*60+30)*60, 'tz offset'); } parse_datetime2.t000644000765000024 107012206306510 20641 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_datetime2.t 1057 2005-03-16 16:50:40Z cfaerber $ use Test::More tests => 8; use DateTime::Format::Pg 0.02; { my $dt = DateTime::Format::Pg->parse_datetime('2003-01-02 19:18:17.123+09'); is($dt->year(), 2003, 'year'); is($dt->month(), 01, 'month'); is($dt->day(), 02, 'day'); is($dt->hour(), 19, 'hour'); is($dt->minute(), 18, 'minute'); is($dt->second(), 17, 'second'); is($dt->nanosecond(), 123000000, 'nanosecond'); is($dt->offset(), (9*60)*60, 'tz offset'); } parse_datetime3.t000644000765000024 100312206306510 20636 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: $ use Test::More tests => 8; use DateTime::Format::Pg 0.02; { my $dt = DateTime::Format::Pg->parse_datetime('1221-01-02 03:04:05+01 BC'); is($dt->year(), -1220, 'year'); is($dt->month(), 01, 'month'); is($dt->day(), 02, 'day'); is($dt->hour(), 03, 'hour'); is($dt->minute(), 04, 'minute'); is($dt->second(), 05, 'second'); is($dt->nanosecond(), 00, 'nanosecond'); is($dt->offset(), (1*60)*60, 'tz offset'); } parse_datetime4.t000644000765000024 100712206306510 20643 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id$ use Test::More tests => 8; use DateTime::Format::Pg 0.02; { my $dt = DateTime::Format::Pg->parse_datetime('2003-01-02T19:18:17.123+09:30'); is($dt->year(), 2003, 'year'); is($dt->month(), 01, 'month'); is($dt->day(), 02, 'day'); is($dt->hour(), 19, 'hour'); is($dt->minute(), 18, 'minute'); is($dt->second(), 17, 'second'); is($dt->nanosecond(), 123000000, 'nanosecond'); is($dt->offset(), (9*60+30)*60, 'tz offset'); } parse_infinity.t000644000765000024 141012206306510 20612 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_infinity.t 1061 2006-01-07 00:45:49Z lestrrat $ use Test::More tests => 6; use DateTime::Format::Pg 0.02; { my $dt = DateTime::Format::Pg->parse_datetime('infinity'); isa_ok($dt, 'DateTime::Infinite::Future'); } { my $dt = DateTime::Format::Pg->parse_date('infinity'); isa_ok($dt, 'DateTime::Infinite::Future'); } { my $dt = DateTime::Format::Pg->parse_timestamp('infinity'); isa_ok($dt, 'DateTime::Infinite::Future'); } { my $dt = DateTime::Format::Pg->parse_datetime('-infinity'); isa_ok($dt, 'DateTime::Infinite::Past'); } { my $dt = DateTime::Format::Pg->parse_date('-infinity'); isa_ok($dt, 'DateTime::Infinite::Past'); } { my $dt = DateTime::Format::Pg->parse_timestamp('-infinity'); isa_ok($dt, 'DateTime::Infinite::Past'); } parse_interval.t000644000765000024 1046212206306510 20634 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_interval.t 3687 2007-05-27 15:32:27Z lestrrat $ use strict; use Test::More; use DateTime; use DateTime::Duration; use Data::Dumper; my @positive_data; my @negative_data; BEGIN { @negative_data = ( '098:08:00', '1:08:00', '-012:00:00', ); @positive_data = ( [ '00:00:00' => DateTime::Duration->new() ], [ '-08:08:00' => DateTime::Duration->new( hours => -8, minutes => -8) ], [ '-98:08:00' => DateTime::Duration->new( hours => -98, minutes => -8) ], [ '-100:33:00' => DateTime::Duration->new( hours => -100, minutes => -33) ], [ '100:33:00' => DateTime::Duration->new( hours => 100, minutes => 33) ], [ '01:00:00' => DateTime::Duration->new( hours => 1 ) ], [ '-08:00:00' => DateTime::Duration->new( hours => -8 ) ], [ '-1 days' => DateTime::Duration->new(days => -1) ], [ '-23:59' => DateTime::Duration->new(hours => -23, minutes => -59) ], [ '-1 days -00:01' => DateTime::Duration->new( days => -1, minutes => -1) ], [ '1 mon -1 days' => DateTime::Duration->new(months => 1)->add(days => -1) ], [ '@ 1 mon -1 days' => DateTime::Duration->new(months => 1)->add(days => -1) ], [ '-1 days +02:03:00' => DateTime::Duration->new(days => -1) ->add( hours => 2, minutes => 3, ) ], ['9 years 1 mon -12 days +13:14:00' => DateTime::Duration->new( years => 9, months => 1, hours => 13, minutes => 14, )->add(days => -12)], [ '@ 1 day ago' => DateTime::Duration->new( days => -1 )], [ '@ 1 day 10 mins' => DateTime::Duration->new( days => 1, minutes => 10 )], [ '@ 23 hours 59 mins ago' => DateTime::Duration->new( hours => -23, minutes => -59 )], [ '@ 1 day 1 min ago' => DateTime::Duration->new( days => -1, minutes => -1 )], [ '10 days' => DateTime::Duration->new(days => 10 ) ], [ '34 years' => DateTime::Duration->new(years => 34 )], [ '3 mons' => DateTime::Duration->new(months => 3 )], [ '-00:00:14' => DateTime::Duration->new(seconds => -14 )], [ '1 day 02:03:04' => DateTime::Duration->new( days => 1, hours => 2, minutes => 3, seconds => 4, )], [ '5 mons 12:00:00' => DateTime::Duration->new( months => 5, hours => 12) ], [ '@ 1 min' => DateTime::Duration->new(minutes => 1 )], [ '@ 5 hours' => DateTime::Duration->new( hours => 5 )], [ '@ 34 years' => DateTime::Duration->new(years => 34 )], [ '@ 3 mons' => DateTime::Duration->new(months => 3 )], [ '@ 14 secs ago' => DateTime::Duration->new( seconds => -14 )], [ '@ 1 day 2 hours 3 mins 4 secs' => DateTime::Duration->new( days => 1, hours => 2, minutes => 3, seconds => 4, )], [ '@ 5 mons 12 hours' => DateTime::Duration->new( hours => 12, months => 5) ], [ '@ 4541 years 4 mons 4 days 17 mins 31 secs' => DateTime::Duration->new( years => 4541, months => 4, days => 4, minutes => 17, seconds => 31, )], [ '@ 6 mons 5 days 4 hours 3 mins 2 secs' => DateTime::Duration->new( months => 6, days => 5, hours => 4, minutes => 3, seconds => 2, )], [ '1 days 02:03:00 ago' => DateTime::Duration->new( days => -1, hours => -2, minutes => -3, )], ); plan tests => @negative_data + @positive_data + 1; use_ok 'DateTime::Format::Pg' or die; } { # Positive data for my $compare (@positive_data) { ok !DateTime::Duration->compare( DateTime::Format::Pg->parse_duration($compare->[0]), $compare->[1] ), "'$compare->[0]'" or diag Dumper [ { DateTime::Format::Pg->parse_duration($compare->[0])->deltas }, { $compare->[1]->deltas } ] ; } } { # Negative data for my $data (@negative_data) { ok(! eval { DateTime::Format::Pg->parse_duration($data) } && $@, "'$data' fails to parse"); } } parse_time.t000644000765000024 132312206306510 17722 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: parse_time.t 1055 2005-03-16 16:13:19Z cfaerber $ use Test::More tests => 10; use DateTime::Format::Pg 0.08; { my $dt = DateTime::Format::Pg->parse_time('19:18:17.123+09:30'); is($dt->hour(), 19, 'hour'); is($dt->minute(), 18, 'minute'); is($dt->second(), 17, 'second'); is($dt->nanosecond(), 123000000, 'nanosecond'); is($dt->offset(), 0, 'tz offset'); } { my $dt = DateTime::Format::Pg->parse_timetz('19:18:17.123+09:30'); is($dt->hour(), 19, 'hour'); is($dt->minute(), 18, 'minute'); is($dt->second(), 17, 'second'); is($dt->nanosecond(), 123000000, 'nanosecond'); is($dt->offset(), (9*60+30)*60, 'tz offset'); } rt18487.t000644000765000024 35412206306510 16616 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse strict; use Test::More (tests => 1); use DateTime::Duration; use DateTime::Format::Pg; my $dur = DateTime::Duration->new(nanoseconds => 3000); my $val = DateTime::Format::Pg->format_duration($dur); is($val, '@ 0.000003 seconds');rt29635.t000644000765000024 31512206306510 16610 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse strict; use Test::More (tests => 4); BEGIN { use_ok("DateTime::Format::Pg"); } my $dt = DateTime::Format::Pg->parse_time('16:05:00'); is($dt->hour, 16); is($dt->minute, 5); is($dt->second, 0); rt72706.t000644000765000024 74512206306510 16614 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse strict; use Test::More; use_ok "DateTime::Format::Pg"; subtest 'positive offset' => sub { my $dt = DateTime::Format::Pg->parse_datetime( "1894-01-01 00:00:00+05:17:32" ); ok $dt, "Parse ok"; is $dt->offset(), ((5*60+17)*60)+32, 'tz offset'; }; subtest 'negative offset' => sub { my $dt = DateTime::Format::Pg->parse_datetime( "1894-01-01 00:00:00-05:17:32" ); ok $dt, "Parse ok"; is $dt->offset(), -1 * (((5*60+17)*60)+32), 'tz offset'; }; done_testing;self_circle.t000644000765000024 74312206306510 20031 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/tuse strict; use Test::More tests => 4; use DateTime::Format::Pg 0.02; my @ts = ( "2007-03-10 06:00:00+01", "2007-03-10 06:00:00-0100", ); foreach my $ts (@ts) { my $dt = DateTime::Format::Pg->parse_datetime($ts); my $dt_formated = DateTime::Format::Pg->format_datetime($dt); # Pg will truncate timezone like +0100 to +01 $ts =~ s/([+\-]\d{2})$/${1}00/; is($dt_formated, $ts, "format ok"); ok(DateTime::Format::Pg->parse_datetime($dt_formated)); } tz_1901_2038.t000644000765000024 124312206306510 17356 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009/t# $Id: tz_1901_2038.t 1039 2003-05-30 14:04:49Z cfaerber $ use Test::More tests => 4; use DateTime 0.10; use DateTime::TimeZone 0.12; use DateTime::Format::Pg 0.02; # 2038-01-18 23:59:59+00 # 2038-01-19 00:00:00 # 1901-12-14 00:00:00+00 # 1901-12-13 23:59:59 my $dt; $dt = DateTime::Format::Pg->parse_timestamptz('1901-12-13 23:59:59'); ok($dt->time_zone->is_utc); $dt = DateTime::Format::Pg->parse_timestamptz('2038-01-19 00:00:00'); ok($dt->time_zone->is_utc); $dt = DateTime::Format::Pg->parse_timestamptz('1901-12-14 00:00:00'); ok($dt->time_zone->is_floating); $dt = DateTime::Format::Pg->parse_timestamptz('2038-01-18 23:59:00'); ok($dt->time_zone->is_floating); META.yml000644000765000024 214112206306510 16412 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009--- abstract: 'Parse and format PostgreSQL dates and times' author: - 'Daisuke Maki ' build_requires: ExtUtils::MakeMaker: 6.36 Test::More: 0 configure_requires: CPAN::Meta: 0 CPAN::Meta::Prereqs: 0 Module::Build: 0.38 dynamic_config: 0 generated_by: 'Minilla/v0.6.4, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: DateTime-Format-Pg no_index: directory: - t - xt - inc - share - eg - examples - author provides: DateTime::Format::Pg: file: lib/DateTime/Format/Pg.pm version: 0.16009 requires: DateTime: 0.10 DateTime::Format::Builder: 0.72 DateTime::TimeZone: 0.05 resources: bugtracker: https://github.com/lestrrat/DateTime-Format-Pg/issues homepage: https://github.com/lestrrat/DateTime-Format-Pg repository: git://github.com/lestrrat/DateTime-Format-Pg.git version: 0.16009 x_contributors: - 'Vasily Chekalkin ' - 'David Steinbrunner ' - 'Daisuke Maki ' MANIFEST000644000765000024 71112206306510 16253 0ustar00daisukestaff000000000000DateTime-Format-Pg-0.16009Build.PL Changes LICENSE META.json Makefile README.md cpanfile lib/DateTime/Format/Pg.pm t/1basic.t t/2new-param.t t/99-pod-coverage.t t/99-pod.t t/format_date.t t/format_datetime.t t/format_fractional.t t/format_interval.t t/parse_date.t t/parse_datetime.t t/parse_datetime2.t t/parse_datetime3.t t/parse_datetime4.t t/parse_infinity.t t/parse_interval.t t/parse_time.t t/rt18487.t t/rt29635.t t/rt72706.t t/self_circle.t t/tz_1901_2038.t META.yml MANIFEST