Data-AMF-0.09/000755 000765 000024 00000000000 11437121525 013737 5ustar00typesterstaff000000 000000 Data-AMF-0.09/Changes000644 000765 000024 00000002736 11437120602 015235 0ustar00typesterstaff000000 000000 Revision history for Perl extension Data::AMF 0.09 2010-08-31T15:28:16+09:00 - fixed numeric string start with '0' encoded as number, it should be encoded as string. 0.08 2010-08-04T09:15:06+09:00 - fixed bug that Data::AMF::Message didn't compiled at all (by Artem S Vybornov) - on AMF3, some fractional numbers was serialized as integers (by Artem S Vybornov) 0.07 2010-07-29T17:35:59+09:00 - added missing undefined check on io read functions 0.06 2010-07-21T14:45:17+09:00 - minor changes for recent Moose 0.05 2010-07-21T11:45:32+09:00 - use Any::Moose 0.04 2010-05-20T15:08:31+09:00 - fixed AMF3 empty string handling (seagirl++) 0.03 2009-12-24T21:39:01+09:00 - added AMF3 support (seagirl++) - added Data::AMF::Remoting (seagirl++) 0.02004 2008-08-19T11:08:14+09:00 - now serialize can handle multiple array data at once, same as deserialize 0.02003 2008-08-14T12:47:20+09:00 - fixed buggy write_u24 on IO class. - added parse/format test for empty object. 0.02002 2008-08-13T15:52:17+09:00 - added support to read/write 24bit int in Data::AMF::IO 0.02001 2008-08-08T10:59:42+09:00 - added YAML into test_require. "use_test_base;" does not include this module... 0.02 2008-08-07T14:35:14+09:00 - added support to parse reference data-type 0.01001 2008-07-23T15:13:38+09:00 - added perl in prereqs, and fixed stupid typo 'use 0.008001' >< 0.01 2008-07-22T23:31:35+09:00 - original version Data-AMF-0.09/LICENSE000644 000765 000024 00000050077 11314656372 014764 0ustar00typesterstaff000000 000000 Terms 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 Data-AMF-0.09/MANIFEST000644 000765 000024 00000003616 11375150460 015077 0ustar00typesterstaff000000 000000 Changes examples/simple_flash_remoting.as examples/simple_flash_remoting.pl examples/simple_flash_remoting.swf examples/simple_flex_rpc/gateway.psgi examples/simple_flex_rpc/HelloController.pm examples/simple_flex_rpc/SimpleFlexRPC.mxml examples/simple_flex_rpc/SimpleFlexRPC.swf inc/Module/Install.pm inc/Module/Install/AuthorTests.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Repository.pm inc/Module/Install/TestBase.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm inc/Spiffy.pm inc/Test/Base.pm inc/Test/Base/Filter.pm inc/Test/Builder.pm inc/Test/Builder/Module.pm inc/Test/More.pm inc/YAML.pm lib/Data/AMF.pm lib/Data/AMF/Formatter.pm lib/Data/AMF/Formatter/AMF0.pm lib/Data/AMF/Formatter/AMF3.pm lib/Data/AMF/Header.pm lib/Data/AMF/IO.pm lib/Data/AMF/Message.pm lib/Data/AMF/Packet.pm lib/Data/AMF/Parser.pm lib/Data/AMF/Parser/AMF0.pm lib/Data/AMF/Parser/AMF3.pm lib/Data/AMF/Remoting.pm lib/Data/AMF/Type/Boolean.pm lib/Data/AMF/Type/ByteArray.pm lib/Data/AMF/Type/Null.pm LICENSE Makefile.PL MANIFEST This list of files META.yml README t/00_compile.t t/01_parse_amf0.t t/02_format_amf0_simple.t t/03_format_amf0_strict.t t/04_parse_amf3.t t/05_format_amf3_simple.t t/06_format_amf3_strict.t t/data/amf0/boolean_false t/data/amf0/boolean_true t/data/amf0/date t/data/amf0/ecma_array t/data/amf0/null t/data/amf0/null_object t/data/amf0/number t/data/amf0/object t/data/amf0/object2 t/data/amf0/reference t/data/amf0/reference_nested t/data/amf0/strict_array t/data/amf0/string t/data/amf0/undefined t/data/amf3/array t/data/amf3/byte_array t/data/amf3/date t/data/amf3/false t/data/amf3/null t/data/amf3/null_object t/data/amf3/number t/data/amf3/object t/data/amf3/object2 t/data/amf3/string t/data/amf3/true t/data/amf3/undefined xt/pod.t xt/pod_coverage.t Data-AMF-0.09/META.yml000644 000765 000024 00000001212 11437121525 015204 0ustar00typesterstaff000000 000000 --- abstract: 'serialize / deserialize AMF data' author: - 'Daisuke Murase ' build_requires: ExtUtils::MakeMaker: 6.42 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 1.00' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Data-AMF no_index: directory: - examples - inc - t - xt requires: Any::Moose: 0 DateTime: 0 Filter::Util::Call: 0 Scalar::Util: 0 UNIVERSAL::require: 0 XML::LibXML: 0 perl: 5.008001 resources: license: http://dev.perl.org/licenses/ version: 0.09 Data-AMF-0.09/Makefile.PL000644 000765 000024 00000000547 11421457464 015726 0ustar00typesterstaff000000 000000 use inc::Module::Install; name 'Data-AMF'; all_from 'lib/Data/AMF.pm'; test_requires 'Test::More'; test_requires 'YAML'; requires 'perl' => '5.008001'; requires 'Any::Moose'; requires 'Scalar::Util'; requires 'DateTime'; requires 'XML::LibXML'; requires 'UNIVERSAL::require'; use_test_base; author_tests 'xt'; auto_include; auto_set_repository WriteAll; Data-AMF-0.09/README000644 000765 000024 00000000756 11314656372 014636 0ustar00typesterstaff000000 000000 This is Perl module Data::AMF. INSTALLATION Data::AMF installation is straightforward. If your CPAN shell is set up, you should just be able to do % cpan Data::AMF Download it, unpack it, then build it as per the usual: % perl Makefile.PL % make && make test Then install it: % make install DOCUMENTATION Data::AMF documentation is available as in POD. So you can do: % perldoc Data::AMF to read the documentation online with your favorite pager. Daisuke Murase Data-AMF-0.09/examples/000755 000765 000024 00000000000 11437121525 015555 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/000755 000765 000024 00000000000 11437121525 014510 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/000755 000765 000024 00000000000 11437121525 014505 5ustar00typesterstaff000000 000000 Data-AMF-0.09/t/000755 000765 000024 00000000000 11437121525 014202 5ustar00typesterstaff000000 000000 Data-AMF-0.09/xt/000755 000765 000024 00000000000 11437121525 014372 5ustar00typesterstaff000000 000000 Data-AMF-0.09/xt/pod.t000644 000765 000024 00000000201 11375150457 015341 0ustar00typesterstaff000000 000000 use Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Data-AMF-0.09/xt/pod_coverage.t000644 000765 000024 00000000406 11375150457 017223 0ustar00typesterstaff000000 000000 use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Set TEST_POD environment variable to run this test" unless $ENV{TEST_POD}; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); Data-AMF-0.09/t/00_compile.t000644 000765 000024 00000000105 11314656372 016321 0ustar00typesterstaff000000 000000 use strict; use Test::More tests => 1; BEGIN { use_ok 'Data::AMF' } Data-AMF-0.09/t/01_parse_amf0.t000644 000765 000024 00000003316 11314656372 016716 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use FindBin; use File::Spec; use Data::AMF; my $amf = Data::AMF->new( version => 0 ); sub load { my $file = File::Spec->catfile( $FindBin::Bin, $_[0] ); open my $fh, "<$file"; my $data = do { local $/; <$fh> }; close $fh; $data; } sub parse { my ($obj) = $amf->deserialize($_[0]); return { data => $obj }; } filters { input => [qw/load parse/], expected => 'yaml', }; run_compare; __DATA__ === number --- input: data/amf0/number --- expected data: 123 === boolean true --- input: data/amf0/boolean_true --- expected data: 1 === boolean false --- input: data/amf0/boolean_false --- expected data: 0 === string --- input: data/amf0/string --- expected data: foo === object --- input: data/amf0/object --- expected data: foo: bar === object2 --- input: data/amf0/object2 --- expected data: array: - foo - bar hash: foo: bar === null object --- input: data/amf0/null_object --- expected data: {} === null --- input: data/amf0/null --- expected data: ~ === undefined --- input: data/amf0/undefined --- expected data: ~ === reference --- input: data/amf0/reference --- expected data: obj1: foo: bar obj2: foo: bar === nested reference --- input: data/amf0/reference_nested --- expected data: obj: foo: bar obj2: foo: bar ary: - a - b - c nested: ary: - a - b - c obj: foo: bar === ecma array --- input: data/amf0/ecma_array --- expected data: 0: foo bar: baz === strict-array --- input: data/amf0/strict_array --- expected data: - foo - bar - baz === date --- input: data/amf0/date --- expected data: 1216717318745 === long string --- SKIP Data-AMF-0.09/t/02_format_amf0_simple.t000644 000765 000024 00000002012 11314656372 020436 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use Data::AMF; my $amf = Data::AMF->new( version => 0 ); sub serialize { $amf->serialize($_[0]->{data}); } sub deserialize { my ($data) = $amf->deserialize($_[0]); return { data => $data }; } filters { input => [qw/yaml serialize deserialize/], expected => 'yaml', }; run_compare input => 'input'; __DATA__ === number --- input data: 123 === boolean true --- SKIP: currently not supported to format boolean --- input data: 1 === boolean false --- SKIP: currently not supported to format boolean --- input data: 0 === string --- input data: foo === object --- input data: foo: bar === null object --- input data: {} === object2 --- input data: array: - foo - bar hash: foo: bar === null --- input data: ~ === undefined --- input data: ~ === reference --- SKIP === ecma array --- input data: 0: foo bar: baz === strict-array --- input data: - foo - bar - baz === date --- input data: 1216717318745 === long string --- SKIP Data-AMF-0.09/t/03_format_amf0_strict.t000644 000765 000024 00000001015 11314656372 020460 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use FindBin; use File::Spec; use Data::AMF; my $amf = Data::AMF->new( version => 0 ); sub serialize { $amf->serialize($_[0]->{data}); } sub load { my $file = File::Spec->catfile( $FindBin::Bin, $_[0] ); open my $fh, "<$file"; my $data = do { local $/; <$fh> }; close $fh; $data; } filters { input => [qw/yaml serialize/], expected => 'load', }; run_compare; __DATA__ === null object --- input data: {} --- expected: data/amf0/null_object Data-AMF-0.09/t/04_parse_amf3.t000644 000765 000024 00000003067 11437114316 016720 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use FindBin; use File::Spec; use Data::AMF; use Data::AMF::Type::Boolean; use Data::AMF::Type::Null; my $amf = Data::AMF->new( version => 3 ); sub load { my $file = File::Spec->catfile( $FindBin::Bin, $_[0] ); open my $fh, "<$file"; my $data = do { local $/; <$fh> }; close $fh; $data; } sub parse { my ($obj) = $amf->deserialize($_[0]); return $obj; } filters { input => [qw/load parse/], expected => 'eval', }; run_compare; __DATA__ === number --- input: data/amf3/number --- expected 123.45 === boolean true --- input: data/amf3/true --- expected Data::AMF::Type::Boolean->new(1) === boolean false --- input: data/amf3/false --- expected Data::AMF::Type::Boolean->new(0) === string --- input: data/amf3/string --- expected "foo" === object --- input: data/amf3/object --- expected { foo => "bar" } === object2 --- input: data/amf3/object2 --- expected { array => [ "foo", "bar" ], hash => { foo => "bar" } } === null object --- input: data/amf3/null_object --- expected {} === array --- input: data/amf3/array --- expected [ "foo", "bar" ] === null --- input: data/amf3/null --- expected Data::AMF::Type::Null->new() === undefined --- input: data/amf3/undefined --- expected undef === date --- input: data/amf3/date --- expected DateTime->new( year => 2009, month => 10, day => 22, hour => 03, minute => 34, second => 56 ) === byte_array --- input: data/amf3/byte_array --- expected Data::AMF::Type::ByteArray->new([10, 11, 1, 7, 102, 111, 111, 6, 7, 98, 97, 114, 1]) Data-AMF-0.09/t/05_format_amf3_simple.t000644 000765 000024 00000002136 11375150537 020452 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use Data::AMF; use Data::AMF::Type::Boolean; use Data::AMF::Type::ByteArray; use Data::AMF::Type::Null; use DateTime; my $amf = Data::AMF->new( version => 3 ); sub serialize { $amf->serialize($_[0]); } sub deserialize { my ($data) = $amf->deserialize($_[0]); return { data => $data }; } filters { input => [qw/eval serialize deserialize/], }; run_compare input => 'input'; __DATA__ === number --- input 123.45 === boolean true --- input Data::AMF::Type::Boolean->new(1) === boolean false --- input Data::AMF::Type::Boolean->new(0) === string --- input "foo" === object --- input { foo => "bar" } === null object --- input {} === complex object --- input { array => [ "foo", "bar", '', { id => 1, name => 'hoge', }, { id => 2, name => '', age => 21, }, { id => 3, name => 'hoge', }, ], hash => { foo => "bar" } } === null --- input Data::AMF::Type::Null->new() === undefined --- input undef === date --- input DateTime->now; === byte_array --- input Data::AMF::Type::ByteArray->new([1, 2, 3, 4, 5]) Data-AMF-0.09/t/06_format_amf3_strict.t000644 000765 000024 00000001143 11426130276 020462 0ustar00typesterstaff000000 000000 use Test::Base; plan tests => 1 * blocks; use FindBin; use File::Spec; use Data::AMF; my $amf = Data::AMF->new( version => 3 ); sub serialize { $amf->serialize($_[0]->{data}); } sub load { my $file = File::Spec->catfile( $FindBin::Bin, $_[0] ); open my $fh, "<$file"; my $data = do { local $/; <$fh> }; close $fh; $data; } filters { input => [qw/yaml serialize/], expected => 'load', }; run_compare; __DATA__ === null object --- input data: {} --- expected: data/amf3/null_object === number with double precision --- input data: 123.45 --- expected: data/amf3/number Data-AMF-0.09/t/data/000755 000765 000024 00000000000 11437121525 015113 5ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf0/000755 000765 000024 00000000000 11437121525 015736 5ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/000755 000765 000024 00000000000 11437121525 015741 5ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/array000644 000765 000024 00000000015 11314656440 017001 0ustar00typesterstaff000000 000000 foobarData-AMF-0.09/t/data/amf3/byte_array000644 000765 000024 00000000017 11314656440 020026 0ustar00typesterstaff000000 000000  foobarData-AMF-0.09/t/data/amf3/date000644 000765 000024 00000000012 11314656440 016575 0ustar00typesterstaff000000 000000 BrGData-AMF-0.09/t/data/amf3/false000644 000765 000024 00000000001 11314656440 016750 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/null000644 000765 000024 00000000001 11314656440 016630 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/null_object000644 000765 000024 00000000004 11314656440 020161 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/number000644 000765 000024 00000000011 11314656440 017147 0ustar00typesterstaff000000 000000 @^Data-AMF-0.09/t/data/amf3/object000644 000765 000024 00000000015 11314656440 017131 0ustar00typesterstaff000000 000000 foobarData-AMF-0.09/t/data/amf3/object2000644 000765 000024 00000000042 11314656440 017213 0ustar00typesterstaff000000 000000  hash foobar array Data-AMF-0.09/t/data/amf3/string000644 000765 000024 00000000005 11314656440 017170 0ustar00typesterstaff000000 000000 fooData-AMF-0.09/t/data/amf3/true000644 000765 000024 00000000001 11314656440 016635 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf3/undefined000644 000765 000024 00000000001 11314656440 017617 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf0/boolean_false000644 000765 000024 00000000002 11314656372 020451 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf0/boolean_true000644 000765 000024 00000000002 11314656372 020336 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf0/date000644 000765 000024 00000000013 11314656372 016577 0ustar00typesterstaff000000 000000 BqData-AMF-0.09/t/data/amf0/ecma_array000644 000765 000024 00000000034 11314656372 017770 0ustar00typesterstaff000000 000000 0foobarbaz Data-AMF-0.09/t/data/amf0/null000644 000765 000024 00000000001 11314656372 016631 0ustar00typesterstaff000000 000000 Data-AMF-0.09/t/data/amf0/null_object000644 000765 000024 00000000004 11314656372 020162 0ustar00typesterstaff000000 000000  Data-AMF-0.09/t/data/amf0/number000644 000765 000024 00000000011 11314656372 017150 0ustar00typesterstaff000000 000000 @^Data-AMF-0.09/t/data/amf0/object000644 000765 000024 00000000017 11314656372 017134 0ustar00typesterstaff000000 000000 foobar Data-AMF-0.09/t/data/amf0/object2000644 000765 000024 00000000061 11314656372 017215 0ustar00typesterstaff000000 000000 hashfoobar array foobar Data-AMF-0.09/t/data/amf0/reference000644 000765 000024 00000000042 11314656372 017622 0ustar00typesterstaff000000 000000 obj1foobar obj2 Data-AMF-0.09/t/data/amf0/reference_nested000644 000765 000024 00000000123 11314656372 021164 0ustar00typesterstaff000000 000000 obj2foobar objary abcnestedaryobj Data-AMF-0.09/t/data/amf0/strict_array000644 000765 000024 00000000027 11314656372 020375 0ustar00typesterstaff000000 000000 foobarbazData-AMF-0.09/t/data/amf0/string000644 000765 000024 00000000006 11314656372 017172 0ustar00typesterstaff000000 000000 fooData-AMF-0.09/t/data/amf0/undefined000644 000765 000024 00000000001 11314656372 017620 0ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/000755 000765 000024 00000000000 11437121525 015356 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/AMF/000755 000765 000024 00000000000 11437121525 015761 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/AMF.pm000644 000765 000024 00000004256 11437121501 016320 0ustar00typesterstaff000000 000000 package Data::AMF; use 5.008001; use Any::Moose; our $VERSION = '0.09'; use Data::AMF::Parser; use Data::AMF::Formatter; has version => ( is => 'rw', isa => 'Int', default => sub { 0 }, ); has parser => ( is => 'rw', lazy => 1, default => sub { my $self = shift; Data::AMF::Parser->new( version => $self->version ); }, ); has formatter => ( is => 'rw', lazy => 1, default => sub { my $self = shift; Data::AMF::Formatter->new( version => $self->version ); }, ); no Any::Moose; sub serialize { my $self = shift; $self->formatter->format(@_); } sub deserialize { my $self = shift; $self->parser->parse(@_); } __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF - serialize / deserialize AMF data =head1 SYNOPSIS use Data::AMF; my $amf0 = Data::AMF->new( version => 0 ); my $amf3 = Data::AMF->new( version => 3 ); # AMF0 to Perl Object my $obj = $amf0->deserialize($data); # Perl Object to AMF0 my $data = $amf0->serialize($obj); =head1 DESCRIPTION This module is (de)serializer for Adobe's AMF (Action Message Format). Data::AMF is core module and it recognize only AMF data, not AMF packet. If you want to read/write AMF Packet, see Data::AMF::Packet instead. =head1 SEE ALSO L, L =head1 NOTICE Data::AMF is currently in a very early alpha development stage. The current version is not support AMF3, and application interface is still fluid. =head1 METHOD =head2 new(%option) Create Data::AMF object. Option parameters are: =over =item version Target AMF version. It should be 0 or 3. (default 0 for AMF0) =back =head2 serialize($obj) Serialize perl object ($obj) to AMF, and return the AMF data. =head2 deserialize($amf) Deserialize AMF data to perl object, and return the perl object. =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Formatter/000755 000765 000024 00000000000 11437121525 017724 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/AMF/Formatter.pm000644 000765 000024 00000001527 11375150457 020276 0ustar00typesterstaff000000 000000 package Data::AMF::Formatter; use strict; use warnings; use Data::AMF::Formatter::AMF0; use Data::AMF::Formatter::AMF3; sub new { my $class = shift; my $args = @_ > 1 ? {@_} : $_[0]; return $args->{version} == 3 ? 'Data::AMF::Formatter::AMF3' : 'Data::AMF::Formatter::AMF0'; } =head1 NAME Data::AMF::Formatter - serializer proxy class =head1 SYNOPSIS my $amf3_formatter_class = Data::AMF::Formatter->new( version => 3 ); my $amf0_formatter_class = Data::AMF::Formatter->new( version => 0 ); # or just new without option =head1 METHODS =head2 new =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut 1; Data-AMF-0.09/lib/Data/AMF/Header.pm000644 000765 000024 00000001417 11421457003 017506 0ustar00typesterstaff000000 000000 package Data::AMF::Header; use Any::Moose; has name => ( is => 'rw', isa => 'Str', required => 1, ); has must_understand => ( is => 'rw', isa => 'Int', required => 1, ); has value => ( is => 'rw', ); has version => ( is => 'rw', isa => 'Int', ); no Any::Moose; __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF::Header - AMF message header =head1 ACCESSORS =head2 name =head2 must_understand =head2 value =head2 version =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/IO.pm000644 000765 000024 00000007571 11437114316 016640 0ustar00typesterstaff000000 000000 package Data::AMF::IO; use Any::Moose; require bytes; use constant ENDIAN => unpack('S', pack('C2', 0, 1)) == 1 ? 'BIG' : 'LITTLE'; has data => ( is => 'rw', isa => 'Str', default => sub { '' }, lazy => 1, ); has pos => ( is => 'rw', isa => 'Int', default => sub { 0 }, lazy => 1, ); has refs => ( is => 'rw', isa => 'ArrayRef', default => sub { [] }, lazy => 1, ); no Any::Moose; sub read { my ($self, $len) = @_; if ($len + $self->pos > bytes::length($self->data) ) { return; } my $data = substr $self->data, $self->pos, $len; $self->pos( $self->pos + $len ); $data; } sub read_u8 { my $self = shift; my $data = $self->read(1); return unless defined $data; unpack('C', $data); } sub read_u16 { my $self = shift; my $data = $self->read(2); return unless defined $data; unpack('n', $data); } sub read_s16 { my $self = shift; my $data = $self->read(2); return unless defined $data; return unpack('s>', $data) if $] >= 5.009002; return unpack('s', $data) if ENDIAN eq 'BIG'; return unpack('s', swap($data)); } sub read_u24 { my $self = shift; my $data = $self->read(3); return unpack('N', "\0$data"); } sub read_u32 { my $self = shift; my $data = $self->read(4); unpack('N', $data); } sub read_double { my $self = shift; my $data = $self->read(8); return unpack('d>', $data) if $] >= 5.009002; return unpack('d', $data) if ENDIAN eq 'BIG'; return unpack('d', swap($data)); } sub read_utf8 { my $self = shift; my $len = $self->read_u16; return unless defined $len; $self->read($len); } sub read_utf8_long { my $self = shift; my $len = $self->read_u32; return unless defined $len; $self->read($len); } sub swap { join '', reverse split '', $_[0]; } sub write { my ($self, $data) = @_; $self->{data} .= $data; } sub write_u8 { my ($self, $data) = @_; $self->write( pack('C', $data) ); } sub write_u16 { my ($self, $data) = @_; $self->write( pack('n', $data) ); } sub write_s16 { my ($self, $data) = @_; return $self->write( pack('s>', $data) ) if $] >= 5.009002; return $self->write( pack('s', $data) ) if ENDIAN eq 'BIG'; return $self->write( swap pack('s', $data) ); } sub write_u24 { my ($self, $data) = @_; $data = pack('N', $data); $data = substr $data, 1, 3; $self->write($data); } sub write_u32 { my ($self, $data) = @_; $self->write( pack('N', $data) ); } sub write_double { my ($self, $data) = @_; return $self->write( pack('d>', $data) ) if $] >= 5.009002; return $self->write( pack('d', $data) ) if ENDIAN eq 'BIG'; return $self->write( swap pack('d', $data) ); } sub write_utf8 { my ($self, $data) = @_; my $len = bytes::length($data); $self->write_u16($len); $self->write($data); } sub write_utf8_long { my ($self, $data) = @_; my $len = bytes::length($data); $self->write_u32($len); $self->write($data); } __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF::IO - IO class for reading/writing AMF data =head1 DESCRIPTION IO class for reading/writing AMF data =head1 METHODS =head2 new =head2 read =head2 read_u8 =head2 read_u16 =head2 read_s16 =head2 read_u24 =head2 read_u32 =head2 read_double =head2 read_utf8 =head2 read_utf8_long =head2 write =head2 write_u8 =head2 write_u16 =head2 write_s16 =head2 write_u24 =head2 write_u32 =head2 write_double =head2 write_utf8 =head2 write_utf8_long =head2 swap =head2 ENDIAN =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Message.pm000644 000765 000024 00000004027 11426130276 017707 0ustar00typesterstaff000000 000000 package Data::AMF::Message; use Any::Moose; use Scalar::Util qw/blessed/; has target_uri => ( is => 'rw', isa => 'Str', required => 1, ); has response_uri => ( is => 'rw', isa => 'Str', required => 1, ); has value => ( is => 'rw', ); has source => ( is => 'rw', ); has version => ( is => 'rw', isa => 'Int', ); no Any::Moose; sub result { my ($self, $obj) = @_; my $class = blessed $self; $class->new( target_uri => $self->response_uri . '/onResult', response_uri => '', value => $obj, version => $self->version, ); } sub error { my ($self, $obj) = @_; my $class = blessed $self; $class->new( target_uri => $self->response_uri . '/onStatus', response_uri => '', value => $obj, version => $self->version, ); } __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF::Message - AMF Message class =head1 SYNOPSIS use Data::AMF::Packet; # get message my $packet = Data::AMF::Packet->deserialize($amf_packet); my $messages = $packet->messages; # do something about it my $first_request = $messages->[0]; # and return response my $response = $first_request->result($perl_object_you_want_to_return); =head1 DESCRIPTION Data::AMF::Message is an object class for AMF Packet Message. =head1 SEE ALSO L, L =head1 METHODS =head2 new Create new Data::AMF::Message object. =head2 result($result) Return normal response AMF Message object against current request of AMF Message. =head2 error($error) Return error response AMF Message object against current request of AMF Message. =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Packet.pm000644 000765 000024 00000010060 11421457147 017530 0ustar00typesterstaff000000 000000 package Data::AMF::Packet; use Any::Moose; require bytes; use Data::AMF::Parser; use Data::AMF::Formatter; use Data::AMF::IO; use Data::AMF::Header; use Data::AMF::Message; has version => ( is => 'rw', isa => 'Int', lazy => 1, default => sub { 0 }, ); has headers => ( is => 'rw', isa => 'ArrayRef', lazy => 1, default => sub { [] }, ); has messages => ( is => 'rw', isa => 'ArrayRef', lazy => 1, default => sub { [] }, ); no Any::Moose; sub deserialize { my ($class, $data) = @_; my $io = Data::AMF::IO->new(data => $data); my $ver = $io->read_u16; my $header_count = $io->read_u16; my $message_count = $io->read_u16; my $parser = Data::AMF::Parser->new(version => 0); my @headers; for my $i (1 .. $header_count) { my $name = $io->read_utf8; my $must = $io->read_u32; my $len = $io->read_u32; my $data = $io->read($len); my ($value) = $parser->parse($data); push @headers, Data::AMF::Header->new( name => $name, must_understand => $must, value => $value, version => $ver, ); } my @messages; for my $i (1 .. $message_count) { my $target_uri = $io->read_utf8; my $response_uri = $io->read_utf8; my $len = $io->read_u32; my $data = $io->read($len); my ($value) = $parser->parse($data); push @messages, Data::AMF::Message->new( target_uri => $target_uri, response_uri => $response_uri, value => $value, version => $ver, source => $data ); } return Data::AMF::Packet->new( version => $ver, headers => \@headers, messages => \@messages, ); } sub serialize { my $self = shift; my $io = Data::AMF::IO->new( data => q[] ); $io->write_u16($self->version); $io->write_u16(scalar @{ $self->headers }); $io->write_u16(scalar @{ $self->messages }); for my $header (@{ $self->headers }) { $io->write_utf8( $header->name ); $io->write_u32( $header->must_understand ); my $data; if ($self->version == 3) { my $formatter = Data::AMF::Formatter->new(version => 3)->new; $formatter->io->write_u8(0x11); $formatter->write($header->value); $data = $formatter->io->data; } else { $data = Data::AMF::Formatter->new(version => 0)->format($header->value); } $io->write_u32(bytes::length($data)); $io->write($data); } for my $message (@{ $self->messages }) { $io->write_utf8($message->target_uri); $io->write_utf8($message->response_uri); my $data; if ($self->version == 3) { my $formatter = Data::AMF::Formatter->new(version => 3)->new; $formatter->io->write_u8(0x11); $formatter->write($message->value); $data = $formatter->io->data; } else { $data = Data::AMF::Formatter->new(version => 0)->format($message->value); } $io->write_u32(bytes::length($data)); $io->write($data); } return $io->data; } __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF::Packet - serialize / deserialize AMF message packet =head1 SYNOPSIS use Data::AMF::Packet my $packet = Data::AMF::Packet->deserialize($data); my $data = $packet->serialize; =head1 DESCRIPTION Data::AMF::Packet provides to serialize/deserialize AMF Packet. AMF Packet is an extended format of AMF, and is used for Flash's HTTP based Remote Procidure Call (known as Flash Remoting). =head1 SEE ALSO L, L =head1 METHODS =head2 serialize Serialize Data::AMF::Packet object into AMF Packet data. =head2 deserialize($amf_packet) Deserialize AMF Packet, and return Data::AMF::Packet object. =head1 ACCESSORS =head2 version return AMF Packet version. =head2 headers return AMF Packet header objects. (ArrayRef of L) =head2 messages return AMF Packet Message objects. (ArrayRef of L) =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Parser/000755 000765 000024 00000000000 11437121525 017215 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/AMF/Parser.pm000644 000765 000024 00000001513 11421457206 017554 0ustar00typesterstaff000000 000000 package Data::AMF::Parser; use strict; use warnings; use Data::AMF::Parser::AMF0; use Data::AMF::Parser::AMF3; sub new { my $class = shift; my $args = @_ > 1 ? {@_} : $_[0]; return ($args->{version} || 0) == 3 ? 'Data::AMF::Parser::AMF3' : 'Data::AMF::Parser::AMF0'; } 1; __END__ =head1 NAME Data::AMF::Parser - deserializer proxy class =head1 SYNOPSIS my $amf3_parser_class = Data::AMF::Parser->new( version => 3 ); my $amf0_parser_class = Data::AMF::Parser->new( version => 0 ); # or just new without option =head1 METHODS =head2 new =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Remoting.pm000644 000765 000024 00000007611 11421457271 020113 0ustar00typesterstaff000000 000000 package Data::AMF::Remoting; use strict; use warnings; use Data::AMF::Message; use Data::AMF::Packet; use constant CLIENT_PING_OPERATION => 5; use constant COMMAND_MESSAGE => 'flex.messaging.messages.CommandMessage'; use constant REMOTING_MESSAGE => 'flex.messaging.messages.RemotingMessage'; use constant ACKNOWLEDGE_MESSAGE => 'flex.messaging.messages.AcknowledgeMessage'; sub new { my $class = shift; my $self = bless { source => undef, data => undef, headers_did_process => sub {}, message_did_process => sub {}, @_, }, $class; if (ref $self->{headers_handler} eq 'CODE') { $self->{headers_did_process} = $self->{headers_handler}; } if (ref $self->{message_handler} eq 'CODE') { $self->{message_did_process} = $self->{message_handler}; } return $self; } sub data { $_[0]->{'data'} } sub run { my $self = shift; my $request = Data::AMF::Packet->deserialize($self->{'source'}); my @headers = @{ $request->headers }; @headers = $self->{'headers_did_process'}->(@headers); my @messages; for my $message (@{ $request->messages }) { my $target_uri = $message->target_uri; # RemoteObject if (not defined $target_uri or $target_uri eq 'null') { my $type = $message->value->[0]->{'_explicitType'}; my $source = $message->value->[0]->{'source'}; my $operation = $message->value->[0]->{'operation'}; if ($type eq COMMAND_MESSAGE and $operation eq CLIENT_PING_OPERATION) { push @messages, $message->result($message->value->[0]); } elsif ($type eq REMOTING_MESSAGE) { $target_uri = ''; if (defined $source and $source ne '') { $target_uri .= $source . '.'; } if (defined $operation and $operation ne '') { $target_uri .= $operation; } my $res = $self->{'message_did_process'}->( Data::AMF::Message->new( target_uri => $target_uri, response_uri => '', value => $message->value->[0]->{'body'} ) ); push @messages, $message->result({ correlationId => $message->value->[0]->{'messageId'}, messageId => undef, clientId => undef, destination => '', timeToLive => 0, timestamp => 0, body => $res, headers => {}, _explicitType => ACKNOWLEDGE_MESSAGE, }); } else { die "Recived unsupported message."; } } # Net Connection else { my $res = $self->{'message_did_process'}->($message); push @messages, $message->result($res); } } my $response = Data::AMF::Packet->new( version => $request->version, headers => \@headers, messages => \@messages, ); $self->{'data'} = $response->serialize; return $self; } 1; __END__ =head1 NAME Data::AMF::Remoting - handle Flash/Flex RPC. =head1 SYNOPSIS use Data::AMF::Remoting my $remoting = Data::AMF::Remoting->new( source => $data, headers_handler => sub { my @headers = @_; # Do authenticate or something. return @headers; }, message_handler => sub { my $message = shift; # Call action using target_uri and value. my ($controller_name, $action) = split '\.', $message->target_uri; $controller_name->require; my $controller = $controller_name->new; return $controller->$action($message->value); } ); $remoting->run; my $data = $remoting->data; =head1 DESCRIPTION Data::AMF::Remoting provides to handle Flash/Flex RPC. =head1 SEE ALSO L =head1 METHODS =head2 run Handle AMF Packet data. =head1 ACCESSORS =head2 data return AMF Data =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Type/000755 000765 000024 00000000000 11437121525 016702 5ustar00typesterstaff000000 000000 Data-AMF-0.09/lib/Data/AMF/Type/Boolean.pm000644 000765 000024 00000001130 11421457312 020611 0ustar00typesterstaff000000 000000 package Data::AMF::Type::Boolean; use strict; use warnings; sub new { my $class = shift; my $self = bless { data => $_[0] }, $class; return $self; } sub data { my $self = shift; if(@_) { $self->{'data'} = $_[0]; } return $self->{'data'}; } 1; __END__ =head1 NAME Data::AMF::Type::Boolean =head1 SYNOPSIS =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Type/ByteArray.pm000644 000765 000024 00000001134 11421457330 021140 0ustar00typesterstaff000000 000000 package Data::AMF::Type::ByteArray; use strict; use warnings; sub new { my $class = shift; my $self = bless { data => $_[0] }, $class; return $self; } sub data { my $self = shift; if(@_) { $self->{'data'} = $_[0]; } return $self->{'data'}; } 1; __END__ =head1 NAME Data::AMF::Type::ByteArray =head1 SYNOPSIS =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Type/Null.pm000644 000765 000024 00000000735 11421457341 020160 0ustar00typesterstaff000000 000000 package Data::AMF::Type::Null; use strict; use warnings; sub new { my $class = shift; my $self = bless { }, $class; return $self; } 1; __END__ =head1 NAME Data::AMF::Type::NULL =head1 SYNOPSIS =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Parser/AMF0.pm000644 000765 000024 00000007176 11421457225 020253 0ustar00typesterstaff000000 000000 package Data::AMF::Parser::AMF0; use strict; use warnings; use Data::AMF::IO; use Data::AMF::Parser::AMF3; use constant PARSERS => [ \&parse_number, \&parse_boolean, \&parse_string, \&parse_object, \&parse_movieclip, \&parse_null, \&parse_undefined, \&parse_reference, \&parse_ecma_array, sub { }, # object end \&parse_strict_array, \&parse_date, \&parse_long_string, \&parse_unsupported, \&parse_recordset, \&parse_xml_document, \&parse_typed_object, \&parse_avmplus_object, ]; sub parse { my ($class, $data) = @_; my @res; my $io = ref($data) eq 'Data::AMF::IO' ? $data : Data::AMF::IO->new(data => $data); while (defined( my $marker = $io->read_u8 )) { my $p = PARSERS->[$marker] or die; push @res, $p->($io); } @res; } sub parse_one { my ($class, $data) = @_; my @res; my $io = ref($data) eq 'Data::AMF::IO' ? $data : Data::AMF::IO->new($data); my $marker = $io->read_u8; return unless defined $marker; my $p = PARSERS->[$marker] or die; $p->($io); } sub parse_number { my $io = shift; $io->read_double; } sub parse_boolean { my $io = shift; $io->read_u8 ? 1 : 0; } sub parse_string { my $io = shift; $io->read_utf8; } sub parse_object { my $io = shift; my $obj = {}; push @{ $io->refs }, $obj; while (1) { my $len = $io->read_u16; if ($len == 0) { $io->read_u8; # object-end marker return $obj; } my $key = $io->read($len); my $value = __PACKAGE__->parse_one($io); $obj->{ $key } = $value; } $obj; } sub parse_movieclip { } sub parse_null { undef; } sub parse_undefined { undef; # XXX } sub parse_reference { my $io = shift; my $index = $io->read_u16; $io->refs->[$index] or return; } sub parse_ecma_array { my $io = shift; my $count = $io->read_u32; parse_object($io); } sub parse_strict_array { my $io = shift; my $count = $io->read_u32; my @res; for (1 .. $count) { push @res, __PACKAGE__->parse_one($io); } my $array = \@res; push @{ $io->refs }, $array; $array; } sub parse_date { my $io = shift; my $msec = $io->read_double; my $tz = $io->read_s16; $msec; } sub parse_long_string { my $io = shift; $io->read_utf8_long; } sub parse_unsupported { } sub parse_recordset { } sub parse_xml_document { parse_long_string(shift) # XXX } sub parse_typed_object { my $io = shift; my $class = $io->read_utf8; parse_object($io); } sub parse_avmplus_object { my $io = shift; my $parser = Data::AMF::Parser::AMF3->new; $parser->{'io'} = $io; $parser->read; } 1; __END__ =head1 NAME Data::AMF::Parser::AMF0 - deserializer for AMF0 =head1 SYNOPSIS my $obj = Data::AMF::Parser::AMF0->parse($amf0_data); =head1 METHODS =head2 parse =head2 parse_one =head2 parse_number =head2 parse_boolean =head2 parse_string =head2 parse_object =head2 parse_movieclip =head2 parse_null =head2 parse_undefined =head2 parse_reference =head2 parse_ecma_array =head2 parse_strict_array =head2 parse_date =head2 parse_long_string =head2 parse_unsupported =head2 parse_recordset =head2 parse_xml_document =head2 parse_typed_object =head2 parse_avmplus_object =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Parser/AMF3.pm000644 000765 000024 00000022150 11421457247 020247 0ustar00typesterstaff000000 000000 package Data::AMF::Parser::AMF3; use strict; use warnings; use Data::AMF::IO; use UNIVERSAL::require; # ---------------------------------------------------------------------- # Class Constants # ---------------------------------------------------------------------- use constant AMF3_TYPES => [ 'undefined', 'null', 'false', 'true', 'integer', 'number', 'string', 'xml_document', 'date', 'array', 'object', 'xml', 'byte_array', ]; use constant AMF3_INTEGER_MAX => "268435455"; # ---------------------------------------------------------------------- # Class Methods # ---------------------------------------------------------------------- sub parse { my ($class, $data) = @_; my $self = $class->new; $self->{'io'} = Data::AMF::IO->new(data => $data); return $self->read; } # ---------------------------------------------------------------------- # Constructor # ---------------------------------------------------------------------- sub new { my $class = shift; my $self = bless { io => undef, class_member_defs => {}, stored_strings => [], stored_objects => [], stored_defs => [], @_ }, $class; return $self; } # ---------------------------------------------------------------------- # Properties # ---------------------------------------------------------------------- sub io { return $_[0]->{'io'} } # ---------------------------------------------------------------------- # Methods # ---------------------------------------------------------------------- sub read { my $self = shift; my @res; while (defined(my $marker = $self->io->read_u8)) { my $method = 'read_' . AMF3_TYPES->[$marker] or die; push @res, $self->$method(); } @res; } sub read_one { my $self = shift; my $marker = $self->io->read_u8; return unless defined $marker; my $method = 'read_' . AMF3_TYPES->[$marker] or die; return $self->$method(); } sub read_undefined { return undef; } sub read_null { Data::AMF::Type::Null->require; return Data::AMF::Type::Null->new; } sub read_false { Data::AMF::Type::Boolean->require; return Data::AMF::Type::Boolean->new(0); } sub read_true { Data::AMF::Type::Boolean->require; return Data::AMF::Type::Boolean->new(1); } sub read_integer { my $self = shift; my $n = 0; my $b = $self->io->read_u8 || 0; my $result = 0; while (($b & 0x80) != 0 && $n < 3) { $result = $result << 7; $result = $result | ($b & 0x7f); $b = $self->io->read_u8 || 0; $n++; } if ($n < 3) { $result = $result << 7; $result = $result | $b; } else { # Use all 8 bits from the 4th byte $result = $result << 8; $result = $result | $b; # Check if the integer should be negative if ($result > AMF3_INTEGER_MAX) { # and extend the sign bit $result -= (1 << 29); } } return $result; } sub read_number { my $self = shift; return $self->io->read_double; } sub read_string { my $self = shift; my $type = $self->read_integer(); my $isReference = ($type & 0x01) == 0; if ($isReference) { my $reference = $type >> 1; if ($reference < @{ $self->{'stored_strings'} }) { if (not defined $self->{'stored_strings'}->[$reference]) { die "Reference to non existant object at index #{$reference}."; } return $self->{'stored_strings'}->[$reference]; } else { die "Reference to non existant object at index #{$reference}."; } } else { my $length = $type >> 1; my $str = ''; if ($length > 0) { $str = $self->io->read($length); push @{ $self->{'stored_strings'} }, $str; } return $str; } } sub read_xml_document { my $self = shift; my $type = $self->read_integer(); my $length = $type >> 1; my $obj = $self->io->read($length); push @{ $self->{'stored_objects'} }, $obj; return $obj; } sub read_date { my $self = shift; my $type = $self->read_integer(); my $isReference = ($type & 0x01) == 0; if ($isReference) { my $reference = $type >> 1; if ($reference < @{ $self->{'stored_objects'} }) { if (not defined $self->{'stored_objects'}->[$reference]) { die "Reference to non existant object at index #{$reference}."; } return $self->{'stored_objects'}->[$reference]; } else { die "Reference to non existant object at index #{$reference}."; } } else { my $epoch = $self->io->read_double / 1000; DateTime->require; my $datetime = DateTime->from_epoch( epoch => $epoch ); push @{ $self->{'stored_objects'} }, $datetime; return $datetime; } } sub read_array { my $self = shift; my $type = $self->read_integer(); my $isReference = ($type & 0x01) == 0; if ($isReference) { my $reference = $type >> 1; if ($reference < @{ $self->{'stored_objects'} }) { if (not defined $self->{'stored_objects'}->[$reference]) { die "Reference to non existant object at index #{$reference}."; } return $self->{'stored_objects'}->[$reference]; } else { die "Reference to non existant object at index #{$reference}."; } } else { my $length = $type >> 1; my $key = $self->read_string(); my $array; if ($key ne '') { $array = {}; push @{ $self->{'stored_objects'} }, $array; while($key ne '') { my $value = $self->read_one(); $array->{$key} = $value; $key = $self->read_string(); } for (0 .. $length - 1) { $array->{$_} = $self->read_one(); } } else { $array = []; push @{ $self->{'stored_objects'} }, $array; for (0 .. $length - 1) { push @{ $array }, $self->read_one(); } } return $array; } } sub read_object { my $self = shift; my $type = $self->read_integer(); my $isReference = ($type & 0x01) == 0; if ($isReference) { my $reference = $type >> 1; if ($reference < @{ $self->{'stored_objects'} }) { if (not defined $self->{'stored_objects'}->[$reference]) { die "Reference to non existant object at index #{$reference}."; } return $self->{'stored_objects'}->[$reference]; } else { warn "Reference to non existant object at index #{$reference}."; } } else { my $class_type = $type >> 1; my $class_is_reference = ($class_type & 0x01) == 0; my $class_definition; if ($class_is_reference) { my $class_reference = $class_type >> 1; if ($class_reference < @{ $self->{'stored_defs'} }) { $class_definition = $self->{'stored_defs'}->[$class_reference]; } else { die "Reference to non existant object at index #{$class_reference}."; } } else { my $as_class_name = $self->read_string(); my $externalizable = ($class_type & 0x02) != 0; my $dynamic = ($class_type & 0x04) != 0; my $attr_count = $class_type >> 3; my $members = []; for (1 .. $attr_count) { push @{ $members }, $self->read_string(); } $class_definition = { "as_class_name" => $as_class_name, "members" => $members, "externalizable" => $externalizable, "dynamic" => $dynamic }; push @{ $self->{'stored_defs'} }, $class_definition; } my $action_class_name = $class_definition->{'as_class_name'}; my ($skip_mapping, $obj); if ($action_class_name && $action_class_name =~ /flex\.messaging/) { $obj = {}; $obj->{'_explicitType'} = $action_class_name; $skip_mapping = 1; } else { $obj = {}; $skip_mapping = 0; } my $obj_position = @{ $self->{'stored_objects'} }; push @{ $self->{'stored_objects'} }, $obj; if ($class_definition->{'externalizable'}) { $obj = $self->read_one(); } else { for my $key (@{ $class_definition->{'members'} }) { $obj->{$key} = $self->read_one(); } } if ($class_definition->{'dynamic'}) { my $key; while (($key = $self->read_string()) && $key ne '') { $obj->{$key} = $self->read_one(); } } return $obj; } } sub read_xml { my $self = shift; my $type = $self->read_integer(); my $length = $type >> 1; my $obj = $self->io->read($length); XML::LibXML->require; my $xml = XML::LibXML->new()->parse_string($obj); push @{ $self->{'stored_objects'} }, $xml; return $xml; } sub read_byte_array { my $self = shift; my $type = $self->read_integer(); my $isReference = ($type & 0x01) == 0; if ($isReference) { my $reference = $type >> 1; if ($reference < @{ $self->{'stored_objects'} }) { if (not defined $self->{'stored_objects'}->[$reference]) { die "Reference to non existant object at index #{$reference}."; } return $self->{'stored_objects'}->[$reference]; } else { die "Reference to non existant object at index #{$reference}."; } } else { my $length = $type >> 1; my @obj = unpack('C' . $length, $self->io->read($length)); Data::AMF::Type::ByteArray->require; my $obj = Data::AMF::Type::ByteArray->new(\@obj); push @{ $self->{'stored_objects'} }, $obj; return $obj; } } 1; __END__ =head1 NAME Data::AMF::Parser::AMF3 - deserializer for AMF3 =head1 SYNOPSIS my $obj = Data::AMF::Parser::AMF3->parse($amf3_data); =head1 METHODS =head2 parse =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Formatter/AMF0.pm000644 000765 000024 00000005540 11437114565 020757 0ustar00typesterstaff000000 000000 package Data::AMF::Formatter::AMF0; use Any::Moose; require bytes; use Scalar::Util qw/looks_like_number blessed/; use Data::AMF::IO; has 'io' => ( is => 'rw', isa => 'Data::AMF::IO', lazy => 1, default => sub { Data::AMF::IO->new( data => q[] ); }, ); no Any::Moose; sub format { my ($self, @obj) = @_; $self = $self->new unless blessed $self; for my $obj (@obj) { if (my $pkg = blessed $obj) { $self->format_typed_object($obj); } elsif (my $ref = ref($obj)) { if ($ref eq 'ARRAY') { $self->format_strict_array($obj); } elsif ($ref eq 'HASH') { $self->format_object($obj); } else { Carp::confess qq[cannot format "$ref" object]; } } else { if (looks_like_number($obj) && $obj !~ /^0\d/) { $self->format_number($obj); } elsif (defined($obj)) { $self->format_string($obj); } else { $self->format_null($obj); } } } $self->io->data; } sub format_number { my ($self, $obj) = @_; $self->io->write_u8(0x00); $self->io->write_double($obj); } sub format_string { my ($self, $obj) = @_; $self->io->write_u8(0x02); $self->io->write_utf8($obj); } sub format_strict_array { my ($self, $obj) = @_; my @array = @{ $obj }; $self->io->write_u8(0x0a); $self->io->write_u32( scalar @array ); for my $v (@array) { $self->format($v); } } sub format_object { my ($self, $obj) = @_; $self->io->write_u8(0x03); for my $key (keys %$obj) { my $len = bytes::length($key); $self->io->write_u16($len); $self->io->write($key); $self->format($obj->{$key}); } $self->io->write_u16(0x00); $self->io->write_u8(0x09); # object-end marker } sub format_null { my ($self, $obj) = @_; $self->io->write_u8(0x05); # null marker } sub format_typed_object { my ($self, $obj) = @_; $self->io->write_u8(0x10); my $class = blessed $obj; $self->io->write_utf8($class); $self->format_object($obj); } __PACKAGE__->meta->make_immutable; __END__ =head1 NAME Data::AMF::Formatter::AMF0 - AMF0 serializer =head1 SYNOPSIS my $amf0_data = Data::AMF::Formatter::AMF0->format($obj); =head1 METHODS =head2 format =head2 format_number =head2 format_string =head2 format_strict_array =head2 format_object =head2 format_null =head2 format_typed_object =head1 AUTHOR Daisuke Murase =head1 COPYRIGHT 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. =cut Data-AMF-0.09/lib/Data/AMF/Formatter/AMF3.pm000644 000765 000024 00000017025 11426130276 020756 0ustar00typesterstaff000000 000000 package Data::AMF::Formatter::AMF3; use strict; use warnings; require bytes; use Data::AMF::IO; use Scalar::Util qw/blessed looks_like_number/; # ---------------------------------------------------------------------- # Class Constants # ---------------------------------------------------------------------- use constant { UNDEFINED_MARKER => 0x00, NULL_MARKER => 0x01, FALSE_MARKER => 0x02, TRUE_MARKER => 0x03, INTEGER_MARKER => 0x04, NUMBER_MARKER => 0x05, STRING_MARKER => 0x06, XML_DOC_MARKER => 0x07, DATE_MARKER => 0x08, ARRAY_MARKER => 0x09, OBJECT_MARKER => 0x0A, XML_MARKER => 0x0B, BYTE_ARRAY_MARKER => 0x0C, AMF3_INTEGER_MIN => "-268435456", AMF3_INTEGER_MAX => "268435455" }; # ---------------------------------------------------------------------- # Class Methods # ---------------------------------------------------------------------- sub format { my ($class, $object) = @_; my $self = $class->new; $self->write($object); return $self->io->data; } # ---------------------------------------------------------------------- # Constructor # ---------------------------------------------------------------------- sub new { my $class = shift; my $self = bless { io => Data::AMF::IO->new( data => q[] ), stored_objects_count => 0, stored_objects => {}, stored_strings_count => 0, stored_strings => {}, @_ }, $class; return $self; } # ---------------------------------------------------------------------- # Properties # ---------------------------------------------------------------------- sub io { return $_[0]->{'io'} } # ---------------------------------------------------------------------- # Methods # ---------------------------------------------------------------------- sub write { my ($self, $value) = @_; if (my $pkg = blessed $value) { if ($pkg eq 'Data::AMF::Type::Boolean') { if ($value->data) { $self->io->write_u8(TRUE_MARKER); } else { $self->io->write_u8(FALSE_MARKER); } } elsif ($pkg eq 'Data::AMF::Type::ByteArray') { $self->io->write_u8(BYTE_ARRAY_MARKER); $self->write_byte_array($value); } elsif ($pkg eq 'Data::AMF::Type::Null') { $self->io->write_u8(NULL_MARKER); } elsif ($pkg eq 'DateTime') { $self->io->write_u8(DATE_MARKER); $self->write_date($value); } elsif ($pkg eq 'XML::LibXML::Document') { $self->io->write_u8(XML_MARKER); $self->write_xml($value); } else { $self->io->write_u8(OBJECT_MARKER); $self->write_object($value); } } elsif (my $ref = ref($value)) { if ($ref eq 'ARRAY') { $self->io->write_u8(ARRAY_MARKER); $self->write_array($value); } elsif ($ref eq 'HASH') { $self->io->write_u8(OBJECT_MARKER); $self->write_object($value); } else { die qq[cannot format "$ref" object]; } } else { if (looks_like_number($value)) { if ($value >= AMF3_INTEGER_MIN && $value <= AMF3_INTEGER_MAX && $value == int($value)) { $self->io->write_u8(INTEGER_MARKER); $self->write_integer($value); } else { $self->io->write_u8(NUMBER_MARKER); $self->write_number($value); } } elsif (defined $value) { $self->io->write_u8(STRING_MARKER); $self->write_string($value); } else { $self->io->write_u8(UNDEFINED_MARKER); } } } sub write_integer { my ($self, $value) = @_; $value = $value & 0x1fffffff; if ($value < 0x80) { $self->io->write_u8($value); } elsif ($value < 0x4000) { $self->io->write( pack('C', $value >> 7 & 0x7f | 0x80) . pack('C', $value & 0x7f) ); } elsif ($value < 0x200000) { $self->io->write( pack('C', $value >> 14 & 0x7f | 0x80) . pack('C', $value >> 7 & 0x7f | 0x80) . pack('C', $value & 0x7f) ); } else { $self->io->write( pack('C', $value >> 22 & 0x7f | 0x80) . pack('C', $value >> 15 & 0x7f | 0x80) . pack('C', $value >> 8 & 0x7f | 0x80) . pack('C', $value & 0xff) ); } } sub write_number { my ($self, $value) = @_; $self->io->write_double($value); } sub write_string { my ($self, $value) = @_; my $i = $self->{'stored_strings'}->{$value}; if (defined $i) { if ($value eq '') { $self->io->write_u8(NULL_MARKER); } else { my $reference = $i << 1; $self->write_integer($reference); } } else { if ($value ne '') { $self->{'stored_strings'}->{$value} = $self->{'stored_strings_count'}; $self->{'stored_strings_count'}++; } my $reference = length $value; $reference = $reference << 1 | 1; $self->write_integer($reference); $self->io->write($value); } } sub write_array { my ($self, $value) = @_; my $i = $self->{'stored_objects'}->{$value}; if (defined $i) { my $reference = $i << 1; $self->write_integer($reference); } else { $self->{'stored_objects'}->{$value} = $self->{'stored_objects_count'}; $self->{'stored_objects_count'}++; my $reference = @{ $value }; $reference = $reference << 1 | 0x01; $self->write_integer($reference); $self->io->write_u8(NULL_MARKER); for my $v (@{ $value }) { $self->write($v); } } } sub write_object { my ($self, $value) = @_; my $i = $self->{'stored_objects'}->{$value}; if (defined $i) { my $reference = $i << 1; $self->write_integer($reference); } else { $self->{'stored_objects'}->{$value} = $self->{'stored_objects_count'}; $self->{'stored_objects_count'}++; $self->io->write_u8(0x0B); # U29o-traits (ダイナミッククラス) if (defined $value->{'_explicitType'}) { $self->write_string($value->{'_explicitType'}); } else { $self->io->write_u8(NULL_MARKER); # 匿名クラスの場合は空ストリング } for my $k (keys %{ $value }) { next if $k eq '_explicitType'; $self->write_string($k); my $v = $value->{$k}; if (defined $v) { $self->write($value->{$k}); } else { $self->io->write_u8(NULL_MARKER); } } $self->io->write_u8(NULL_MARKER); } } sub write_byte_array { my ($self, $value) = @_; my $i = $self->{'stored_objects'}->{$value}; if (defined $i) { my $reference = $i << 1; $self->write_integer($reference); } else { $self->{'stored_objects'}->{$value} = $self->{'stored_objects_count'}; $self->{'stored_objects_count'}++; my $data = $value->data; my $length = scalar @$data; my $bin = pack('C' . $length, @$data); my $reference = $length << 1 | 1; $self->write_integer($reference); $self->io->write($bin); } } sub write_date { my ($self, $value) = @_; my $i = $self->{'stored_objects'}->{$value}; if (defined $i) { my $reference = $i << 1; $self->write_integer($reference); } else { $self->{'stored_objects'}->{$value} = $self->{'stored_objects_count'}; $self->{'stored_objects_count'}++; $self->write_integer(1); my $msec = $value->epoch * 1000; $self->io->write_double($msec); } } sub write_xml { my ($self, $value) = @_; my $i = $self->{'stored_objects'}->{$value}; if (defined $i) { my $reference = $i << 1; $self->write_integer($reference); } else { $self->{'stored_objects'}->{$value} = $self->{'stored_objects_count'}; $self->{'stored_objects_count'}++; my $obj = $value->toString(); $self->write_string($obj); } } =head1 NAME Data::AMF::Formatter::AMF3 - AMF3 serializer =head1 SYNOPSIS my $amf3_data = Data::AMF::Formatter::AMF3->format($obj); =head1 METHODS =head2 format =head1 AUTHOR Takuho Yoshizu =head1 COPYRIGHT 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. =cut 1; Data-AMF-0.09/inc/Module/000755 000765 000024 00000000000 11437121525 015735 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/Spiffy.pm000644 000765 000024 00000036231 11437121524 016312 0ustar00typesterstaff000000 000000 #line 1 package Spiffy; use strict; use 5.006001; use warnings; use Carp; require Exporter; our $VERSION = '0.30'; our @EXPORT = (); our @EXPORT_BASE = qw(field const stub super); our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ)); our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]); my $stack_frame = 0; my $dump = 'yaml'; my $bases_map = {}; sub WWW; sub XXX; sub YYY; sub ZZZ; # This line is here to convince "autouse" into believing we are autousable. sub can { ($_[1] eq 'import' and caller()->isa('autouse')) ? \&Exporter::import # pacify autouse's equality test : $_[0]->SUPER::can($_[1]) # normal case } # TODO # # Exported functions like field and super should be hidden so as not to # be confused with methods that can be inherited. # sub new { my $class = shift; $class = ref($class) || $class; my $self = bless {}, $class; while (@_) { my $method = shift; $self->$method(shift); } return $self; } my $filtered_files = {}; my $filter_dump = 0; my $filter_save = 0; our $filter_result = ''; sub import { no strict 'refs'; no warnings; my $self_package = shift; # XXX Using parse_arguments here might cause confusion, because the # subclass's boolean_arguments and paired_arguments can conflict, causing # difficult debugging. Consider using something truly local. my ($args, @export_list) = do { local *boolean_arguments = sub { qw( -base -Base -mixin -selfless -XXX -dumper -yaml -filter_dump -filter_save ) }; local *paired_arguments = sub { qw(-package) }; $self_package->parse_arguments(@_); }; return spiffy_mixin_import(scalar(caller(0)), $self_package, @export_list) if $args->{-mixin}; $filter_dump = 1 if $args->{-filter_dump}; $filter_save = 1 if $args->{-filter_save}; $dump = 'yaml' if $args->{-yaml}; $dump = 'dumper' if $args->{-dumper}; local @EXPORT_BASE = @EXPORT_BASE; if ($args->{-XXX}) { push @EXPORT_BASE, @{$EXPORT_TAGS{XXX}} unless grep /^XXX$/, @EXPORT_BASE; } spiffy_filter() if ($args->{-selfless} or $args->{-Base}) and not $filtered_files->{(caller($stack_frame))[1]}++; my $caller_package = $args->{-package} || caller($stack_frame); push @{"$caller_package\::ISA"}, $self_package if $args->{-Base} or $args->{-base}; for my $class (@{all_my_bases($self_package)}) { next unless $class->isa('Spiffy'); my @export = grep { not defined &{"$caller_package\::$_"}; } ( @{"$class\::EXPORT"}, ($args->{-Base} or $args->{-base}) ? @{"$class\::EXPORT_BASE"} : (), ); my @export_ok = grep { not defined &{"$caller_package\::$_"}; } @{"$class\::EXPORT_OK"}; # Avoid calling the expensive Exporter::export # if there is nothing to do (optimization) my %exportable = map { ($_, 1) } @export, @export_ok; next unless keys %exportable; my @export_save = @{"$class\::EXPORT"}; my @export_ok_save = @{"$class\::EXPORT_OK"}; @{"$class\::EXPORT"} = @export; @{"$class\::EXPORT_OK"} = @export_ok; my @list = grep { (my $v = $_) =~ s/^[\!\:]//; $exportable{$v} or ${"$class\::EXPORT_TAGS"}{$v}; } @export_list; Exporter::export($class, $caller_package, @list); @{"$class\::EXPORT"} = @export_save; @{"$class\::EXPORT_OK"} = @export_ok_save; } } sub spiffy_filter { require Filter::Util::Call; my $done = 0; Filter::Util::Call::filter_add( sub { return 0 if $done; my ($data, $end) = ('', ''); while (my $status = Filter::Util::Call::filter_read()) { return $status if $status < 0; if (/^__(?:END|DATA)__\r?$/) { $end = $_; last; } $data .= $_; $_ = ''; } $_ = $data; my @my_subs; s[^(sub\s+\w+\s+\{)(.*\n)] [${1}my \$self = shift;$2]gm; s[^(sub\s+\w+)\s*\(\s*\)(\s+\{.*\n)] [${1}${2}]gm; s[^my\s+sub\s+(\w+)(\s+\{)(.*)((?s:.*?\n))\}\n] [push @my_subs, $1; "\$$1 = sub$2my \$self = shift;$3$4\};\n"]gem; my $preclare = ''; if (@my_subs) { $preclare = join ',', map "\$$_", @my_subs; $preclare = "my($preclare);"; } $_ = "use strict;use warnings;$preclare${_};1;\n$end"; if ($filter_dump) { print; exit } if ($filter_save) { $filter_result = $_; $_ = $filter_result; } $done = 1; } ); } sub base { push @_, -base; goto &import; } sub all_my_bases { my $class = shift; return $bases_map->{$class} if defined $bases_map->{$class}; my @bases = ($class); no strict 'refs'; for my $base_class (@{"${class}::ISA"}) { push @bases, @{all_my_bases($base_class)}; } my $used = {}; $bases_map->{$class} = [grep {not $used->{$_}++} @bases]; } my %code = ( sub_start => "sub {\n", set_default => " \$_[0]->{%s} = %s\n unless exists \$_[0]->{%s};\n", init => " return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" . " unless \$#_ > 0 or defined \$_[0]->{%s};\n", weak_init => " return do {\n" . " \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" . " Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" . " \$_[0]->{%s};\n" . " } unless \$#_ > 0 or defined \$_[0]->{%s};\n", return_if_get => " return \$_[0]->{%s} unless \$#_ > 0;\n", set => " \$_[0]->{%s} = \$_[1];\n", weaken => " Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n", sub_end => " return \$_[0]->{%s};\n}\n", ); sub field { my $package = caller; my ($args, @values) = do { no warnings; local *boolean_arguments = sub { (qw(-weak)) }; local *paired_arguments = sub { (qw(-package -init)) }; Spiffy->parse_arguments(@_); }; my ($field, $default) = @values; $package = $args->{-package} if defined $args->{-package}; die "Cannot have a default for a weakened field ($field)" if defined $default && $args->{-weak}; return if defined &{"${package}::$field"}; require Scalar::Util if $args->{-weak}; my $default_string = ( ref($default) eq 'ARRAY' and not @$default ) ? '[]' : (ref($default) eq 'HASH' and not keys %$default ) ? '{}' : default_as_code($default); my $code = $code{sub_start}; if ($args->{-init}) { my $fragment = $args->{-weak} ? $code{weak_init} : $code{init}; $code .= sprintf $fragment, $field, $args->{-init}, ($field) x 4; } $code .= sprintf $code{set_default}, $field, $default_string, $field if defined $default; $code .= sprintf $code{return_if_get}, $field; $code .= sprintf $code{set}, $field; $code .= sprintf $code{weaken}, $field, $field if $args->{-weak}; $code .= sprintf $code{sub_end}, $field; my $sub = eval $code; die $@ if $@; no strict 'refs'; *{"${package}::$field"} = $sub; return $code if defined wantarray; } sub default_as_code { require Data::Dumper; local $Data::Dumper::Sortkeys = 1; my $code = Data::Dumper::Dumper(shift); $code =~ s/^\$VAR1 = //; $code =~ s/;$//; return $code; } sub const { my $package = caller; my ($args, @values) = do { no warnings; local *paired_arguments = sub { (qw(-package)) }; Spiffy->parse_arguments(@_); }; my ($field, $default) = @values; $package = $args->{-package} if defined $args->{-package}; no strict 'refs'; return if defined &{"${package}::$field"}; *{"${package}::$field"} = sub { $default } } sub stub { my $package = caller; my ($args, @values) = do { no warnings; local *paired_arguments = sub { (qw(-package)) }; Spiffy->parse_arguments(@_); }; my ($field, $default) = @values; $package = $args->{-package} if defined $args->{-package}; no strict 'refs'; return if defined &{"${package}::$field"}; *{"${package}::$field"} = sub { require Carp; Carp::confess "Method $field in package $package must be subclassed"; } } sub parse_arguments { my $class = shift; my ($args, @values) = ({}, ()); my %booleans = map { ($_, 1) } $class->boolean_arguments; my %pairs = map { ($_, 1) } $class->paired_arguments; while (@_) { my $elem = shift; if (defined $elem and defined $booleans{$elem}) { $args->{$elem} = (@_ and $_[0] =~ /^[01]$/) ? shift : 1; } elsif (defined $elem and defined $pairs{$elem} and @_) { $args->{$elem} = shift; } else { push @values, $elem; } } return wantarray ? ($args, @values) : $args; } sub boolean_arguments { () } sub paired_arguments { () } # get a unique id for any node sub id { if (not ref $_[0]) { return 'undef' if not defined $_[0]; \$_[0] =~ /\((\w+)\)$/o or die; return "$1-S"; } require overload; overload::StrVal($_[0]) =~ /\((\w+)\)$/o or die; return $1; } #=============================================================================== # It's super, man. #=============================================================================== package DB; { no warnings 'redefine'; sub super_args { my @dummy = caller(@_ ? $_[0] : 2); return @DB::args; } } package Spiffy; sub super { my $method; my $frame = 1; while ($method = (caller($frame++))[3]) { $method =~ s/.*::// and last; } my @args = DB::super_args($frame); @_ = @_ ? ($args[0], @_) : @args; my $class = ref $_[0] ? ref $_[0] : $_[0]; my $caller_class = caller; my $seen = 0; my @super_classes = reverse grep { ($seen or $seen = ($_ eq $caller_class)) ? 0 : 1; } reverse @{all_my_bases($class)}; for my $super_class (@super_classes) { no strict 'refs'; next if $super_class eq $class; if (defined &{"${super_class}::$method"}) { ${"$super_class\::AUTOLOAD"} = ${"$class\::AUTOLOAD"} if $method eq 'AUTOLOAD'; return &{"${super_class}::$method"}; } } return; } #=============================================================================== # This code deserves a spanking, because it is being very naughty. # It is exchanging base.pm's import() for its own, so that people # can use base.pm with Spiffy modules, without being the wiser. #=============================================================================== my $real_base_import; my $real_mixin_import; BEGIN { require base unless defined $INC{'base.pm'}; $INC{'mixin.pm'} ||= 'Spiffy/mixin.pm'; $real_base_import = \&base::import; $real_mixin_import = \&mixin::import; no warnings; *base::import = \&spiffy_base_import; *mixin::import = \&spiffy_mixin_import; } # my $i = 0; # while (my $caller = caller($i++)) { # next unless $caller eq 'base' or $caller eq 'mixin'; # croak <isa('Spiffy'); } @base_classes; my $inheritor = caller(0); for my $base_class (@base_classes) { next if $inheritor->isa($base_class); croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n", "See the documentation of Spiffy.pm for details\n " unless $base_class->isa('Spiffy'); $stack_frame = 1; # tell import to use different caller import($base_class, '-base'); $stack_frame = 0; } } sub mixin { my $self = shift; my $target_class = ref($self); spiffy_mixin_import($target_class, @_) } sub spiffy_mixin_import { my $target_class = shift; $target_class = caller(0) if $target_class eq 'mixin'; my $mixin_class = shift or die "Nothing to mixin"; eval "require $mixin_class"; my @roles = @_; my $pseudo_class = join '-', $target_class, $mixin_class, @roles; my %methods = spiffy_mixin_methods($mixin_class, @roles); no strict 'refs'; no warnings; @{"$pseudo_class\::ISA"} = @{"$target_class\::ISA"}; @{"$target_class\::ISA"} = ($pseudo_class); for (keys %methods) { *{"$pseudo_class\::$_"} = $methods{$_}; } } sub spiffy_mixin_methods { my $mixin_class = shift; no strict 'refs'; my %methods = spiffy_all_methods($mixin_class); map { $methods{$_} ? ($_, \ &{"$methods{$_}\::$_"}) : ($_, \ &{"$mixin_class\::$_"}) } @_ ? (get_roles($mixin_class, @_)) : (keys %methods); } sub get_roles { my $mixin_class = shift; my @roles = @_; while (grep /^!*:/, @roles) { @roles = map { s/!!//g; /^!:(.*)/ ? do { my $m = "_role_$1"; map("!$_", $mixin_class->$m); } : /^:(.*)/ ? do { my $m = "_role_$1"; ($mixin_class->$m); } : ($_) } @roles; } if (@roles and $roles[0] =~ /^!/) { my %methods = spiffy_all_methods($mixin_class); unshift @roles, keys(%methods); } my %roles; for (@roles) { s/!!//g; delete $roles{$1}, next if /^!(.*)/; $roles{$_} = 1; } keys %roles; } sub spiffy_all_methods { no strict 'refs'; my $class = shift; return if $class eq 'Spiffy'; my %methods = map { ($_, $class) } grep { defined &{"$class\::$_"} and not /^_/ } keys %{"$class\::"}; my %super_methods; %super_methods = spiffy_all_methods(${"$class\::ISA"}[0]) if @{"$class\::ISA"}; %{{%super_methods, %methods}}; } # END of naughty code. #=============================================================================== # Debugging support #=============================================================================== sub spiffy_dump { no warnings; if ($dump eq 'dumper') { require Data::Dumper; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Indent = 1; return Data::Dumper::Dumper(@_); } require YAML; $YAML::UseVersion = 0; return YAML::Dump(@_) . "...\n"; } sub at_line_number { my ($file_path, $line_number) = (caller(1))[1,2]; " at $file_path line $line_number\n"; } sub WWW { warn spiffy_dump(@_) . at_line_number; return wantarray ? @_ : $_[0]; } sub XXX { die spiffy_dump(@_) . at_line_number; } sub YYY { print spiffy_dump(@_) . at_line_number; return wantarray ? @_ : $_[0]; } sub ZZZ { require Carp; Carp::confess spiffy_dump(@_); } 1; __END__ #line 1066 Data-AMF-0.09/inc/Test/000755 000765 000024 00000000000 11437121525 015427 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/YAML.pm000644 000765 000024 00000005155 11437121524 015615 0ustar00typesterstaff000000 000000 #line 1 package YAML; use 5.008001; use strict; use warnings; use YAML::Base; use YAML::Node; # XXX This is a temp fix for Module::Build our $VERSION = '0.71'; our @ISA = 'YAML::Base'; our @EXPORT = qw{ Dump Load }; our @EXPORT_OK = qw{ freeze thaw DumpFile LoadFile Bless Blessed }; # XXX This VALUE nonsense needs to go. use constant VALUE => "\x07YAML\x07VALUE\x07"; # YAML Object Properties field dumper_class => 'YAML::Dumper'; field loader_class => 'YAML::Loader'; field dumper_object => -init => '$self->init_action_object("dumper")'; field loader_object => -init => '$self->init_action_object("loader")'; sub Dump { my $yaml = YAML->new; $yaml->dumper_class($YAML::DumperClass) if $YAML::DumperClass; return $yaml->dumper_object->dump(@_); } sub Load { my $yaml = YAML->new; $yaml->loader_class($YAML::LoaderClass) if $YAML::LoaderClass; return $yaml->loader_object->load(@_); } { no warnings 'once'; # freeze/thaw is the API for Storable string serialization. Some # modules make use of serializing packages on if they use freeze/thaw. *freeze = \ &Dump; *thaw = \ &Load; } sub DumpFile { my $OUT; my $filename = shift; if (ref $filename eq 'GLOB') { $OUT = $filename; } else { my $mode = '>'; if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { ($mode, $filename) = ($1, $2); } open $OUT, $mode, $filename or YAML::Base->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, $!); } binmode $OUT, ':utf8'; # if $Config{useperlio} eq 'define'; local $/ = "\n"; # reset special to "sane" print $OUT Dump(@_); } sub LoadFile { my $IN; my $filename = shift; if (ref $filename eq 'GLOB') { $IN = $filename; } else { open $IN, '<', $filename or YAML::Base->die('YAML_LOAD_ERR_FILE_INPUT', $filename, $!); } binmode $IN, ':utf8'; # if $Config{useperlio} eq 'define'; return Load(do { local $/; <$IN> }); } sub init_action_object { my $self = shift; my $object_class = (shift) . '_class'; my $module_name = $self->$object_class; eval "require $module_name"; $self->die("Error in require $module_name - $@") if $@ and "$@" !~ /Can't locate/; my $object = $self->$object_class->new; $object->set_global_options; return $object; } my $global = {}; sub Bless { require YAML::Dumper::Base; YAML::Dumper::Base::bless($global, @_) } sub Blessed { require YAML::Dumper::Base; YAML::Dumper::Base::blessed($global, @_) } sub global_object { $global } 1; __END__ =encoding utf8 #line 817 Data-AMF-0.09/inc/Test/Base/000755 000765 000024 00000000000 11437121525 016301 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/Test/Base.pm000644 000765 000024 00000043074 11437121524 016646 0ustar00typesterstaff000000 000000 #line 1 # TODO: # package Test::Base; use 5.006001; use Spiffy 0.30 -Base; use Spiffy ':XXX'; our $VERSION = '0.59'; my @test_more_exports; BEGIN { @test_more_exports = qw( ok isnt like unlike is_deeply cmp_ok skip todo_skip pass fail eq_array eq_hash eq_set plan can_ok isa_ok diag use_ok $TODO ); } use Test::More import => \@test_more_exports; use Carp; our @EXPORT = (@test_more_exports, qw( is no_diff blocks next_block first_block delimiters spec_file spec_string filters filters_delay filter_arguments run run_compare run_is run_is_deeply run_like run_unlike skip_all_unless_require is_deep run_is_deep WWW XXX YYY ZZZ tie_output no_diag_on_only find_my_self default_object croak carp cluck confess )); field '_spec_file'; field '_spec_string'; field _filters => [qw(norm trim)]; field _filters_map => {}; field spec => -init => '$self->_spec_init'; field block_list => -init => '$self->_block_list_init'; field _next_list => []; field block_delim => -init => '$self->block_delim_default'; field data_delim => -init => '$self->data_delim_default'; field _filters_delay => 0; field _no_diag_on_only => 0; field block_delim_default => '==='; field data_delim_default => '---'; my $default_class; my $default_object; my $reserved_section_names = {}; sub default_object { $default_object ||= $default_class->new; return $default_object; } my $import_called = 0; sub import() { $import_called = 1; my $class = (grep /^-base$/i, @_) ? scalar(caller) : $_[0]; if (not defined $default_class) { $default_class = $class; } # else { # croak "Can't use $class after using $default_class" # unless $default_class->isa($class); # } unless (grep /^-base$/i, @_) { my @args; for (my $ii = 1; $ii <= $#_; ++$ii) { if ($_[$ii] eq '-package') { ++$ii; } else { push @args, $_[$ii]; } } Test::More->import(import => \@test_more_exports, @args) if @args; } _strict_warnings(); goto &Spiffy::import; } # Wrap Test::Builder::plan my $plan_code = \&Test::Builder::plan; my $Have_Plan = 0; { no warnings 'redefine'; *Test::Builder::plan = sub { $Have_Plan = 1; goto &$plan_code; }; } my $DIED = 0; $SIG{__DIE__} = sub { $DIED = 1; die @_ }; sub block_class { $self->find_class('Block') } sub filter_class { $self->find_class('Filter') } sub find_class { my $suffix = shift; my $class = ref($self) . "::$suffix"; return $class if $class->can('new'); $class = __PACKAGE__ . "::$suffix"; return $class if $class->can('new'); eval "require $class"; return $class if $class->can('new'); die "Can't find a class for $suffix"; } sub check_late { if ($self->{block_list}) { my $caller = (caller(1))[3]; $caller =~ s/.*:://; croak "Too late to call $caller()" } } sub find_my_self() { my $self = ref($_[0]) eq $default_class ? splice(@_, 0, 1) : default_object(); return $self, @_; } sub blocks() { (my ($self), @_) = find_my_self(@_); croak "Invalid arguments passed to 'blocks'" if @_ > 1; croak sprintf("'%s' is invalid argument to blocks()", shift(@_)) if @_ && $_[0] !~ /^[a-zA-Z]\w*$/; my $blocks = $self->block_list; my $section_name = shift || ''; my @blocks = $section_name ? (grep { exists $_->{$section_name} } @$blocks) : (@$blocks); return scalar(@blocks) unless wantarray; return (@blocks) if $self->_filters_delay; for my $block (@blocks) { $block->run_filters unless $block->is_filtered; } return (@blocks); } sub next_block() { (my ($self), @_) = find_my_self(@_); my $list = $self->_next_list; if (@$list == 0) { $list = [@{$self->block_list}, undef]; $self->_next_list($list); } my $block = shift @$list; if (defined $block and not $block->is_filtered) { $block->run_filters; } return $block; } sub first_block() { (my ($self), @_) = find_my_self(@_); $self->_next_list([]); $self->next_block; } sub filters_delay() { (my ($self), @_) = find_my_self(@_); $self->_filters_delay(defined $_[0] ? shift : 1); } sub no_diag_on_only() { (my ($self), @_) = find_my_self(@_); $self->_no_diag_on_only(defined $_[0] ? shift : 1); } sub delimiters() { (my ($self), @_) = find_my_self(@_); $self->check_late; my ($block_delimiter, $data_delimiter) = @_; $block_delimiter ||= $self->block_delim_default; $data_delimiter ||= $self->data_delim_default; $self->block_delim($block_delimiter); $self->data_delim($data_delimiter); return $self; } sub spec_file() { (my ($self), @_) = find_my_self(@_); $self->check_late; $self->_spec_file(shift); return $self; } sub spec_string() { (my ($self), @_) = find_my_self(@_); $self->check_late; $self->_spec_string(shift); return $self; } sub filters() { (my ($self), @_) = find_my_self(@_); if (ref($_[0]) eq 'HASH') { $self->_filters_map(shift); } else { my $filters = $self->_filters; push @$filters, @_; } return $self; } sub filter_arguments() { $Test::Base::Filter::arguments; } sub have_text_diff { eval { require Text::Diff; 1 } && $Text::Diff::VERSION >= 0.35 && $Algorithm::Diff::VERSION >= 1.15; } sub is($$;$) { (my ($self), @_) = find_my_self(@_); my ($actual, $expected, $name) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; if ($ENV{TEST_SHOW_NO_DIFFS} or not defined $actual or not defined $expected or $actual eq $expected or not($self->have_text_diff) or $expected !~ /\n./s ) { Test::More::is($actual, $expected, $name); } else { $name = '' unless defined $name; ok $actual eq $expected, $name . "\n" . Text::Diff::diff(\$expected, \$actual); } } sub run(&;$) { (my ($self), @_) = find_my_self(@_); my $callback = shift; for my $block (@{$self->block_list}) { $block->run_filters unless $block->is_filtered; &{$callback}($block); } } my $name_error = "Can't determine section names"; sub _section_names { return @_ if @_ == 2; my $block = $self->first_block or croak $name_error; my @names = grep { $_ !~ /^(ONLY|LAST|SKIP)$/; } @{$block->{_section_order}[0] || []}; croak "$name_error. Need two sections in first block" unless @names == 2; return @names; } sub _assert_plan { plan('no_plan') unless $Have_Plan; } sub END { run_compare() unless $Have_Plan or $DIED or not $import_called; } sub run_compare() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); local $Test::Builder::Level = $Test::Builder::Level + 1; for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and exists($block->{$y}); $block->run_filters unless $block->is_filtered; if (ref $block->$x) { is_deeply($block->$x, $block->$y, $block->name ? $block->name : ()); } elsif (ref $block->$y eq 'Regexp') { my $regexp = ref $y ? $y : $block->$y; like($block->$x, $regexp, $block->name ? $block->name : ()); } else { is($block->$x, $block->$y, $block->name ? $block->name : ()); } } } sub run_is() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); local $Test::Builder::Level = $Test::Builder::Level + 1; for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and exists($block->{$y}); $block->run_filters unless $block->is_filtered; is($block->$x, $block->$y, $block->name ? $block->name : () ); } } sub run_is_deeply() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and exists($block->{$y}); $block->run_filters unless $block->is_filtered; is_deeply($block->$x, $block->$y, $block->name ? $block->name : () ); } } sub run_like() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and defined($y); $block->run_filters unless $block->is_filtered; my $regexp = ref $y ? $y : $block->$y; like($block->$x, $regexp, $block->name ? $block->name : () ); } } sub run_unlike() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and defined($y); $block->run_filters unless $block->is_filtered; my $regexp = ref $y ? $y : $block->$y; unlike($block->$x, $regexp, $block->name ? $block->name : () ); } } sub skip_all_unless_require() { (my ($self), @_) = find_my_self(@_); my $module = shift; eval "require $module; 1" or Test::More::plan( skip_all => "$module failed to load" ); } sub is_deep() { (my ($self), @_) = find_my_self(@_); require Test::Deep; Test::Deep::cmp_deeply(@_); } sub run_is_deep() { (my ($self), @_) = find_my_self(@_); $self->_assert_plan; my ($x, $y) = $self->_section_names(@_); for my $block (@{$self->block_list}) { next unless exists($block->{$x}) and exists($block->{$y}); $block->run_filters unless $block->is_filtered; is_deep($block->$x, $block->$y, $block->name ? $block->name : () ); } } sub _pre_eval { my $spec = shift; return $spec unless $spec =~ s/\A\s*<<<(.*?)>>>\s*$//sm; my $eval_code = $1; eval "package main; $eval_code"; croak $@ if $@; return $spec; } sub _block_list_init { my $spec = $self->spec; $spec = $self->_pre_eval($spec); my $cd = $self->block_delim; my @hunks = ($spec =~ /^(\Q${cd}\E.*?(?=^\Q${cd}\E|\z))/msg); my $blocks = $self->_choose_blocks(@hunks); $self->block_list($blocks); # Need to set early for possible filter use my $seq = 1; for my $block (@$blocks) { $block->blocks_object($self); $block->seq_num($seq++); } return $blocks; } sub _choose_blocks { my $blocks = []; for my $hunk (@_) { my $block = $self->_make_block($hunk); if (exists $block->{ONLY}) { diag "I found ONLY: maybe you're debugging?" unless $self->_no_diag_on_only; return [$block]; } next if exists $block->{SKIP}; push @$blocks, $block; if (exists $block->{LAST}) { return $blocks; } } return $blocks; } sub _check_reserved { my $id = shift; croak "'$id' is a reserved name. Use something else.\n" if $reserved_section_names->{$id} or $id =~ /^_/; } sub _make_block { my $hunk = shift; my $cd = $self->block_delim; my $dd = $self->data_delim; my $block = $self->block_class->new; $hunk =~ s/\A\Q${cd}\E[ \t]*(.*)\s+// or die; my $name = $1; my @parts = split /^\Q${dd}\E +\(?(\w+)\)? *(.*)?\n/m, $hunk; my $description = shift @parts; $description ||= ''; unless ($description =~ /\S/) { $description = $name; } $description =~ s/\s*\z//; $block->set_value(description => $description); my $section_map = {}; my $section_order = []; while (@parts) { my ($type, $filters, $value) = splice(@parts, 0, 3); $self->_check_reserved($type); $value = '' unless defined $value; $filters = '' unless defined $filters; if ($filters =~ /:(\s|\z)/) { croak "Extra lines not allowed in '$type' section" if $value =~ /\S/; ($filters, $value) = split /\s*:(?:\s+|\z)/, $filters, 2; $value = '' unless defined $value; $value =~ s/^\s*(.*?)\s*$/$1/; } $section_map->{$type} = { filters => $filters, }; push @$section_order, $type; $block->set_value($type, $value); } $block->set_value(name => $name); $block->set_value(_section_map => $section_map); $block->set_value(_section_order => $section_order); return $block; } sub _spec_init { return $self->_spec_string if $self->_spec_string; local $/; my $spec; if (my $spec_file = $self->_spec_file) { open FILE, $spec_file or die $!; $spec = ; close FILE; } else { $spec = do { package main; no warnings 'once'; ; }; } return $spec; } sub _strict_warnings() { require Filter::Util::Call; my $done = 0; Filter::Util::Call::filter_add( sub { return 0 if $done; my ($data, $end) = ('', ''); while (my $status = Filter::Util::Call::filter_read()) { return $status if $status < 0; if (/^__(?:END|DATA)__\r?$/) { $end = $_; last; } $data .= $_; $_ = ''; } $_ = "use strict;use warnings;$data$end"; $done = 1; } ); } sub tie_output() { my $handle = shift; die "No buffer to tie" unless @_; tie $handle, 'Test::Base::Handle', $_[0]; } sub no_diff { $ENV{TEST_SHOW_NO_DIFFS} = 1; } package Test::Base::Handle; sub TIEHANDLE() { my $class = shift; bless \ $_[0], $class; } sub PRINT { $$self .= $_ for @_; } #=============================================================================== # Test::Base::Block # # This is the default class for accessing a Test::Base block object. #=============================================================================== package Test::Base::Block; our @ISA = qw(Spiffy); our @EXPORT = qw(block_accessor); sub AUTOLOAD { return; } sub block_accessor() { my $accessor = shift; no strict 'refs'; return if defined &$accessor; *$accessor = sub { my $self = shift; if (@_) { Carp::croak "Not allowed to set values for '$accessor'"; } my @list = @{$self->{$accessor} || []}; return wantarray ? (@list) : $list[0]; }; } block_accessor 'name'; block_accessor 'description'; Spiffy::field 'seq_num'; Spiffy::field 'is_filtered'; Spiffy::field 'blocks_object'; Spiffy::field 'original_values' => {}; sub set_value { no strict 'refs'; my $accessor = shift; block_accessor $accessor unless defined &$accessor; $self->{$accessor} = [@_]; } sub run_filters { my $map = $self->_section_map; my $order = $self->_section_order; Carp::croak "Attempt to filter a block twice" if $self->is_filtered; for my $type (@$order) { my $filters = $map->{$type}{filters}; my @value = $self->$type; $self->original_values->{$type} = $value[0]; for my $filter ($self->_get_filters($type, $filters)) { $Test::Base::Filter::arguments = $filter =~ s/=(.*)$// ? $1 : undef; my $function = "main::$filter"; no strict 'refs'; if (defined &$function) { local $_ = (@value == 1 and not defined($value[0])) ? undef : join '', @value; my $old = $_; @value = &$function(@value); if (not(@value) or @value == 1 and defined($value[0]) and $value[0] =~ /\A(\d+|)\z/ ) { if ($value[0] && $_ eq $old) { Test::Base::diag("Filters returning numbers are supposed to do munging \$_: your filter '$function' apparently doesn't."); } @value = ($_); } } else { my $filter_object = $self->blocks_object->filter_class->new; die "Can't find a function or method for '$filter' filter\n" unless $filter_object->can($filter); $filter_object->current_block($self); @value = $filter_object->$filter(@value); } # Set the value after each filter since other filters may be # introspecting. $self->set_value($type, @value); } } $self->is_filtered(1); } sub _get_filters { my $type = shift; my $string = shift || ''; $string =~ s/\s*(.*?)\s*/$1/; my @filters = (); my $map_filters = $self->blocks_object->_filters_map->{$type} || []; $map_filters = [ $map_filters ] unless ref $map_filters; my @append = (); for ( @{$self->blocks_object->_filters}, @$map_filters, split(/\s+/, $string), ) { my $filter = $_; last unless length $filter; if ($filter =~ s/^-//) { @filters = grep { $_ ne $filter } @filters; } elsif ($filter =~ s/^\+//) { push @append, $filter; } else { push @filters, $filter; } } return @filters, @append; } { %$reserved_section_names = map { ($_, 1); } keys(%Test::Base::Block::), qw( new DESTROY ); } __DATA__ =encoding utf8 #line 1376 Data-AMF-0.09/inc/Test/Builder/000755 000765 000024 00000000000 11437121525 017015 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/Test/Builder.pm000644 000765 000024 00000106345 11437121524 017363 0ustar00typesterstaff000000 000000 #line 1 package Test::Builder; use 5.006; use strict; use warnings; our $VERSION = '0.96'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) BEGIN { if( $] < 5.008 ) { require Test::Builder::IO::Scalar; } } # Make Test::Builder thread-safe for ithreads. BEGIN { use Config; # Load threads::shared when threads are turned on. # 5.8.0's threads are so busted we no longer support them. if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) { require threads::shared; # Hack around YET ANOTHER threads::shared bug. It would # occasionally forget the contents of the variable when sharing it. # So we first copy the data, then share, then put our copy back. *share = sub (\[$@%]) { my $type = ref $_[0]; my $data; if( $type eq 'HASH' ) { %$data = %{ $_[0] }; } elsif( $type eq 'ARRAY' ) { @$data = @{ $_[0] }; } elsif( $type eq 'SCALAR' ) { $$data = ${ $_[0] }; } else { die( "Unknown type: " . $type ); } $_[0] = &threads::shared::share( $_[0] ); if( $type eq 'HASH' ) { %{ $_[0] } = %$data; } elsif( $type eq 'ARRAY' ) { @{ $_[0] } = @$data; } elsif( $type eq 'SCALAR' ) { ${ $_[0] } = $$data; } else { die( "Unknown type: " . $type ); } return $_[0]; }; } # 5.8.0's threads::shared is busted when threads are off # and earlier Perls just don't have that module at all. else { *share = sub { return $_[0] }; *lock = sub { 0 }; } } #line 117 our $Test = Test::Builder->new; sub new { my($class) = shift; $Test ||= $class->create; return $Test; } #line 139 sub create { my $class = shift; my $self = bless {}, $class; $self->reset; return $self; } #line 168 sub child { my( $self, $name ) = @_; if( $self->{Child_Name} ) { $self->croak("You already have a child named ($self->{Child_Name}) running"); } my $parent_in_todo = $self->in_todo; # Clear $TODO for the child. my $orig_TODO = $self->find_TODO(undef, 1, undef); my $child = bless {}, ref $self; $child->reset; # Add to our indentation $child->_indent( $self->_indent . ' ' ); $child->{$_} = $self->{$_} foreach qw{Out_FH Todo_FH Fail_FH}; if ($parent_in_todo) { $child->{Fail_FH} = $self->{Todo_FH}; } # This will be reset in finalize. We do this here lest one child failure # cause all children to fail. $child->{Child_Error} = $?; $? = 0; $child->{Parent} = $self; $child->{Parent_TODO} = $orig_TODO; $child->{Name} = $name || "Child of " . $self->name; $self->{Child_Name} = $child->name; return $child; } #line 211 sub subtest { my $self = shift; my($name, $subtests) = @_; if ('CODE' ne ref $subtests) { $self->croak("subtest()'s second argument must be a code ref"); } # Turn the child into the parent so anyone who has stored a copy of # the Test::Builder singleton will get the child. my($error, $child, %parent); { # child() calls reset() which sets $Level to 1, so we localize # $Level first to limit the scope of the reset to the subtest. local $Test::Builder::Level = $Test::Builder::Level + 1; $child = $self->child($name); %parent = %$self; %$self = %$child; my $run_the_subtests = sub { $subtests->(); $self->done_testing unless $self->_plan_handled; 1; }; if( !eval { $run_the_subtests->() } ) { $error = $@; } } # Restore the parent and the copied child. %$child = %$self; %$self = %parent; # Restore the parent's $TODO $self->find_TODO(undef, 1, $child->{Parent_TODO}); # Die *after* we restore the parent. die $error if $error and !eval { $error->isa('Test::Builder::Exception') }; local $Test::Builder::Level = $Test::Builder::Level + 1; return $child->finalize; } #line 281 sub _plan_handled { my $self = shift; return $self->{Have_Plan} || $self->{No_Plan} || $self->{Skip_All}; } #line 306 sub finalize { my $self = shift; return unless $self->parent; if( $self->{Child_Name} ) { $self->croak("Can't call finalize() with child ($self->{Child_Name}) active"); } $self->_ending; # XXX This will only be necessary for TAP envelopes (we think) #$self->_print( $self->is_passing ? "PASS\n" : "FAIL\n" ); local $Test::Builder::Level = $Test::Builder::Level + 1; my $ok = 1; $self->parent->{Child_Name} = undef; if ( $self->{Skip_All} ) { $self->parent->skip($self->{Skip_All}); } elsif ( not @{ $self->{Test_Results} } ) { $self->parent->ok( 0, sprintf q[No tests run for subtest "%s"], $self->name ); } else { $self->parent->ok( $self->is_passing, $self->name ); } $? = $self->{Child_Error}; delete $self->{Parent}; return $self->is_passing; } sub _indent { my $self = shift; if( @_ ) { $self->{Indent} = shift; } return $self->{Indent}; } #line 357 sub parent { shift->{Parent} } #line 369 sub name { shift->{Name} } sub DESTROY { my $self = shift; if ( $self->parent and $$ == $self->{Original_Pid} ) { my $name = $self->name; $self->diag(<<"FAIL"); Child ($name) exited without calling finalize() FAIL $self->parent->{In_Destroy} = 1; $self->parent->ok(0, $name); } } #line 393 our $Level; sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms) my($self) = @_; # We leave this a global because it has to be localized and localizing # hash keys is just asking for pain. Also, it was documented. $Level = 1; $self->{Name} = $0; $self->is_passing(1); $self->{Ending} = 0; $self->{Have_Plan} = 0; $self->{No_Plan} = 0; $self->{Have_Output_Plan} = 0; $self->{Done_Testing} = 0; $self->{Original_Pid} = $$; $self->{Child_Name} = undef; $self->{Indent} ||= ''; share( $self->{Curr_Test} ); $self->{Curr_Test} = 0; $self->{Test_Results} = &share( [] ); $self->{Exported_To} = undef; $self->{Expected_Tests} = 0; $self->{Skip_All} = 0; $self->{Use_Nums} = 1; $self->{No_Header} = 0; $self->{No_Ending} = 0; $self->{Todo} = undef; $self->{Todo_Stack} = []; $self->{Start_Todo} = 0; $self->{Opened_Testhandles} = 0; $self->_dup_stdhandles; return; } #line 472 my %plan_cmds = ( no_plan => \&no_plan, skip_all => \&skip_all, tests => \&_plan_tests, ); sub plan { my( $self, $cmd, $arg ) = @_; return unless $cmd; local $Level = $Level + 1; $self->croak("You tried to plan twice") if $self->{Have_Plan}; if( my $method = $plan_cmds{$cmd} ) { local $Level = $Level + 1; $self->$method($arg); } else { my @args = grep { defined } ( $cmd, $arg ); $self->croak("plan() doesn't understand @args"); } return 1; } sub _plan_tests { my($self, $arg) = @_; if($arg) { local $Level = $Level + 1; return $self->expected_tests($arg); } elsif( !defined $arg ) { $self->croak("Got an undefined number of tests"); } else { $self->croak("You said to run 0 tests"); } return; } #line 527 sub expected_tests { my $self = shift; my($max) = @_; if(@_) { $self->croak("Number of tests must be a positive integer. You gave it '$max'") unless $max =~ /^\+?\d+$/; $self->{Expected_Tests} = $max; $self->{Have_Plan} = 1; $self->_output_plan($max) unless $self->no_header; } return $self->{Expected_Tests}; } #line 551 sub no_plan { my($self, $arg) = @_; $self->carp("no_plan takes no arguments") if $arg; $self->{No_Plan} = 1; $self->{Have_Plan} = 1; return 1; } #line 584 sub _output_plan { my($self, $max, $directive, $reason) = @_; $self->carp("The plan was already output") if $self->{Have_Output_Plan}; my $plan = "1..$max"; $plan .= " # $directive" if defined $directive; $plan .= " $reason" if defined $reason; $self->_print("$plan\n"); $self->{Have_Output_Plan} = 1; return; } #line 636 sub done_testing { my($self, $num_tests) = @_; # If done_testing() specified the number of tests, shut off no_plan. if( defined $num_tests ) { $self->{No_Plan} = 0; } else { $num_tests = $self->current_test; } if( $self->{Done_Testing} ) { my($file, $line) = @{$self->{Done_Testing}}[1,2]; $self->ok(0, "done_testing() was already called at $file line $line"); return; } $self->{Done_Testing} = [caller]; if( $self->expected_tests && $num_tests != $self->expected_tests ) { $self->ok(0, "planned to run @{[ $self->expected_tests ]} ". "but done_testing() expects $num_tests"); } else { $self->{Expected_Tests} = $num_tests; } $self->_output_plan($num_tests) unless $self->{Have_Output_Plan}; $self->{Have_Plan} = 1; # The wrong number of tests were run $self->is_passing(0) if $self->{Expected_Tests} != $self->{Curr_Test}; # No tests were run $self->is_passing(0) if $self->{Curr_Test} == 0; return 1; } #line 687 sub has_plan { my $self = shift; return( $self->{Expected_Tests} ) if $self->{Expected_Tests}; return('no_plan') if $self->{No_Plan}; return(undef); } #line 704 sub skip_all { my( $self, $reason ) = @_; $self->{Skip_All} = $self->parent ? $reason : 1; $self->_output_plan(0, "SKIP", $reason) unless $self->no_header; if ( $self->parent ) { die bless {} => 'Test::Builder::Exception'; } exit(0); } #line 729 sub exported_to { my( $self, $pack ) = @_; if( defined $pack ) { $self->{Exported_To} = $pack; } return $self->{Exported_To}; } #line 759 sub ok { my( $self, $test, $name ) = @_; if ( $self->{Child_Name} and not $self->{In_Destroy} ) { $name = 'unnamed test' unless defined $name; $self->is_passing(0); $self->croak("Cannot run test ($name) with active children"); } # $test might contain an object which we don't want to accidentally # store, so we turn it into a boolean. $test = $test ? 1 : 0; lock $self->{Curr_Test}; $self->{Curr_Test}++; # In case $name is a string overloaded object, force it to stringify. $self->_unoverload_str( \$name ); $self->diag(<<"ERR") if defined $name and $name =~ /^[\d\s]+$/; You named your test '$name'. You shouldn't use numbers for your test names. Very confusing. ERR # Capture the value of $TODO for the rest of this ok() call # so it can more easily be found by other routines. my $todo = $self->todo(); my $in_todo = $self->in_todo; local $self->{Todo} = $todo if $in_todo; $self->_unoverload_str( \$todo ); my $out; my $result = &share( {} ); unless($test) { $out .= "not "; @$result{ 'ok', 'actual_ok' } = ( ( $self->in_todo ? 1 : 0 ), 0 ); } else { @$result{ 'ok', 'actual_ok' } = ( 1, $test ); } $out .= "ok"; $out .= " $self->{Curr_Test}" if $self->use_numbers; if( defined $name ) { $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness. $out .= " - $name"; $result->{name} = $name; } else { $result->{name} = ''; } if( $self->in_todo ) { $out .= " # TODO $todo"; $result->{reason} = $todo; $result->{type} = 'todo'; } else { $result->{reason} = ''; $result->{type} = ''; } $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = $result; $out .= "\n"; $self->_print($out); unless($test) { my $msg = $self->in_todo ? "Failed (TODO)" : "Failed"; $self->_print_to_fh( $self->_diag_fh, "\n" ) if $ENV{HARNESS_ACTIVE}; my( undef, $file, $line ) = $self->caller; if( defined $name ) { $self->diag(qq[ $msg test '$name'\n]); $self->diag(qq[ at $file line $line.\n]); } else { $self->diag(qq[ $msg test at $file line $line.\n]); } } $self->is_passing(0) unless $test || $self->in_todo; # Check that we haven't violated the plan $self->_check_is_passing_plan(); return $test ? 1 : 0; } # Check that we haven't yet violated the plan and set # is_passing() accordingly sub _check_is_passing_plan { my $self = shift; my $plan = $self->has_plan; return unless defined $plan; # no plan yet defined return unless $plan !~ /\D/; # no numeric plan $self->is_passing(0) if $plan < $self->{Curr_Test}; } sub _unoverload { my $self = shift; my $type = shift; $self->_try(sub { require overload; }, die_on_fail => 1); foreach my $thing (@_) { if( $self->_is_object($$thing) ) { if( my $string_meth = overload::Method( $$thing, $type ) ) { $$thing = $$thing->$string_meth(); } } } return; } sub _is_object { my( $self, $thing ) = @_; return $self->_try( sub { ref $thing && $thing->isa('UNIVERSAL') } ) ? 1 : 0; } sub _unoverload_str { my $self = shift; return $self->_unoverload( q[""], @_ ); } sub _unoverload_num { my $self = shift; $self->_unoverload( '0+', @_ ); for my $val (@_) { next unless $self->_is_dualvar($$val); $$val = $$val + 0; } return; } # This is a hack to detect a dualvar such as $! sub _is_dualvar { my( $self, $val ) = @_; # Objects are not dualvars. return 0 if ref $val; no warnings 'numeric'; my $numval = $val + 0; return $numval != 0 and $numval ne $val ? 1 : 0; } #line 933 sub is_eq { my( $self, $got, $expect, $name ) = @_; local $Level = $Level + 1; if( !defined $got || !defined $expect ) { # undef only matches undef and nothing else my $test = !defined $got && !defined $expect; $self->ok( $test, $name ); $self->_is_diag( $got, 'eq', $expect ) unless $test; return $test; } return $self->cmp_ok( $got, 'eq', $expect, $name ); } sub is_num { my( $self, $got, $expect, $name ) = @_; local $Level = $Level + 1; if( !defined $got || !defined $expect ) { # undef only matches undef and nothing else my $test = !defined $got && !defined $expect; $self->ok( $test, $name ); $self->_is_diag( $got, '==', $expect ) unless $test; return $test; } return $self->cmp_ok( $got, '==', $expect, $name ); } sub _diag_fmt { my( $self, $type, $val ) = @_; if( defined $$val ) { if( $type eq 'eq' or $type eq 'ne' ) { # quote and force string context $$val = "'$$val'"; } else { # force numeric context $self->_unoverload_num($val); } } else { $$val = 'undef'; } return; } sub _is_diag { my( $self, $got, $type, $expect ) = @_; $self->_diag_fmt( $type, $_ ) for \$got, \$expect; local $Level = $Level + 1; return $self->diag(<<"DIAGNOSTIC"); got: $got expected: $expect DIAGNOSTIC } sub _isnt_diag { my( $self, $got, $type ) = @_; $self->_diag_fmt( $type, \$got ); local $Level = $Level + 1; return $self->diag(<<"DIAGNOSTIC"); got: $got expected: anything else DIAGNOSTIC } #line 1026 sub isnt_eq { my( $self, $got, $dont_expect, $name ) = @_; local $Level = $Level + 1; if( !defined $got || !defined $dont_expect ) { # undef only matches undef and nothing else my $test = defined $got || defined $dont_expect; $self->ok( $test, $name ); $self->_isnt_diag( $got, 'ne' ) unless $test; return $test; } return $self->cmp_ok( $got, 'ne', $dont_expect, $name ); } sub isnt_num { my( $self, $got, $dont_expect, $name ) = @_; local $Level = $Level + 1; if( !defined $got || !defined $dont_expect ) { # undef only matches undef and nothing else my $test = defined $got || defined $dont_expect; $self->ok( $test, $name ); $self->_isnt_diag( $got, '!=' ) unless $test; return $test; } return $self->cmp_ok( $got, '!=', $dont_expect, $name ); } #line 1075 sub like { my( $self, $this, $regex, $name ) = @_; local $Level = $Level + 1; return $self->_regex_ok( $this, $regex, '=~', $name ); } sub unlike { my( $self, $this, $regex, $name ) = @_; local $Level = $Level + 1; return $self->_regex_ok( $this, $regex, '!~', $name ); } #line 1099 my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" ); sub cmp_ok { my( $self, $got, $type, $expect, $name ) = @_; my $test; my $error; { ## no critic (BuiltinFunctions::ProhibitStringyEval) local( $@, $!, $SIG{__DIE__} ); # isolate eval my($pack, $file, $line) = $self->caller(); # This is so that warnings come out at the caller's level $test = eval qq[ #line $line "(eval in cmp_ok) $file" \$got $type \$expect; ]; $error = $@; } local $Level = $Level + 1; my $ok = $self->ok( $test, $name ); # Treat overloaded objects as numbers if we're asked to do a # numeric comparison. my $unoverload = $numeric_cmps{$type} ? '_unoverload_num' : '_unoverload_str'; $self->diag(<<"END") if $error; An error occurred while using $type: ------------------------------------ $error ------------------------------------ END unless($ok) { $self->$unoverload( \$got, \$expect ); if( $type =~ /^(eq|==)$/ ) { $self->_is_diag( $got, $type, $expect ); } elsif( $type =~ /^(ne|!=)$/ ) { $self->_isnt_diag( $got, $type ); } else { $self->_cmp_diag( $got, $type, $expect ); } } return $ok; } sub _cmp_diag { my( $self, $got, $type, $expect ) = @_; $got = defined $got ? "'$got'" : 'undef'; $expect = defined $expect ? "'$expect'" : 'undef'; local $Level = $Level + 1; return $self->diag(<<"DIAGNOSTIC"); $got $type $expect DIAGNOSTIC } sub _caller_context { my $self = shift; my( $pack, $file, $line ) = $self->caller(1); my $code = ''; $code .= "#line $line $file\n" if defined $file and defined $line; return $code; } #line 1199 sub BAIL_OUT { my( $self, $reason ) = @_; $self->{Bailed_Out} = 1; $self->_print("Bail out! $reason"); exit 255; } #line 1212 { no warnings 'once'; *BAILOUT = \&BAIL_OUT; } #line 1226 sub skip { my( $self, $why ) = @_; $why ||= ''; $self->_unoverload_str( \$why ); lock( $self->{Curr_Test} ); $self->{Curr_Test}++; $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share( { 'ok' => 1, actual_ok => 1, name => '', type => 'skip', reason => $why, } ); my $out = "ok"; $out .= " $self->{Curr_Test}" if $self->use_numbers; $out .= " # skip"; $out .= " $why" if length $why; $out .= "\n"; $self->_print($out); return 1; } #line 1267 sub todo_skip { my( $self, $why ) = @_; $why ||= ''; lock( $self->{Curr_Test} ); $self->{Curr_Test}++; $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share( { 'ok' => 1, actual_ok => 0, name => '', type => 'todo_skip', reason => $why, } ); my $out = "not ok"; $out .= " $self->{Curr_Test}" if $self->use_numbers; $out .= " # TODO & SKIP $why\n"; $self->_print($out); return 1; } #line 1347 sub maybe_regex { my( $self, $regex ) = @_; my $usable_regex = undef; return $usable_regex unless defined $regex; my( $re, $opts ); # Check for qr/foo/ if( _is_qr($regex) ) { $usable_regex = $regex; } # Check for '/foo/' or 'm,foo,' elsif(( $re, $opts ) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or ( undef, $re, $opts ) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx ) { $usable_regex = length $opts ? "(?$opts)$re" : $re; } return $usable_regex; } sub _is_qr { my $regex = shift; # is_regexp() checks for regexes in a robust manner, say if they're # blessed. return re::is_regexp($regex) if defined &re::is_regexp; return ref $regex eq 'Regexp'; } sub _regex_ok { my( $self, $this, $regex, $cmp, $name ) = @_; my $ok = 0; my $usable_regex = $self->maybe_regex($regex); unless( defined $usable_regex ) { local $Level = $Level + 1; $ok = $self->ok( 0, $name ); $self->diag(" '$regex' doesn't look much like a regex to me."); return $ok; } { ## no critic (BuiltinFunctions::ProhibitStringyEval) my $test; my $context = $self->_caller_context; local( $@, $!, $SIG{__DIE__} ); # isolate eval $test = eval $context . q{$test = $this =~ /$usable_regex/ ? 1 : 0}; $test = !$test if $cmp eq '!~'; local $Level = $Level + 1; $ok = $self->ok( $test, $name ); } unless($ok) { $this = defined $this ? "'$this'" : 'undef'; my $match = $cmp eq '=~' ? "doesn't match" : "matches"; local $Level = $Level + 1; $self->diag( sprintf <<'DIAGNOSTIC', $this, $match, $regex ); %s %13s '%s' DIAGNOSTIC } return $ok; } # I'm not ready to publish this. It doesn't deal with array return # values from the code or context. #line 1443 sub _try { my( $self, $code, %opts ) = @_; my $error; my $return; { local $!; # eval can mess up $! local $@; # don't set $@ in the test local $SIG{__DIE__}; # don't trip an outside DIE handler. $return = eval { $code->() }; $error = $@; } die $error if $error and $opts{die_on_fail}; return wantarray ? ( $return, $error ) : $return; } #line 1472 sub is_fh { my $self = shift; my $maybe_fh = shift; return 0 unless defined $maybe_fh; return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob return eval { $maybe_fh->isa("IO::Handle") } || eval { tied($maybe_fh)->can('TIEHANDLE') }; } #line 1515 sub level { my( $self, $level ) = @_; if( defined $level ) { $Level = $level; } return $Level; } #line 1547 sub use_numbers { my( $self, $use_nums ) = @_; if( defined $use_nums ) { $self->{Use_Nums} = $use_nums; } return $self->{Use_Nums}; } #line 1580 foreach my $attribute (qw(No_Header No_Ending No_Diag)) { my $method = lc $attribute; my $code = sub { my( $self, $no ) = @_; if( defined $no ) { $self->{$attribute} = $no; } return $self->{$attribute}; }; no strict 'refs'; ## no critic *{ __PACKAGE__ . '::' . $method } = $code; } #line 1633 sub diag { my $self = shift; $self->_print_comment( $self->_diag_fh, @_ ); } #line 1648 sub note { my $self = shift; $self->_print_comment( $self->output, @_ ); } sub _diag_fh { my $self = shift; local $Level = $Level + 1; return $self->in_todo ? $self->todo_output : $self->failure_output; } sub _print_comment { my( $self, $fh, @msgs ) = @_; return if $self->no_diag; return unless @msgs; # Prevent printing headers when compiling (i.e. -c) return if $^C; # Smash args together like print does. # Convert undef to 'undef' so its readable. my $msg = join '', map { defined($_) ? $_ : 'undef' } @msgs; # Escape the beginning, _print will take care of the rest. $msg =~ s/^/# /; local $Level = $Level + 1; $self->_print_to_fh( $fh, $msg ); return 0; } #line 1698 sub explain { my $self = shift; return map { ref $_ ? do { $self->_try(sub { require Data::Dumper }, die_on_fail => 1); my $dumper = Data::Dumper->new( [$_] ); $dumper->Indent(1)->Terse(1); $dumper->Sortkeys(1) if $dumper->can("Sortkeys"); $dumper->Dump; } : $_ } @_; } #line 1727 sub _print { my $self = shift; return $self->_print_to_fh( $self->output, @_ ); } sub _print_to_fh { my( $self, $fh, @msgs ) = @_; # Prevent printing headers when only compiling. Mostly for when # tests are deparsed with B::Deparse return if $^C; my $msg = join '', @msgs; my $indent = $self->_indent; local( $\, $", $, ) = ( undef, ' ', '' ); # Escape each line after the first with a # so we don't # confuse Test::Harness. $msg =~ s{\n(?!\z)}{\n$indent# }sg; # Stick a newline on the end if it needs it. $msg .= "\n" unless $msg =~ /\n\z/; return print $fh $indent, $msg; } #line 1787 sub output { my( $self, $fh ) = @_; if( defined $fh ) { $self->{Out_FH} = $self->_new_fh($fh); } return $self->{Out_FH}; } sub failure_output { my( $self, $fh ) = @_; if( defined $fh ) { $self->{Fail_FH} = $self->_new_fh($fh); } return $self->{Fail_FH}; } sub todo_output { my( $self, $fh ) = @_; if( defined $fh ) { $self->{Todo_FH} = $self->_new_fh($fh); } return $self->{Todo_FH}; } sub _new_fh { my $self = shift; my($file_or_fh) = shift; my $fh; if( $self->is_fh($file_or_fh) ) { $fh = $file_or_fh; } elsif( ref $file_or_fh eq 'SCALAR' ) { # Scalar refs as filehandles was added in 5.8. if( $] >= 5.008 ) { open $fh, ">>", $file_or_fh or $self->croak("Can't open scalar ref $file_or_fh: $!"); } # Emulate scalar ref filehandles with a tie. else { $fh = Test::Builder::IO::Scalar->new($file_or_fh) or $self->croak("Can't tie scalar ref $file_or_fh"); } } else { open $fh, ">", $file_or_fh or $self->croak("Can't open test output log $file_or_fh: $!"); _autoflush($fh); } return $fh; } sub _autoflush { my($fh) = shift; my $old_fh = select $fh; $| = 1; select $old_fh; return; } my( $Testout, $Testerr ); sub _dup_stdhandles { my $self = shift; $self->_open_testhandles; # Set everything to unbuffered else plain prints to STDOUT will # come out in the wrong order from our own prints. _autoflush($Testout); _autoflush( \*STDOUT ); _autoflush($Testerr); _autoflush( \*STDERR ); $self->reset_outputs; return; } sub _open_testhandles { my $self = shift; return if $self->{Opened_Testhandles}; # We dup STDOUT and STDERR so people can change them in their # test suites while still getting normal test output. open( $Testout, ">&STDOUT" ) or die "Can't dup STDOUT: $!"; open( $Testerr, ">&STDERR" ) or die "Can't dup STDERR: $!"; # $self->_copy_io_layers( \*STDOUT, $Testout ); # $self->_copy_io_layers( \*STDERR, $Testerr ); $self->{Opened_Testhandles} = 1; return; } sub _copy_io_layers { my( $self, $src, $dst ) = @_; $self->_try( sub { require PerlIO; my @src_layers = PerlIO::get_layers($src); binmode $dst, join " ", map ":$_", @src_layers if @src_layers; } ); return; } #line 1912 sub reset_outputs { my $self = shift; $self->output ($Testout); $self->failure_output($Testerr); $self->todo_output ($Testout); return; } #line 1938 sub _message_at_caller { my $self = shift; local $Level = $Level + 1; my( $pack, $file, $line ) = $self->caller; return join( "", @_ ) . " at $file line $line.\n"; } sub carp { my $self = shift; return warn $self->_message_at_caller(@_); } sub croak { my $self = shift; return die $self->_message_at_caller(@_); } #line 1978 sub current_test { my( $self, $num ) = @_; lock( $self->{Curr_Test} ); if( defined $num ) { $self->{Curr_Test} = $num; # If the test counter is being pushed forward fill in the details. my $test_results = $self->{Test_Results}; if( $num > @$test_results ) { my $start = @$test_results ? @$test_results : 0; for( $start .. $num - 1 ) { $test_results->[$_] = &share( { 'ok' => 1, actual_ok => undef, reason => 'incrementing test number', type => 'unknown', name => undef } ); } } # If backward, wipe history. Its their funeral. elsif( $num < @$test_results ) { $#{$test_results} = $num - 1; } } return $self->{Curr_Test}; } #line 2026 sub is_passing { my $self = shift; if( @_ ) { $self->{Is_Passing} = shift; } return $self->{Is_Passing}; } #line 2048 sub summary { my($self) = shift; return map { $_->{'ok'} } @{ $self->{Test_Results} }; } #line 2103 sub details { my $self = shift; return @{ $self->{Test_Results} }; } #line 2132 sub todo { my( $self, $pack ) = @_; return $self->{Todo} if defined $self->{Todo}; local $Level = $Level + 1; my $todo = $self->find_TODO($pack); return $todo if defined $todo; return ''; } #line 2159 sub find_TODO { my( $self, $pack, $set, $new_value ) = @_; $pack = $pack || $self->caller(1) || $self->exported_to; return unless $pack; no strict 'refs'; ## no critic my $old_value = ${ $pack . '::TODO' }; $set and ${ $pack . '::TODO' } = $new_value; return $old_value; } #line 2179 sub in_todo { my $self = shift; local $Level = $Level + 1; return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0; } #line 2229 sub todo_start { my $self = shift; my $message = @_ ? shift : ''; $self->{Start_Todo}++; if( $self->in_todo ) { push @{ $self->{Todo_Stack} } => $self->todo; } $self->{Todo} = $message; return; } #line 2251 sub todo_end { my $self = shift; if( !$self->{Start_Todo} ) { $self->croak('todo_end() called without todo_start()'); } $self->{Start_Todo}--; if( $self->{Start_Todo} && @{ $self->{Todo_Stack} } ) { $self->{Todo} = pop @{ $self->{Todo_Stack} }; } else { delete $self->{Todo}; } return; } #line 2284 sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms) my( $self, $height ) = @_; $height ||= 0; my $level = $self->level + $height + 1; my @caller; do { @caller = CORE::caller( $level ); $level--; } until @caller; return wantarray ? @caller : $caller[0]; } #line 2301 #line 2315 #'# sub _sanity_check { my $self = shift; $self->_whoa( $self->{Curr_Test} < 0, 'Says here you ran a negative number of tests!' ); $self->_whoa( $self->{Curr_Test} != @{ $self->{Test_Results} }, 'Somehow you got a different number of results than tests ran!' ); return; } #line 2336 sub _whoa { my( $self, $check, $desc ) = @_; if($check) { local $Level = $Level + 1; $self->croak(<<"WHOA"); WHOA! $desc This should never happen! Please contact the author immediately! WHOA } return; } #line 2360 sub _my_exit { $? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars) return 1; } #line 2372 sub _ending { my $self = shift; return if $self->no_ending; return if $self->{Ending}++; my $real_exit_code = $?; # Don't bother with an ending if this is a forked copy. Only the parent # should do the ending. if( $self->{Original_Pid} != $$ ) { return; } # Ran tests but never declared a plan or hit done_testing if( !$self->{Have_Plan} and $self->{Curr_Test} ) { $self->is_passing(0); $self->diag("Tests were run but no plan was declared and done_testing() was not seen."); } # Exit if plan() was never called. This is so "require Test::Simple" # doesn't puke. if( !$self->{Have_Plan} ) { return; } # Don't do an ending if we bailed out. if( $self->{Bailed_Out} ) { $self->is_passing(0); return; } # Figure out if we passed or failed and print helpful messages. my $test_results = $self->{Test_Results}; if(@$test_results) { # The plan? We have no plan. if( $self->{No_Plan} ) { $self->_output_plan($self->{Curr_Test}) unless $self->no_header; $self->{Expected_Tests} = $self->{Curr_Test}; } # Auto-extended arrays and elements which aren't explicitly # filled in with a shared reference will puke under 5.8.0 # ithreads. So we have to fill them in by hand. :( my $empty_result = &share( {} ); for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) { $test_results->[$idx] = $empty_result unless defined $test_results->[$idx]; } my $num_failed = grep !$_->{'ok'}, @{$test_results}[ 0 .. $self->{Curr_Test} - 1 ]; my $num_extra = $self->{Curr_Test} - $self->{Expected_Tests}; if( $num_extra != 0 ) { my $s = $self->{Expected_Tests} == 1 ? '' : 's'; $self->diag(<<"FAIL"); Looks like you planned $self->{Expected_Tests} test$s but ran $self->{Curr_Test}. FAIL $self->is_passing(0); } if($num_failed) { my $num_tests = $self->{Curr_Test}; my $s = $num_failed == 1 ? '' : 's'; my $qualifier = $num_extra == 0 ? '' : ' run'; $self->diag(<<"FAIL"); Looks like you failed $num_failed test$s of $num_tests$qualifier. FAIL $self->is_passing(0); } if($real_exit_code) { $self->diag(<<"FAIL"); Looks like your test exited with $real_exit_code just after $self->{Curr_Test}. FAIL $self->is_passing(0); _my_exit($real_exit_code) && return; } my $exit_code; if($num_failed) { $exit_code = $num_failed <= 254 ? $num_failed : 254; } elsif( $num_extra != 0 ) { $exit_code = 255; } else { $exit_code = 0; } _my_exit($exit_code) && return; } elsif( $self->{Skip_All} ) { _my_exit(0) && return; } elsif($real_exit_code) { $self->diag(<<"FAIL"); Looks like your test exited with $real_exit_code before it could output anything. FAIL $self->is_passing(0); _my_exit($real_exit_code) && return; } else { $self->diag("No tests run!\n"); $self->is_passing(0); _my_exit(255) && return; } $self->is_passing(0); $self->_whoa( 1, "We fell off the end of _ending()" ); } END { $Test->_ending if defined $Test; } #line 2560 1; Data-AMF-0.09/inc/Test/More.pm000644 000765 000024 00000041404 11437121524 016671 0ustar00typesterstaff000000 000000 #line 1 package Test::More; use 5.006; use strict; use warnings; #---- perlcritic exemptions. ----# # We use a lot of subroutine prototypes ## no critic (Subroutines::ProhibitSubroutinePrototypes) # Can't use Carp because it might cause use_ok() to accidentally succeed # even though the module being used forgot to use Carp. Yes, this # actually happened. sub _carp { my( $file, $line ) = ( caller(1) )[ 1, 2 ]; return warn @_, " at $file line $line\n"; } our $VERSION = '0.96'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); our @EXPORT = qw(ok use_ok require_ok is isnt like unlike is_deeply cmp_ok skip todo todo_skip pass fail eq_array eq_hash eq_set $TODO plan done_testing can_ok isa_ok new_ok diag note explain subtest BAIL_OUT ); #line 164 sub plan { my $tb = Test::More->builder; return $tb->plan(@_); } # This implements "use Test::More 'no_diag'" but the behavior is # deprecated. sub import_extra { my $class = shift; my $list = shift; my @other = (); my $idx = 0; while( $idx <= $#{$list} ) { my $item = $list->[$idx]; if( defined $item and $item eq 'no_diag' ) { $class->builder->no_diag(1); } else { push @other, $item; } $idx++; } @$list = @other; return; } #line 217 sub done_testing { my $tb = Test::More->builder; $tb->done_testing(@_); } #line 289 sub ok ($;$) { my( $test, $name ) = @_; my $tb = Test::More->builder; return $tb->ok( $test, $name ); } #line 367 sub is ($$;$) { my $tb = Test::More->builder; return $tb->is_eq(@_); } sub isnt ($$;$) { my $tb = Test::More->builder; return $tb->isnt_eq(@_); } *isn't = \&isnt; #line 411 sub like ($$;$) { my $tb = Test::More->builder; return $tb->like(@_); } #line 426 sub unlike ($$;$) { my $tb = Test::More->builder; return $tb->unlike(@_); } #line 471 sub cmp_ok($$$;$) { my $tb = Test::More->builder; return $tb->cmp_ok(@_); } #line 506 sub can_ok ($@) { my( $proto, @methods ) = @_; my $class = ref $proto || $proto; my $tb = Test::More->builder; unless($class) { my $ok = $tb->ok( 0, "->can(...)" ); $tb->diag(' can_ok() called with empty class or reference'); return $ok; } unless(@methods) { my $ok = $tb->ok( 0, "$class->can(...)" ); $tb->diag(' can_ok() called with no methods'); return $ok; } my @nok = (); foreach my $method (@methods) { $tb->_try( sub { $proto->can($method) } ) or push @nok, $method; } my $name = (@methods == 1) ? "$class->can('$methods[0]')" : "$class->can(...)" ; my $ok = $tb->ok( !@nok, $name ); $tb->diag( map " $class->can('$_') failed\n", @nok ); return $ok; } #line 572 sub isa_ok ($$;$) { my( $object, $class, $obj_name ) = @_; my $tb = Test::More->builder; my $diag; if( !defined $object ) { $obj_name = 'The thing' unless defined $obj_name; $diag = "$obj_name isn't defined"; } else { my $whatami = ref $object ? 'object' : 'class'; # We can't use UNIVERSAL::isa because we want to honor isa() overrides my( $rslt, $error ) = $tb->_try( sub { $object->isa($class) } ); if($error) { if( $error =~ /^Can't call method "isa" on unblessed reference/ ) { # Its an unblessed reference $obj_name = 'The reference' unless defined $obj_name; if( !UNIVERSAL::isa( $object, $class ) ) { my $ref = ref $object; $diag = "$obj_name isn't a '$class' it's a '$ref'"; } } elsif( $error =~ /Can't call method "isa" without a package/ ) { # It's something that can't even be a class $obj_name = 'The thing' unless defined $obj_name; $diag = "$obj_name isn't a class or reference"; } else { die <isa on your $whatami and got some weird error. Here's the error. $error WHOA } } else { $obj_name = "The $whatami" unless defined $obj_name; if( !$rslt ) { my $ref = ref $object; $diag = "$obj_name isn't a '$class' it's a '$ref'"; } } } my $name = "$obj_name isa $class"; my $ok; if($diag) { $ok = $tb->ok( 0, $name ); $tb->diag(" $diag\n"); } else { $ok = $tb->ok( 1, $name ); } return $ok; } #line 651 sub new_ok { my $tb = Test::More->builder; $tb->croak("new_ok() must be given at least a class") unless @_; my( $class, $args, $object_name ) = @_; $args ||= []; $object_name = "The object" unless defined $object_name; my $obj; my( $success, $error ) = $tb->_try( sub { $obj = $class->new(@$args); 1 } ); if($success) { local $Test::Builder::Level = $Test::Builder::Level + 1; isa_ok $obj, $class, $object_name; } else { $tb->ok( 0, "new() died" ); $tb->diag(" Error was: $error"); } return $obj; } #line 736 sub subtest($&) { my ($name, $subtests) = @_; my $tb = Test::More->builder; return $tb->subtest(@_); } #line 760 sub pass (;$) { my $tb = Test::More->builder; return $tb->ok( 1, @_ ); } sub fail (;$) { my $tb = Test::More->builder; return $tb->ok( 0, @_ ); } #line 823 sub use_ok ($;@) { my( $module, @imports ) = @_; @imports = () unless @imports; my $tb = Test::More->builder; my( $pack, $filename, $line ) = caller; my $code; if( @imports == 1 and $imports[0] =~ /^\d+(?:\.\d+)?$/ ) { # probably a version check. Perl needs to see the bare number # for it to work with non-Exporter based modules. $code = <ok( $eval_result, "use $module;" ); unless($ok) { chomp $eval_error; $@ =~ s{^BEGIN failed--compilation aborted at .*$} {BEGIN failed--compilation aborted at $filename line $line.}m; $tb->diag(<builder; my $pack = caller; # Try to determine if we've been given a module name or file. # Module names must be barewords, files not. $module = qq['$module'] unless _is_module_name($module); my $code = <ok( $eval_result, "require $module;" ); unless($ok) { chomp $eval_error; $tb->diag(<builder; unless( @_ == 2 or @_ == 3 ) { my $msg = <<'WARNING'; is_deeply() takes two or three args, you gave %d. This usually means you passed an array or hash instead of a reference to it WARNING chop $msg; # clip off newline so carp() will put in line/file _carp sprintf $msg, scalar @_; return $tb->ok(0); } my( $got, $expected, $name ) = @_; $tb->_unoverload_str( \$expected, \$got ); my $ok; if( !ref $got and !ref $expected ) { # neither is a reference $ok = $tb->is_eq( $got, $expected, $name ); } elsif( !ref $got xor !ref $expected ) { # one's a reference, one isn't $ok = $tb->ok( 0, $name ); $tb->diag( _format_stack({ vals => [ $got, $expected ] }) ); } else { # both references local @Data_Stack = (); if( _deep_check( $got, $expected ) ) { $ok = $tb->ok( 1, $name ); } else { $ok = $tb->ok( 0, $name ); $tb->diag( _format_stack(@Data_Stack) ); } } return $ok; } sub _format_stack { my(@Stack) = @_; my $var = '$FOO'; my $did_arrow = 0; foreach my $entry (@Stack) { my $type = $entry->{type} || ''; my $idx = $entry->{'idx'}; if( $type eq 'HASH' ) { $var .= "->" unless $did_arrow++; $var .= "{$idx}"; } elsif( $type eq 'ARRAY' ) { $var .= "->" unless $did_arrow++; $var .= "[$idx]"; } elsif( $type eq 'REF' ) { $var = "\${$var}"; } } my @vals = @{ $Stack[-1]{vals} }[ 0, 1 ]; my @vars = (); ( $vars[0] = $var ) =~ s/\$FOO/ \$got/; ( $vars[1] = $var ) =~ s/\$FOO/\$expected/; my $out = "Structures begin differing at:\n"; foreach my $idx ( 0 .. $#vals ) { my $val = $vals[$idx]; $vals[$idx] = !defined $val ? 'undef' : _dne($val) ? "Does not exist" : ref $val ? "$val" : "'$val'"; } $out .= "$vars[0] = $vals[0]\n"; $out .= "$vars[1] = $vals[1]\n"; $out =~ s/^/ /msg; return $out; } sub _type { my $thing = shift; return '' if !ref $thing; for my $type (qw(Regexp ARRAY HASH REF SCALAR GLOB CODE)) { return $type if UNIVERSAL::isa( $thing, $type ); } return ''; } #line 1129 sub diag { return Test::More->builder->diag(@_); } sub note { return Test::More->builder->note(@_); } #line 1155 sub explain { return Test::More->builder->explain(@_); } #line 1221 ## no critic (Subroutines::RequireFinalReturn) sub skip { my( $why, $how_many ) = @_; my $tb = Test::More->builder; unless( defined $how_many ) { # $how_many can only be avoided when no_plan is in use. _carp "skip() needs to know \$how_many tests are in the block" unless $tb->has_plan eq 'no_plan'; $how_many = 1; } if( defined $how_many and $how_many =~ /\D/ ) { _carp "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?"; $how_many = 1; } for( 1 .. $how_many ) { $tb->skip($why); } no warnings 'exiting'; last SKIP; } #line 1305 sub todo_skip { my( $why, $how_many ) = @_; my $tb = Test::More->builder; unless( defined $how_many ) { # $how_many can only be avoided when no_plan is in use. _carp "todo_skip() needs to know \$how_many tests are in the block" unless $tb->has_plan eq 'no_plan'; $how_many = 1; } for( 1 .. $how_many ) { $tb->todo_skip($why); } no warnings 'exiting'; last TODO; } #line 1360 sub BAIL_OUT { my $reason = shift; my $tb = Test::More->builder; $tb->BAIL_OUT($reason); } #line 1399 #'# sub eq_array { local @Data_Stack = (); _deep_check(@_); } sub _eq_array { my( $a1, $a2 ) = @_; if( grep _type($_) ne 'ARRAY', $a1, $a2 ) { warn "eq_array passed a non-array ref"; return 0; } return 1 if $a1 eq $a2; my $ok = 1; my $max = $#$a1 > $#$a2 ? $#$a1 : $#$a2; for( 0 .. $max ) { my $e1 = $_ > $#$a1 ? $DNE : $a1->[$_]; my $e2 = $_ > $#$a2 ? $DNE : $a2->[$_]; next if _equal_nonrefs($e1, $e2); push @Data_Stack, { type => 'ARRAY', idx => $_, vals => [ $e1, $e2 ] }; $ok = _deep_check( $e1, $e2 ); pop @Data_Stack if $ok; last unless $ok; } return $ok; } sub _equal_nonrefs { my( $e1, $e2 ) = @_; return if ref $e1 or ref $e2; if ( defined $e1 ) { return 1 if defined $e2 and $e1 eq $e2; } else { return 1 if !defined $e2; } return; } sub _deep_check { my( $e1, $e2 ) = @_; my $tb = Test::More->builder; my $ok = 0; # Effectively turn %Refs_Seen into a stack. This avoids picking up # the same referenced used twice (such as [\$a, \$a]) to be considered # circular. local %Refs_Seen = %Refs_Seen; { $tb->_unoverload_str( \$e1, \$e2 ); # Either they're both references or both not. my $same_ref = !( !ref $e1 xor !ref $e2 ); my $not_ref = ( !ref $e1 and !ref $e2 ); if( defined $e1 xor defined $e2 ) { $ok = 0; } elsif( !defined $e1 and !defined $e2 ) { # Shortcut if they're both undefined. $ok = 1; } elsif( _dne($e1) xor _dne($e2) ) { $ok = 0; } elsif( $same_ref and( $e1 eq $e2 ) ) { $ok = 1; } elsif($not_ref) { push @Data_Stack, { type => '', vals => [ $e1, $e2 ] }; $ok = 0; } else { if( $Refs_Seen{$e1} ) { return $Refs_Seen{$e1} eq $e2; } else { $Refs_Seen{$e1} = "$e2"; } my $type = _type($e1); $type = 'DIFFERENT' unless _type($e2) eq $type; if( $type eq 'DIFFERENT' ) { push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; $ok = 0; } elsif( $type eq 'ARRAY' ) { $ok = _eq_array( $e1, $e2 ); } elsif( $type eq 'HASH' ) { $ok = _eq_hash( $e1, $e2 ); } elsif( $type eq 'REF' ) { push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; $ok = _deep_check( $$e1, $$e2 ); pop @Data_Stack if $ok; } elsif( $type eq 'SCALAR' ) { push @Data_Stack, { type => 'REF', vals => [ $e1, $e2 ] }; $ok = _deep_check( $$e1, $$e2 ); pop @Data_Stack if $ok; } elsif($type) { push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; $ok = 0; } else { _whoa( 1, "No type in _deep_check" ); } } } return $ok; } sub _whoa { my( $check, $desc ) = @_; if($check) { die <<"WHOA"; WHOA! $desc This should never happen! Please contact the author immediately! WHOA } } #line 1546 sub eq_hash { local @Data_Stack = (); return _deep_check(@_); } sub _eq_hash { my( $a1, $a2 ) = @_; if( grep _type($_) ne 'HASH', $a1, $a2 ) { warn "eq_hash passed a non-hash ref"; return 0; } return 1 if $a1 eq $a2; my $ok = 1; my $bigger = keys %$a1 > keys %$a2 ? $a1 : $a2; foreach my $k ( keys %$bigger ) { my $e1 = exists $a1->{$k} ? $a1->{$k} : $DNE; my $e2 = exists $a2->{$k} ? $a2->{$k} : $DNE; next if _equal_nonrefs($e1, $e2); push @Data_Stack, { type => 'HASH', idx => $k, vals => [ $e1, $e2 ] }; $ok = _deep_check( $e1, $e2 ); pop @Data_Stack if $ok; last unless $ok; } return $ok; } #line 1605 sub eq_set { my( $a1, $a2 ) = @_; return 0 unless @$a1 == @$a2; no warnings 'uninitialized'; # It really doesn't matter how we sort them, as long as both arrays are # sorted with the same algorithm. # # Ensure that references are not accidentally treated the same as a # string containing the reference. # # Have to inline the sort routine due to a threading/sort bug. # See [rt.cpan.org 6782] # # I don't know how references would be sorted so we just don't sort # them. This means eq_set doesn't really work with refs. return eq_array( [ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ], [ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ], ); } #line 1807 1; Data-AMF-0.09/inc/Test/Builder/Module.pm000644 000765 000024 00000002241 11437121524 020576 0ustar00typesterstaff000000 000000 #line 1 package Test::Builder::Module; use strict; use Test::Builder; require Exporter; our @ISA = qw(Exporter); our $VERSION = '0.96'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) #line 74 sub import { my($class) = shift; # Don't run all this when loading ourself. return 1 if $class eq 'Test::Builder::Module'; my $test = $class->builder; my $caller = caller; $test->exported_to($caller); $class->import_extra( \@_ ); my(@imports) = $class->_strip_imports( \@_ ); $test->plan(@_); $class->export_to_level( 1, $class, @imports ); } sub _strip_imports { my $class = shift; my $list = shift; my @imports = (); my @other = (); my $idx = 0; while( $idx <= $#{$list} ) { my $item = $list->[$idx]; if( defined $item and $item eq 'import' ) { push @imports, @{ $list->[ $idx + 1 ] }; $idx++; } else { push @other, $item; } $idx++; } @$list = @other; return @imports; } #line 137 sub import_extra { } #line 167 sub builder { return Test::Builder->new; } 1; Data-AMF-0.09/inc/Test/Base/Filter.pm000644 000765 000024 00000016003 11437121524 020063 0ustar00typesterstaff000000 000000 #line 1 #. TODO: #. #=============================================================================== # This is the default class for handling Test::Base data filtering. #=============================================================================== package Test::Base::Filter; use Spiffy -Base; use Spiffy ':XXX'; field 'current_block'; our $arguments; sub current_arguments { return undef unless defined $arguments; my $args = $arguments; $args =~ s/(\\s)/ /g; $args =~ s/(\\[a-z])/'"' . $1 . '"'/gee; return $args; } sub assert_scalar { return if @_ == 1; require Carp; my $filter = (caller(1))[3]; $filter =~ s/.*:://; Carp::croak "Input to the '$filter' filter must be a scalar, not a list"; } sub _apply_deepest { my $method = shift; return () unless @_; if (ref $_[0] eq 'ARRAY') { for my $aref (@_) { @$aref = $self->_apply_deepest($method, @$aref); } return @_; } $self->$method(@_); } sub _split_array { map { [$self->split($_)]; } @_; } sub _peel_deepest { return () unless @_; if (ref $_[0] eq 'ARRAY') { if (ref $_[0]->[0] eq 'ARRAY') { for my $aref (@_) { @$aref = $self->_peel_deepest(@$aref); } return @_; } return map { $_->[0] } @_; } return @_; } #=============================================================================== # these filters work on the leaves of nested arrays #=============================================================================== sub Join { $self->_peel_deepest($self->_apply_deepest(join => @_)) } sub Reverse { $self->_apply_deepest(reverse => @_) } sub Split { $self->_apply_deepest(_split_array => @_) } sub Sort { $self->_apply_deepest(sort => @_) } sub append { my $suffix = $self->current_arguments; map { $_ . $suffix } @_; } sub array { return [@_]; } sub base64_decode { $self->assert_scalar(@_); require MIME::Base64; MIME::Base64::decode_base64(shift); } sub base64_encode { $self->assert_scalar(@_); require MIME::Base64; MIME::Base64::encode_base64(shift); } sub chomp { map { CORE::chomp; $_ } @_; } sub chop { map { CORE::chop; $_ } @_; } sub dumper { no warnings 'once'; require Data::Dumper; local $Data::Dumper::Sortkeys = 1; local $Data::Dumper::Indent = 1; local $Data::Dumper::Terse = 1; Data::Dumper::Dumper(@_); } sub escape { $self->assert_scalar(@_); my $text = shift; $text =~ s/(\\.)/eval "qq{$1}"/ge; return $text; } sub eval { $self->assert_scalar(@_); my @return = CORE::eval(shift); return $@ if $@; return @return; } sub eval_all { $self->assert_scalar(@_); my $out = ''; my $err = ''; Test::Base::tie_output(*STDOUT, $out); Test::Base::tie_output(*STDERR, $err); my $return = CORE::eval(shift); no warnings; untie *STDOUT; untie *STDERR; return $return, $@, $out, $err; } sub eval_stderr { $self->assert_scalar(@_); my $output = ''; Test::Base::tie_output(*STDERR, $output); CORE::eval(shift); no warnings; untie *STDERR; return $output; } sub eval_stdout { $self->assert_scalar(@_); my $output = ''; Test::Base::tie_output(*STDOUT, $output); CORE::eval(shift); no warnings; untie *STDOUT; return $output; } sub exec_perl_stdout { my $tmpfile = "/tmp/test-blocks-$$"; $self->_write_to($tmpfile, @_); open my $execution, "$^X $tmpfile 2>&1 |" or die "Couldn't open subprocess: $!\n"; local $/; my $output = <$execution>; close $execution; unlink($tmpfile) or die "Couldn't unlink $tmpfile: $!\n"; return $output; } sub flatten { $self->assert_scalar(@_); my $ref = shift; if (ref($ref) eq 'HASH') { return map { ($_, $ref->{$_}); } sort keys %$ref; } if (ref($ref) eq 'ARRAY') { return @$ref; } die "Can only flatten a hash or array ref"; } sub get_url { $self->assert_scalar(@_); my $url = shift; CORE::chomp($url); require LWP::Simple; LWP::Simple::get($url); } sub hash { return +{ @_ }; } sub head { my $size = $self->current_arguments || 1; return splice(@_, 0, $size); } sub join { my $string = $self->current_arguments; $string = '' unless defined $string; CORE::join $string, @_; } sub lines { $self->assert_scalar(@_); my $text = shift; return () unless length $text; my @lines = ($text =~ /^(.*\n?)/gm); return @lines; } sub norm { $self->assert_scalar(@_); my $text = shift; $text = '' unless defined $text; $text =~ s/\015\012/\n/g; $text =~ s/\r/\n/g; return $text; } sub prepend { my $prefix = $self->current_arguments; map { $prefix . $_ } @_; } sub read_file { $self->assert_scalar(@_); my $file = shift; CORE::chomp $file; open my $fh, $file or die "Can't open '$file' for input:\n$!"; CORE::join '', <$fh>; } sub regexp { $self->assert_scalar(@_); my $text = shift; my $flags = $self->current_arguments; if ($text =~ /\n.*?\n/s) { $flags = 'xism' unless defined $flags; } else { CORE::chomp($text); } $flags ||= ''; my $regexp = eval "qr{$text}$flags"; die $@ if $@; return $regexp; } sub reverse { CORE::reverse(@_); } sub slice { die "Invalid args for slice" unless $self->current_arguments =~ /^(\d+)(?:,(\d))?$/; my ($x, $y) = ($1, $2); $y = $x if not defined $y; die "Invalid args for slice" if $x > $y; return splice(@_, $x, 1 + $y - $x); } sub sort { CORE::sort(@_); } sub split { $self->assert_scalar(@_); my $separator = $self->current_arguments; if (defined $separator and $separator =~ s{^/(.*)/$}{$1}) { my $regexp = $1; $separator = qr{$regexp}; } $separator = qr/\s+/ unless $separator; CORE::split $separator, shift; } sub strict { $self->assert_scalar(@_); <<'...' . shift; use strict; use warnings; ... } sub tail { my $size = $self->current_arguments || 1; return splice(@_, @_ - $size, $size); } sub trim { map { s/\A([ \t]*\n)+//; s/(?<=\n)\s*\z//g; $_; } @_; } sub unchomp { map { $_ . "\n" } @_; } sub write_file { my $file = $self->current_arguments or die "No file specified for write_file filter"; if ($file =~ /(.*)[\\\/]/) { my $dir = $1; if (not -e $dir) { require File::Path; File::Path::mkpath($dir) or die "Can't create $dir"; } } open my $fh, ">$file" or die "Can't open '$file' for output\n:$!"; print $fh @_; close $fh; return $file; } sub yaml { $self->assert_scalar(@_); require YAML; return YAML::Load(shift); } sub _write_to { my $filename = shift; open my $script, ">$filename" or die "Couldn't open $filename: $!\n"; print $script @_; close $script or die "Couldn't close $filename: $!\n"; } __DATA__ #line 639 Data-AMF-0.09/inc/Module/Install/000755 000765 000024 00000000000 11437121525 017343 5ustar00typesterstaff000000 000000 Data-AMF-0.09/inc/Module/Install.pm000644 000765 000024 00000030135 11437121523 017701 0ustar00typesterstaff000000 000000 #line 1 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.005; use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '1.00'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE #------------------------------------------------------------- # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::cwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::cwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; foreach ( split //, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version ($) { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp ($$) { _version($_[0]) <=> _version($_[1]); } # Cloned from Params::Util::_CLASS sub _CLASS ($) { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2010 Adam Kennedy. Data-AMF-0.09/inc/Module/Install/AuthorTests.pm000644 000765 000024 00000002215 11437121524 022165 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::AuthorTests; use 5.005; use strict; use Module::Install::Base; use Carp (); #line 16 use vars qw{$VERSION $ISCORE @ISA}; BEGIN { $VERSION = '0.002'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } #line 42 sub author_tests { my ($self, @dirs) = @_; _add_author_tests($self, \@dirs, 0); } #line 56 sub recursive_author_tests { my ($self, @dirs) = @_; _add_author_tests($self, \@dirs, 1); } sub _wanted { my $href = shift; sub { /\.t$/ and -f $_ and $href->{$File::Find::dir} = 1 } } sub _add_author_tests { my ($self, $dirs, $recurse) = @_; return unless $Module::Install::AUTHOR; my @tests = $self->tests ? (split / /, $self->tests) : 't/*.t'; # XXX: pick a default, later -- rjbs, 2008-02-24 my @dirs = @$dirs ? @$dirs : Carp::confess "no dirs given to author_tests"; @dirs = grep { -d } @dirs; if ($recurse) { require File::Find; my %test_dir; File::Find::find(_wanted(\%test_dir), @dirs); $self->tests( join ' ', @tests, map { "$_/*.t" } sort keys %test_dir ); } else { $self->tests( join ' ', @tests, map { "$_/*.t" } sort @dirs ); } } #line 107 1; Data-AMF-0.09/inc/Module/Install/Base.pm000644 000765 000024 00000002147 11437121524 020556 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.00'; } # Suspend handler for "redefined" warnings BEGIN { my $w = $SIG{__WARN__}; $SIG{__WARN__} = sub { $w }; } #line 42 sub new { my $class = shift; unless ( defined &{"${class}::call"} ) { *{"${class}::call"} = sub { shift->_top->call(@_) }; } unless ( defined &{"${class}::load"} ) { *{"${class}::load"} = sub { shift->_top->load(@_) }; } bless { @_ }, $class; } #line 61 sub AUTOLOAD { local $@; my $func = eval { shift->_top->autoload } or return; goto &$func; } #line 75 sub _top { $_[0]->{_top}; } #line 90 sub admin { $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; } #line 106 sub is_admin { ! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); } sub DESTROY {} package Module::Install::Base::FakeAdmin; use vars qw{$VERSION}; BEGIN { $VERSION = $Module::Install::Base::VERSION; } my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 159 Data-AMF-0.09/inc/Module/Install/Can.pm000644 000765 000024 00000003333 11437121524 020403 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Can; use strict; use Config (); use File::Spec (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # check if we can load some module ### Upgrade this to not have to load the module if possible sub can_use { my ($self, $mod, $ver) = @_; $mod =~ s{::|\\}{/}g; $mod .= '.pm' unless $mod =~ /\.pm$/i; my $pkg = $mod; $pkg =~ s{/}{::}g; $pkg =~ s{\.pm$}{}i; local $@; eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } # check if we can run some command sub can_run { my ($self, $cmd) = @_; my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; my $abs = File::Spec->catfile($dir, $_[1]); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return $self->can_run("@chunks") || (pop(@chunks), next); } return; } # Fix Cygwin bug on maybe_command(); if ( $^O eq 'cygwin' ) { require ExtUtils::MM_Cygwin; require ExtUtils::MM_Win32; if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { *ExtUtils::MM_Cygwin::maybe_command = sub { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { ExtUtils::MM_Win32->maybe_command($file); } else { ExtUtils::MM_Unix->maybe_command($file); } } } } 1; __END__ #line 156 Data-AMF-0.09/inc/Module/Install/Fetch.pm000644 000765 000024 00000004627 11437121524 020742 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub get_file { my ($self, %args) = @_; my ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) { $args{url} = $args{ftp_url} or (warn("LWP support unavailable!\n"), return); ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; } $|++; print "Fetching '$file' from $host... "; unless (eval { require Socket; Socket::inet_aton($host) }) { warn "'$host' resolve failed!\n"; return; } return unless $scheme eq 'ftp' or $scheme eq 'http'; require Cwd; my $dir = Cwd::getcwd(); chdir $args{local_dir} or return if exists $args{local_dir}; if (eval { require LWP::Simple; 1 }) { LWP::Simple::mirror($args{url}, $file); } elsif (eval { require Net::FTP; 1 }) { eval { # use Net::FTP to get past firewall my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600); $ftp->login("anonymous", 'anonymous@example.com'); $ftp->cwd($path); $ftp->binary; $ftp->get($file) or (warn("$!\n"), return); $ftp->quit; } } elsif (my $ftp = $self->can_run('ftp')) { eval { # no Net::FTP, fallback to ftp.exe require FileHandle; my $fh = FileHandle->new; local $SIG{CHLD} = 'IGNORE'; unless ($fh->open("|$ftp -n")) { warn "Couldn't open ftp: $!\n"; chdir $dir; return; } my @dialog = split(/\n/, <<"END_FTP"); open $host user anonymous anonymous\@example.com cd $path binary get $file $file quit END_FTP foreach (@dialog) { $fh->print("$_\n") } $fh->close; } } else { warn "No working 'ftp' program available!\n"; chdir $dir; return; } unless (-f $file) { warn "Fetching failed: $@\n"; chdir $dir; return; } return if exists $args{size} and -s $file != $args{size}; system($args{run}) if exists $args{run}; unlink($file) if $args{remove}; print(((!exists $args{check_for} or -e $args{check_for}) ? "done!" : "failed! ($!)"), "\n"); chdir $dir; return !$?; } 1; Data-AMF-0.09/inc/Module/Install/Include.pm000644 000765 000024 00000001015 11437121524 021260 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Include; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub include { shift()->admin->include(@_); } sub include_deps { shift()->admin->include_deps(@_); } sub auto_include { shift()->admin->auto_include(@_); } sub auto_include_deps { shift()->admin->auto_include_deps(@_); } sub auto_include_dependent_dists { shift()->admin->auto_include_dependent_dists(@_); } 1; Data-AMF-0.09/inc/Module/Install/Makefile.pm000644 000765 000024 00000027032 11437121524 021421 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub Makefile { $_[0] } my %seen = (); sub prompt { shift; # Infinite loop protection my @c = caller(); if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; } # In automated testing or non-interactive session, always use defaults if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } # Store a cleaned up version of the MakeMaker version, # since we need to behave differently in a variety of # ways based on the MM version. my $makemaker = eval $ExtUtils::MakeMaker::VERSION; # If we are passed a param, do a "newer than" comparison. # Otherwise, just return the MakeMaker version. sub makemaker { ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 } # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified # as we only need to know here whether the attribute is an array # or a hash or something else (which may or may not be appendable). my %makemaker_argtype = ( C => 'ARRAY', CONFIG => 'ARRAY', # CONFIGURE => 'CODE', # ignore DIR => 'ARRAY', DL_FUNCS => 'HASH', DL_VARS => 'ARRAY', EXCLUDE_EXT => 'ARRAY', EXE_FILES => 'ARRAY', FUNCLIST => 'ARRAY', H => 'ARRAY', IMPORTS => 'HASH', INCLUDE_EXT => 'ARRAY', LIBS => 'ARRAY', # ignore '' MAN1PODS => 'HASH', MAN3PODS => 'HASH', META_ADD => 'HASH', META_MERGE => 'HASH', PL_FILES => 'HASH', PM => 'HASH', PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', XS => 'HASH', # VERSION => ['version',''], # ignore # _KEEP_AFTER_FLUSH => '', clean => 'HASH', depend => 'HASH', dist => 'HASH', dynamic_lib=> 'HASH', linkext => 'HASH', macro => 'HASH', postamble => 'HASH', realclean => 'HASH', test => 'HASH', tool_autosplit => 'HASH', # special cases where you can use makemaker_append CCFLAGS => 'APPENDABLE', DEFINE => 'APPENDABLE', INC => 'APPENDABLE', LDDLFLAGS => 'APPENDABLE', LDFROM => 'APPENDABLE', ); sub makemaker_args { my ($self, %new_args) = @_; my $args = ( $self->{makemaker_args} ||= {} ); foreach my $key (keys %new_args) { if ($makemaker_argtype{$key}) { if ($makemaker_argtype{$key} eq 'ARRAY') { $args->{$key} = [] unless defined $args->{$key}; unless (ref $args->{$key} eq 'ARRAY') { $args->{$key} = [$args->{$key}] } push @{$args->{$key}}, ref $new_args{$key} eq 'ARRAY' ? @{$new_args{$key}} : $new_args{$key}; } elsif ($makemaker_argtype{$key} eq 'HASH') { $args->{$key} = {} unless defined $args->{$key}; foreach my $skey (keys %{ $new_args{$key} }) { $args->{$key}{$skey} = $new_args{$key}{$skey}; } } elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { $self->makemaker_append($key => $new_args{$key}); } } else { if (defined $args->{$key}) { warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; } $args->{$key} = $new_args{$key}; } } return $args; } # For mm args that take multiple space-seperated args, # append an argument to the current list. sub makemaker_append { my $self = shift; my $name = shift; my $args = $self->makemaker_args; $args->{$name} = defined $args->{$name} ? join( ' ', $args->{$name}, @_ ) : join( ' ', @_ ); } sub build_subdirs { my $self = shift; my $subdirs = $self->makemaker_args->{DIR} ||= []; for my $subdir (@_) { push @$subdirs, $subdir; } } sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; %$clean = ( %$clean, FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; %$realclean = ( %$realclean, FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } sub libs { my $self = shift; my $libs = ref $_[0] ? shift : [ shift ]; $self->makemaker_args( LIBS => $libs ); } sub inc { my $self = shift; $self->makemaker_args( INC => shift ); } sub _wanted_t { } sub tests_recursive { my $self = shift; my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } my %tests = map { $_ => 1 } split / /, ($self->tests || ''); require File::Find; File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, $dir ); $self->tests( join ' ', sort keys %tests ); } sub write { my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; # Check the current Perl version my $perl_version = $self->perl_version; if ( $perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } # Make sure we have a new enough MakeMaker require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { # MakeMaker can complain about module versions that include # an underscore, even though its own version may contain one! # Hence the funny regexp to get rid of it. See RT #35800 # for details. my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/; $self->build_requires( 'ExtUtils::MakeMaker' => $v ); $self->configure_requires( 'ExtUtils::MakeMaker' => $v ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{NAME} =~ s/-/::/g; $args->{VERSION} = $self->version or die <<'EOT'; ERROR: Can't determine distribution version. Please specify it explicitly via 'version' in Makefile.PL, or set a valid $VERSION in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT $DB::single = 1; if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; } elsif ( $Module::Install::ExtraTests::use_extratests ) { # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. # So, just ignore our xt tests here. } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { $args->{test} = { TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = join ', ', @{$self->author || []}; } if ( $self->makemaker(6.10) ) { $args->{NO_META} = 1; #$args->{NO_MYMETA} = 1; } if ( $self->makemaker(6.17) and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } if ( $self->makemaker(6.31) and $self->license ) { $args->{LICENSE} = $self->license; } my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # Merge both kinds of requires into BUILD_REQUIRES my $build_prereq = ($args->{BUILD_REQUIRES} ||= {}); %$build_prereq = ( %$build_prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->configure_requires, $self->build_requires) ); # Remove any reference to perl, BUILD_REQUIRES doesn't support it delete $args->{BUILD_REQUIRES}->{perl}; # Delete bundled dists from prereq_pm, add it to Makefile DIR my $subdirs = ($args->{DIR} || []); if ($self->bundles) { my %processed; foreach my $bundle (@{ $self->bundles }) { my ($mod_name, $dist_dir) = @$bundle; delete $prereq->{$mod_name}; $dist_dir = File::Basename::basename($dist_dir); # dir for building this module if (not exists $processed{$dist_dir}) { if (-d $dist_dir) { # List as sub-directory to be processed by make push @$subdirs, $dist_dir; } # Else do nothing: the module is already present on the system $processed{$dist_dir} = undef; } } } unless ( $self->makemaker('6.55_03') ) { %$prereq = (%$prereq,%$build_prereq); delete $args->{BUILD_REQUIRES}; } if ( my $perl_version = $self->perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; if ( $self->makemaker(6.48) ) { $args->{MIN_PERL_VERSION} = $perl_version; } } if ($self->installdirs) { warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; $args->{INSTALLDIRS} = $self->installdirs; } my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_} ) } keys %$args; my $user_preop = delete $args{dist}->{PREOP}; if ( my $preop = $self->admin->preop($user_preop) ) { foreach my $key ( keys %$preop ) { $args{dist}->{$key} = $preop->{$key}; } } my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); } sub fix_up_makefile { my $self = shift; my $makefile_name = shift; my $top_class = ref($self->_top) || ''; my $top_version = $self->_top->VERSION || ''; my $preamble = $self->preamble ? "# Preamble by $top_class $top_version\n" . $self->preamble : ''; my $postamble = "# Postamble by $top_class $top_version\n" . ($self->postamble || ''); local *MAKEFILE; open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; # Module::Install will never be used to build the Core Perl # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; seek MAKEFILE, 0, SEEK_SET; truncate MAKEFILE, 0; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; 1; } sub preamble { my ($self, $text) = @_; $self->{preamble} = $text . $self->{preamble} if defined $text; $self->{preamble}; } sub postamble { my ($self, $text) = @_; $self->{postamble} ||= $self->admin->postamble; $self->{postamble} .= $text if defined $text; $self->{postamble} } 1; __END__ #line 541 Data-AMF-0.09/inc/Module/Install/Metadata.pm000644 000765 000024 00000043020 11437121524 021417 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords author }; *authors = \&author; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; unless ( @_ ) { warn "You MUST provide an explicit true/false value to dynamic_config\n"; return $self; } $self->{values}->{dynamic_config} = $_[0] ? 1 : 0; return 1; } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the reall old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } $self->{values}{all_from} = $file; # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless @{$self->author || []}; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $file ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) \s* ; /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( \Qhttp://rt.cpan.org/\E[^>]+| \Qhttp://github.com/\E[\w_]+/[\w_]+/issues| \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than one bugtracker link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashs delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; if ( exists $val->{requires} ) { $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; } if ( exists $val->{build_requires} ) { $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; } return $meta; } 1; Data-AMF-0.09/inc/Module/Install/Repository.pm000644 000765 000024 00000004256 11437121525 022067 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Repository; use strict; use 5.005; use vars qw($VERSION); $VERSION = '0.06'; use base qw(Module::Install::Base); sub _execute { my ($command) = @_; `$command`; } sub auto_set_repository { my $self = shift; return unless $Module::Install::AUTHOR; my $repo = _find_repo(\&_execute); if ($repo) { $self->repository($repo); } else { warn "Cannot determine repository URL\n"; } } sub _find_repo { my ($execute) = @_; if (-e ".git") { # TODO support remote besides 'origin'? if ($execute->('git remote show -n origin') =~ /URL: (.*)$/m) { # XXX Make it public clone URL, but this only works with github my $git_url = $1; $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!; return $git_url; } elsif ($execute->('git svn info') =~ /URL: (.*)$/m) { return $1; } } elsif (-e ".svn") { if (`svn info` =~ /URL: (.*)$/m) { return $1; } } elsif (-e "_darcs") { # defaultrepo is better, but that is more likely to be ssh, not http if (my $query_repo = `darcs query repo`) { if ($query_repo =~ m!Default Remote: (http://.+)!) { return $1; } } open my $handle, '<', '_darcs/prefs/repos' or return; while (<$handle>) { chomp; return $_ if m!^http://!; } } elsif (-e ".hg") { if ($execute->('hg paths') =~ /default = (.*)$/m) { my $mercurial_url = $1; $mercurial_url =~ s!^ssh://hg\@(bitbucket\.org/)!https://$1!; return $mercurial_url; } } elsif (-e "$ENV{HOME}/.svk") { # Is there an explicit way to check if it's an svk checkout? my $svk_info = `svk info` or return; SVK_INFO: { if ($svk_info =~ /Mirrored From: (.*), Rev\./) { return $1; } if ($svk_info =~ m!Merged From: (/mirror/.*), Rev\.!) { $svk_info = `svk info /$1` or return; redo SVK_INFO; } } return; } } 1; __END__ =encoding utf-8 #line 128 Data-AMF-0.09/inc/Module/Install/TestBase.pm000644 000765 000024 00000001033 11437121524 021407 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::TestBase; use strict; use warnings; use Module::Install::Base; use vars qw($VERSION @ISA); BEGIN { $VERSION = '0.11'; @ISA = 'Module::Install::Base'; } sub use_test_base { my $self = shift; $self->include('Test::Base'); $self->include('Test::Base::Filter'); $self->include('Spiffy'); $self->include('Test::More'); $self->include('Test::Builder'); $self->include('Test::Builder::Module'); $self->requires('Filter::Util::Call'); } 1; =encoding utf8 #line 70 Data-AMF-0.09/inc/Module/Install/Win32.pm000644 000765 000024 00000003403 11437121524 020602 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # determine if the user needs nmake, and download it if needed sub check_nmake { my $self = shift; $self->load('can_run'); $self->load('get_file'); require Config; return unless ( $^O eq 'MSWin32' and $Config::Config{make} and $Config::Config{make} =~ /^nmake\b/i and ! $self->can_run('nmake') ); print "The required 'nmake' executable not found, fetching it...\n"; require File::Basename; my $rv = $self->get_file( url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe', ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe', local_dir => File::Basename::dirname($^X), size => 51928, run => 'Nmake15.exe /o > nul', check_for => 'Nmake.exe', remove => 1, ); die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- Since you are using Microsoft Windows, you will need the 'nmake' utility before installation. It's available at: http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe or ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe Please download the file manually, save it to a directory in %PATH% (e.g. C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to that directory, and run "Nmake15.exe" from there; that will create the 'nmake.exe' file needed by this module. You may then resume the installation process described in README. ------------------------------------------------------------------------------- END_MESSAGE } 1; Data-AMF-0.09/inc/Module/Install/WriteAll.pm000644 000765 000024 00000002376 11437121524 021433 0ustar00typesterstaff000000 000000 #line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.00'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } sub WriteAll { my $self = shift; my %args = ( meta => 1, sign => 0, inline => 0, check_nmake => 1, @_, ); $self->sign(1) if $args{sign}; $self->admin->WriteAll(%args) if $self->is_admin; $self->check_nmake if $args{check_nmake}; unless ( $self->makemaker_args->{PL_FILES} ) { # XXX: This still may be a bit over-defensive... unless ($self->makemaker(6.25)) { $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; } } # Until ExtUtils::MakeMaker support MYMETA.yml, make sure # we clean it up properly ourself. $self->realclean_files('MYMETA.yml'); if ( $args{inline} ) { $self->Inline->write; } else { $self->Makefile->write; } # The Makefile write process adds a couple of dependencies, # so write the META.yml files after the Makefile. if ( $args{meta} ) { $self->Meta->write; } # Experimental support for MYMETA if ( $ENV{X_MYMETA} ) { if ( $ENV{X_MYMETA} eq 'JSON' ) { $self->Meta->write_mymeta_json; } else { $self->Meta->write_mymeta_yaml; } } return 1; } 1; Data-AMF-0.09/examples/simple_flash_remoting.as000644 000765 000024 00000002763 11314656372 022473 0ustar00typesterstaff000000 000000 package { import flash.display.*; import flash.net.*; import flash.events.*; public class simple_flash_remoting extends Sprite { private var nc:NetConnection; public function simple_flash_remoting() { nc = new NetConnection(); nc.objectEncoding = ObjectEncoding.AMF0; nc.addEventListener( AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler ); nc.addEventListener( IOErrorEvent.IO_ERROR, ioErrorHandler ); nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler ); nc.addEventListener( SecurityErrorEvent.SECURITY_ERROR, securityErrorEvent ); nc.connect("http://localhost:3000/gateway"); nc.call("echo", new Responder(echo_result, remote_error), "foo", "bar"); nc.call("sum", new Responder(sum_result, remote_error), 1, 1); } private function echo_result(...args):void { log('echo_result'); log(args); } private function sum_result(...args):void { log('sum_result'); log(args); } private function remote_error(...args):void { log('remote_error'); log(args); } private function asyncErrorHandler(e:AsyncErrorEvent):void {} private function ioErrorHandler(e:IOErrorEvent):void {} private function netStatusHandler(e:NetStatusEvent):void {} private function securityErrorEvent(e:SecurityErrorEvent):void {} } } Data-AMF-0.09/examples/simple_flash_remoting.pl000755 000765 000024 00000002426 11314656372 022502 0ustar00typesterstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use FindBin::libs; use Data::AMF::Packet; use HTTPEx::Declare; use List::Util (); use Path::Class; interface ServerSimple => { host => '0.0.0.0', port => 3000, }; run { my $c = shift; if ($c->req->path eq 'gateway') { my $fh = $c->req->body; my $body = do { local $/; <$fh> }; my $request = Data::AMF::Packet->deserialize($body); my @result; for my $message (@{ $request->messages }) { my $method = __PACKAGE__->can($message->target_uri); if ($method) { my $result = $method->( $message->value ); push @result, $message->result($result); } } my $response = Data::AMF::Packet->new( version => $request->version, headers => [], messages => \@result, ); $c->res->content_type('application/x-amf'); $c->res->body($response->serialize) } else { $c->res->content_type('application/x-shockwave-flash'); $c->res->body( scalar file('./examples/simple_flash_remoting.swf')->slurp ); } }; sub echo { return $_[0]; } sub sum { return List::Util::sum(@{ $_[0] }); } sub dump { use YAML; warn Dump $_[0]; } Data-AMF-0.09/examples/simple_flash_remoting.swf000644 000765 000024 00000003757 11314656372 022673 0ustar00typesterstaff000000 000000 CWS Y xmVs_?e9TDGLcꃱ\[l$9aM| 4OS8z=3驇NOқNsz_QuPC}0G_ZrŭrfmZ"h-, {{{nݺUP `1X?kSŀ`ct<ö2<=cm礝c @Mڦs@ּ阆tYetijnk7}<3i԰4S6~f!S֡o'Z|cv؍95*p~ŧtᶨSZ,{/ G}ݡgmqfv]Z\ GͣyUYPo殅IRG!о"ZS.UK gQID~{iZvvǤOZ>uh kcPt6C ~6ݨ&=뺁ܦz19ضI5k € ځ*6X]K2.^bƪmYT zy ;Y :uoHh! )X$hw]ryޱYD 퀼&=Mۢwh-n@I҃"ǛO׷*[ho#nTys}Niv|{}pewL[̖z vaI[V:lӶٺpcГ Jt8ma ˣxNC$: wL4 p]Ä7Fr-L Z $9@T0ȣ/M>Y]+픞d̏ͮet.o&+߱/{v8ҙ̹7guϑyqPfBzGWªբx5"]}LiY`19._rQZ9hE6GخoHW#"-5p_ن_'*55,Map1i6yV#c<"x4666qXƤ,)DILVf'@BHDL(c~ ' " &dQ"| "]$"d$C|& 'J9vN"7 E8&IK*kX?%.g|iiM #1:f{!1"Hđ#/#J2Fl#1P 1b0H#> R@:Ňll$!(EQ9StD=R?x,??R6ϢؽjEkXs\O9QKT.2 j535%d-˕19'Y-o2,'tydYWysoK]"O'չcwPϑExR,@u.^:_ !!ׅO~XYTD:܃:,a"*0SIļOCK $ukX'C?$@>;:>߁|_|$q  bn."= +[4FYmu4N =W@{V|(Soq뜞B(,4rH}q|WU8) G/'Zg%V ౔yX? "Data-AMF-0.09/examples/simple_flex_rpc/000755 000765 000024 00000000000 11437121525 020730 5ustar00typesterstaff000000 000000 Data-AMF-0.09/examples/simple_flex_rpc/HelloController.pm000644 000765 000024 00000000773 11375150457 024413 0ustar00typesterstaff000000 000000 package HelloController; use Moose; sub echo { my ($self, $args) = @_; return $args; } sub list { my ($self, $args) = @_; my $len = $args->[0] || 1000; my @result; for (1 .. $len) { push @result, { id => $_, name => 'data' . $_, description => 'こんにちは。これは AMF から受け取ったデータです。' }; } return { 'data' => \@result }; } sub add { my ($self, $args) = @_; return $args->[0] . " + " . $args->[1] . " = " . ($args->[0] + $args->[1]); } 1; Data-AMF-0.09/examples/simple_flex_rpc/SimpleFlexRPC.mxml000644 000765 000024 00000003221 11314656440 024245 0ustar00typesterstaff000000 000000 Data-AMF-0.09/examples/simple_flex_rpc/SimpleFlexRPC.swf000644 000765 000024 00000165164 11314656440 024106 0ustar00typesterstaff000000 000000 CWS xڴ`UE7~fN{M$!Q(  @[=7@uAҫ bEDD^@b7s%}/gf3<̜8QRKR=TDn$;sơ5#C9NkZ=a„ J#Ѧ} һo}Asp3yi*  =H[N% mmE~_o#hpݧ 6F!O|Okk0zOw}ʆXs{w8wT|4=z/Nu0;j֠ǪfĆ'ʣfCm3BcDO yƨ'drRikϓPlB5[Y'M4)n=*Fb/٠![u/߫]m9ߚ޸]Ww=z7'q}u+o7x=eWAom﫯U?ܷ2u[m~I}cʼ>XR{t ˭N! 'MWLi%_w8oT9I/g_X}<|ti ~%KN9JeRo"0ią7!t~ 64ȟ7>~rw/{%iYсTao E#F40̌Pk$ }VncviD[FP̢VO*3D3k 3Yb*423N2-9Uv8I}X{6|f6Ҵb0ÃUk HVҋtr0]UV,5#"6k#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G]@م]D..2. ʮ*ʮʮ:ʮn&nn6n.l#ePv/eQv?eP eQ0eP(eQ8eOP$eOQ4eP,eQfcwYB:1J_Ru>M4$2gO$:+Vv˪TE:b{CT 9>՞ #A>#S&O{MC9Data-AMF-0.09/examples/simple_flex_rpc/gateway.psgi000755 000765 000024 00000001257 11314656440 023270 0ustar00typesterstaff000000 000000 use Data::AMF::Remoting; use Plack::Request; use UNIVERSAL::require; sub { my $env = shift; my $req = Plack::Request->new($env); my $res = $req->new_response(200); if ($req->path =~ /\/amf\/gateway$/) { my $remoting = Data::AMF::Remoting->new( source => $req->raw_body, message_did_process => sub { my $message = shift; my ($controller_name, $method) = split '\.', $message->target_uri; $controller_name->require; my $controller = $controller_name->new; return $controller->$method($message->value); } ); $remoting->run; $res->content_type('application/x-amf'); $res->body($remoting->data); } return $res->finalize; };