Dancer-Plugin-DBIC-0.2104000755001750001750 012620110470 14607 5ustar00naveednaveed000000000000README100644001750001750 1717412620110470 15602 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104NAME Dancer::Plugin::DBIC - DBIx::Class interface for Dancer applications VERSION version 0.2104 SYNOPSIS use Dancer; use Dancer::Plugin::DBIC qw(schema resultset rset); get '/users/:user_id' => sub { my $user_id = param 'user_id'; my $user; # all of the following are equivalent: $user = schema('default')->resultset('User')->find($user_id); $user = schema->resultset('User')->find($user_id); $user = resultset('User')->find($user_id); $user = rset('User')->find($user_id); template user_profile => { user => $user }; }; dance; DESCRIPTION This plugin makes it very easy to create Dancer applications that interface with databases. It automatically exports the keyword "schema" which returns a DBIx::Class::Schema object. You just need to configure your database connection information. For performance, schema objects are cached in memory and are lazy loaded the first time they are accessed. This plugin is now just a thin wrapper around DBICx::Sugar. CONFIGURATION Configuration can be done in your Dancer config file. simple example Here is a simple example. It defines one database named "default": plugins: DBIC: default: dsn: dbi:SQLite:dbname=myapp.db schema_class: MyApp::Schema multiple schemas In this example, there are 2 databases configured named "default" and "foo": plugins: DBIC: default: dsn: dbi:SQLite:dbname=myapp.db schema_class: MyApp::Schema foo: dsn: dbi:Pg:dbname=foo schema_class: Foo::Schema user: bob password: secret options: RaiseError: 1 PrintError: 1 Each database configured must at least have a dsn option. The dsn option should be the DBI driver connection string. All other options are optional. If you only have one schema configured, or one of them is named "default", you can call "schema" without an argument to get the only or "default" schema, respectively. If a schema_class option is not provided, then DBIx::Class::Schema::Loader will be used to dynamically load the schema by introspecting the database corresponding to the dsn value. You need DBIx::Class::Schema::Loader installed for this to work. WARNING: Dynamic loading is not recommended for production environments. It is almost always better to provide a schema_class option. The schema_class option should be the name of your DBIx::Class::Schema class. See "SCHEMA GENERATION" Optionally, a database configuration may have user, password, and options parameters as described in the documentation for "connect()" in DBI. connect_info Alternatively, you may also declare your connection information inside an array named "connect_info": plugins: DBIC: default: schema_class: MyApp::Schema connect_info: - dbi:Pg:dbname=foo - bob - secret - RaiseError: 1 PrintError: 1 replicated You can also add database read slaves to your configuration with the "replicated" config option. This will automatically make your read queries go to a slave and your write queries go to the master. Keep in mind that this will require additional dependencies: DBIx::Class::Optional::Dependencies#Storage::Replicated See DBIx::Class::Storage::DBI::Replicated for more details. Here is an example configuration that adds two read slaves: plugins: DBIC: default: schema_class: MyApp::Schema dsn: dbi:Pg:dbname=master replicated: balancer_type: ::Random # optional balancer_args: # optional auto_validate_every: 5 # optional master_read_weight:1 # optional # pool_type and pool_args are also allowed and are also optional replicants: - - dbi:Pg:dbname=slave1 - user1 - password1 - quote_names: 1 pg_enable_utf8: 1 - - dbi:Pg:dbname=slave2 - user2 - password2 - quote_names: 1 pg_enable_utf8: 1 alias Schema aliases allow you to reference the same underlying database by multiple names. For example: plugins: DBIC: default: dsn: dbi:Pg:dbname=master schema_class: MyApp::Schema slave1: alias: default Now you can access the default schema with "schema()", "schema('default')", or "schema('slave1')". This can come in handy if, for example, you have master/slave replication in your production environment but only a single database in your development environment. You can continue to reference "schema('slave1')" in your code in both environments by simply creating a schema alias in your development.yml config file, as shown above. FUNCTIONS schema my $user = schema->resultset('User')->find('bob'); The "schema" keyword returns a DBIx::Class::Schema object ready for you to use. If you have configured only one database, then you can simply call "schema" with no arguments. If you have configured multiple databases, you can still call "schema" with no arguments if there is a database named "default" in the configuration. With no argument, the "default" schema is returned. Otherwise, you must provide "schema()" with the name of the database: my $user = schema('foo')->resultset('User')->find('bob'); resultset This is a convenience method that will save you some typing. Use this only when accessing the "default" schema. my $user = resultset('User')->find('bob'); is equivalent to: my $user = schema->resultset('User')->find('bob'); rset my $user = rset('User')->find('bob'); This is simply an alias for "resultset". SCHEMA GENERATION Setting the schema_class option and having proper DBIx::Class classes is the recommended approach for performance and stability. You can use the dbicdump command line tool provided by DBIx::Class::Schema::Loader to help you. For example, if your app were named Foo, then you could run the following from the root of your project directory: dbicdump -o dump_directory=./lib Foo::Schema dbi:SQLite:/path/to/foo.db For this example, your "schema_class" setting would be 'Foo::Schema'. SEE ALSO * DBICx::Sugar CONTRIBUTORS * Alexis Sukrieh * Dagfinn Ilmari Mannsåker <> * David Precious * Fabrice Gabolde <> * Franck Cuny * Steven Humphrey <> * Yanick Champoux <> AUTHORS * Al Newkirk * Naveed Massjouni COPYRIGHT AND LICENSE This software is copyright (c) 2010 by awncorp. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. LICENSE100644001750001750 4363412620110470 15727 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104This software is copyright (c) 2010 by awncorp. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system 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 GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2010 by awncorp. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our 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. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, 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 a 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 tell them 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. 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 Agreement 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 work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 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 General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual 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 General Public License. d) 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. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 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 Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying 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. 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. 7. 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 the 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 the license, you may choose any version ever published by the Free Software Foundation. 8. 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 9. 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. 10. 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 Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2010 by awncorp. This is free software, licensed under: The Artistic License 1.0 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. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. 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 CHANGES100644001750001750 5621512620110470 15714 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104================================================== Changes from 2005-11-11 00:00:00 +0000 to present. ================================================== ------------------------------------------- version 0.2104 at 2015-11-09 12:27:36 +0000 ------------------------------------------- Change: dbd5bdaa7daa7e89efe7bb2cb0aa920a318f7b05 Author: Naveed Massjouni Date : 2015-11-09 07:26:51 +0000 v0.2104 Change: 9d2cba1d3e7c3825f34898270daef2092337f999 Author: Naveed Massjouni Date : 2015-11-09 07:25:18 +0000 removed unnecessary Module::Load import Change: 14fc6672e7befed9b4cdc12f74a812762f3b4714 Author: Naveed Massjouni Date : 2015-11-09 06:36:31 +0000 v0.2103 Change: 95416a379f6fc8a4f483e62be09fc7ba4e2766ee Author: Naveed Massjouni Date : 2015-11-09 06:35:24 +0000 removed plugin_args call Change: 69812f09c160b2a101889c8ed4a9347c13f13946 Author: Naveed Massjouni Date : 2015-11-09 06:31:29 +0000 Merge pull request #20 from Relequestual/master Call own schema function rather than DBICx::Sugar Change: f639de7050d32cf2743cb63f1b948b671ea86f6e Author: Ben Hutton Date : 2015-11-05 10:02:11 +0000 Call own schema function Fixes https://github.com/ironcamel/Dancer-Plugin-DBIC/issues/19 Change: c185d432d0d094dab3e59ae8808c86897a062696 Author: Naveed Massjouni Date : 2015-03-29 06:03:31 +0000 updated synopsis ------------------------------------------- version 0.2102 at 2015-03-29 09:44:09 +0000 ------------------------------------------- Change: 96eacfc5c44a2ac4c5f6ae5c4e8202c1e9f7c059 Author: Naveed Massjouni Date : 2015-03-29 05:44:09 +0000 this plugin is now a thin wrapper around DBICx::Sugar I created DBICx::Sugar to factor out the code duplication between Dancer::Plugin::DBIC and Dancer2::Plugin::DBIC. Now this plugin is just a thin wrapper around DBICx::Sugar. ------------------------------------------- version 0.2101 at 2015-02-14 02:52:24 +0000 ------------------------------------------- Change: b4b29aa82925bc53370ae15aa66e897085c31db5 Author: Naveed Massjouni Date : 2015-02-13 21:52:24 +0000 updated SQL::Translator version requirement to fix cpantesters failures Change: 2ee1a4bfad6362fad5907dfe85fb8d866835cef6 Author: Naveed Massjouni Date : 2015-01-12 01:16:15 +0000 Merge pull request #17 from monsieurp/test-code-refactoring Test code refactoring Change: c2b09c695a711a336e753771926c01d4a53a4c31 Author: Patrice Clement Date : 2015-01-11 19:48:35 +0000 get rid of eval {} and make use of Test::Requires instead Change: 9270cfe02c06f1de469d6e19171c3e8d1ecb2f47 Author: Patrice Clement Date : 2015-01-10 20:32:36 +0000 test code refactoring and import tyding. ------------------------------------------- version 0.2100 at 2014-04-05 06:59:23 +0000 ------------------------------------------- Change: 72ba5fadea989d087feddf36f7e72d6be70b3dec Author: Naveed Massjouni Date : 2014-04-05 02:59:23 +0000 Merge pull request #15 from ironcamel/balancer-args added support for more ::Replicated options Change: 9ee389e9fde37bc56ed71fbb8b37d0a4fcd5d756 Author: Naveed Massjouni Date : 2014-04-05 02:56:29 +0000 added support for more ::Replicated options Added support for options: balancer_args, pool_type, and pool_args. Also getting ready to release v0.2100. Change: 7786e1b86267dc1e487a17e4b7d7768278b9f707 Author: Naveed Massjouni Date : 2014-03-12 04:27:32 +0000 releasing v0.2001 Change: 488d55a763c10217debc9bfbd4850da80b0d182b Author: Naveed Massjouni Date : 2014-03-12 04:22:42 +0000 Removed deprecated pckg option. Also added deprecation warning for the pass option and updated the documentation. Change: 20309bc791e8c0388ef86cc8cc3b0590f126d380 Author: Naveed Massjouni Date : 2014-03-12 04:21:12 +0000 skip the replicated tests if the required deps are not installed ------------------------------------------- version 0.2000 at 2014-03-11 20:00:09 +0000 ------------------------------------------- Change: 5845b02557d12f571d4fee5b3fc43c17705cc06d Author: Naveed Massjouni Date : 2014-03-11 16:00:09 +0000 Merge pull request #14 from ironcamel/replicated added support for database slaves via DBIx::Class::Storage::DBI::Replicated Change: 8054506283bd590628b3964ae53568a01466daa2 Author: Naveed Massjouni Date : 2014-03-11 15:50:50 +0000 added support for database slaves via DBIx::Class::Storage::DBI::Replicated ------------------------------------------- version 0.1901 at 2014-02-05 03:07:46 +0000 ------------------------------------------- Change: 18328b1c8ef7010c97e34a2b2d9968a3ce2a20d5 Author: Naveed Massjouni Date : 2014-02-04 22:07:46 +0000 Added SQL::Translator prereq for tests to pass. ------------------------------------------- version 0.1900 at 2014-02-04 22:49:09 +0000 ------------------------------------------- Change: a5a03b2c41f54a05e8e04304959e7b0c3ce4bd81 Author: Naveed Massjouni Date : 2014-02-04 14:49:09 +0000 Merge pull request #12 from ironcamel/schema-alias added support for schema aliases Change: d8a263847cdb792653a54b41d8712e301b7d89a2 Author: Naveed Massjouni Date : 2014-02-04 17:48:09 +0000 releasing v0.1900 Change: 29fe667579534a02f53c8d0eb6b750c0951ba9ea Author: Naveed Massjouni Date : 2014-02-04 16:30:04 +0000 added support for schema aliases Change: 653785a8790f8597a3eb0e8038c0c52f39d1b03e Author: Naveed Massjouni Date : 2013-10-06 23:54:38 +0000 Releasing v0.1803 Change: 34dd735a8f99c13fe7ef22a880ffe0acecc159fc Author: Naveed Massjouni Date : 2013-04-05 21:57:45 +0000 Merge pull request #11 from bentglasstube/master Show root cause when unable to load schema. Change: 865b34ce28081f0e31beedb1caaee876339bb851 Author: Alan Berndt Date : 2013-04-05 15:21:23 +0000 Show reason when unable to load schema. Change: 65d3c0d347c2075ff6d7d4efef0e0396354b7d17 Author: Naveed Massjouni Date : 2013-01-22 09:57:07 +0000 Updated version requirement for Dancer. A newer Dancer is required to use the plugin_args() function. ------------------------------------------- version 0.1801 at 2013-01-21 05:13:44 +0000 ------------------------------------------- Change: 1a178ea47c1c1e875429c55d7e9a3b79742f1876 Author: Naveed Massjouni Date : 2013-01-21 00:13:44 +0000 Getting ready to release v0.1801 Change: 0f88ba279fdb33f06f8c7fffc48ffa8d9619af3b Author: Naveed Massjouni Date : 2013-01-20 20:03:49 +0000 Merge pull request #7 from yanick/dancer-2 compatibility with Dancer 2 Change: 1608e5924745a9e385d109b2fbaaae498a18d46f Author: Yanick Champoux Date : 2013-01-20 12:17:07 +0000 compatibility with Dancer 2 ------------------------------------------- version 0.1800 at 2013-01-19 03:30:17 +0000 ------------------------------------------- Change: 5203af9276578c9de4ac6ec5a95d72cab2229951 Author: Naveed Massjouni Date : 2013-01-18 22:30:17 +0000 Added resultset and rset keywords. Setting version to v0.1800. Change: 509ec32b84487d851ca997d31700dd62b860293d Author: Naveed Massjouni Date : 2013-01-07 00:57:55 +0000 Fixed pod encoding ------------------------------------------- version 0.1700 at 2013-01-01 19:30:37 +0000 ------------------------------------------- Change: 4ccdbcc5717b286df227b4996c9d60f2dc1dd6ec Author: Naveed Massjouni Date : 2013-01-01 14:30:37 +0000 Getting ready to cut v0.1700 Change: 91c2eb89e4a50fd6bbf125eed639e0648c8ac7d0 Author: Naveed Massjouni Date : 2013-01-01 10:42:44 +0000 Merge pull request #5 from shumphrey/master Support for Dancer2 Change: 2cf8ac7154bb2047577e711838bb05f2f31d5223 Author: Steven Humphrey Date : 2012-12-16 10:25:18 +0000 Support for Dancer2 Change: 99a9c7e4b40281e3414917c0c117db77ba2c0b9d Author: Steven Humphrey Date : 2012-12-16 10:21:43 +0000 Merge remote-tracking branch 'upstream/master' * upstream/master: Skip some tests when DBIx::Class::Schema::Loader is missing. Started using Module::Load for dynamically loading modules. Make DBIx::Class::Schema::Loader an optional dependency, required at runtime. Updated POD documentation. Adding README for github. Updating POD documentation Cleaning up dist.ini Add myself to authors Include GH issues in META.yml resources too Add GitHub URLs to meta.yml Typo fix Some typo fixes and improving the synopsis examples Typo in config file example Keyboarding fail. Strongly discourage dynamic schema introspection Updating authors, removing tabs and changed Prereq to Prereqs. Change: 0bea04dfec01221ec7f5895079225b597e510386 Author: Steven Humphrey Date : 2012-12-15 10:50:22 +0000 Support for Dancer2 Change: 9caba887b31a0026eb64fa3a8e5f41c2ecc7f31d Author: Naveed Massjouni Date : 2012-03-22 11:23:45 +0000 Merge pull request #10 from ilmari/default-schema Add default schema support ------------------------------------------- version 0.1601 at 2012-10-01 06:41:17 +0000 ------------------------------------------- Change: 36dad6bf98fabf9df5d28142f572955c7e3c2508 Author: Naveed Massjouni Date : 2012-10-01 02:41:17 +0000 Skip some tests when DBIx::Class::Schema::Loader is missing. ------------------------------------------- version 0.1600 at 2012-09-29 05:52:36 +0000 ------------------------------------------- Change: 6e7f6789d4ef517c6628e590065068ec892735a7 Author: Naveed Massjouni Date : 2012-09-29 01:52:36 +0000 Started using Module::Load for dynamically loading modules. Updated version for new release 0.1600 Change: 66e3d7be95e9f13dcb92a30f4b44834d3a6fa3ca Author: Naveed Massjouni Date : 2012-09-17 18:40:56 +0000 Merge pull request #3 from fgabolde/master Make DBIx::Class::Schema::Loader an optional dependency Change: 1004f2b1c6c1e80d338d40ebe422bcfe7851a27f Author: Fabrice Gabolde Date : 2012-09-16 13:28:27 +0000 Make DBIx::Class::Schema::Loader an optional dependency, required at runtime. ------------------------------------------- version 0.1506 at 2012-04-13 03:20:47 +0000 ------------------------------------------- Change: 30e34f2054fc43ac7fe7a55f3493136a965efae5 Author: Naveed Massjouni Date : 2012-04-12 23:20:47 +0000 Updated POD documentation. Change: c7d0bc3633964a1445149985b1c5a524b180a64d Author: Naveed Massjouni Date : 2012-04-10 03:52:22 +0000 Merge remote-tracking branch 'ilmari/default-schema' Conflicts: lib/Dancer/Plugin/DBIC.pm Change: 223c7ad3bb4738f7386caddbe7ce34531c2a8114 Author: Dagfinn Ilmari MannsÃ¥ker Date : 2012-03-22 16:57:13 +0000 Fix POD typo Change: e36a706da1995924c8b1869edbfe871f4519e20c Author: Dagfinn Ilmari MannsÃ¥ker Date : 2012-03-22 16:50:16 +0000 Add default schema support Return the 'default' schema if multiple are defined and it exists, otherwise throw an error. If only one schema is defined, continue to return that. Change: 91284f1b60e37c87a5cf9756318f8fb1bbe6bebb Author: Naveed Massjouni Date : 2012-02-08 14:07:07 +0000 Adding README for github. ------------------------------------------- version 0.1505 at 2012-02-08 04:23:43 +0000 ------------------------------------------- Change: 985fbe2299b6fd99852d0b2b119456bedea0d437 Author: Naveed Massjouni Date : 2012-02-07 23:23:43 +0000 Updating POD documentation Change: 20e03ef7ba066deebe1a76a1bedc5c249d9e20c4 Author: Naveed Massjouni Date : 2012-02-07 22:09:31 +0000 Cleaning up dist.ini Change: 0e3ae43385ea6e6b1aa58bc459b852074184c646 Author: David Precious Date : 2012-02-07 21:51:12 +0000 Add myself to authors (even though I've mostly only done doc improvements so far...) Change: 70be79e5451ddb65ee62360f5f0ff2dff6c4e1c9 Author: David Precious Date : 2012-02-07 21:50:36 +0000 Include GH issues in META.yml resources too Change: e6d5392031371f1063aa549844c69ae4048ba9b0 Author: David Precious Date : 2012-02-07 21:43:07 +0000 Add GitHub URLs to meta.yml It's useful for canonical repo to be listed on MetaCPAN Change: b77284cedf2a8b3beb6290b9378b5912056d3edb Author: David Precious Date : 2012-02-07 21:38:01 +0000 Typo fix Change: 6eef227aa8f333f3e8bdb25f63ab6f17d22bf8e1 Author: David Precious Date : 2012-02-07 21:35:42 +0000 Some typo fixes and improving the synopsis examples Change: 0697504336929a26266e5962b121c0648379d6b0 Author: David Precious Date : 2012-02-07 21:27:23 +0000 Typo in config file example Change: 5ee60afb11a43f5eb8ae2d254b7c47230db94e5e Author: David Precious Date : 2012-02-07 21:26:13 +0000 Keyboarding fail. Change: 7727042dfbecfa28c4c38ab09943a31329851e36 Author: David Precious Date : 2012-02-07 21:23:47 +0000 Strongly discourage dynamic schema introspection Change: 802d718f90a707255074caf5f813e8de493e939f Author: Naveed Massjouni Date : 2010-11-24 12:34:22 +0000 Updating authors, removing tabs and changed Prereq to Prereqs. Change: 30665b94fdfb5c4fbd48ba4b9a0c46946bc8e660 Author: Al Newkirk Date : 2010-10-23 23:30:01 +0000 manually unlink test dbs Change: 2986d2d65ee765cf9bd0832dbceefd1089f9f2ee Author: Al Newkirk Date : 2010-10-23 23:05:33 +0000 fixed test for windows compatibility Change: 127f1266d6a0df8e4a1065b3dfaa5b42f2ff0a53 Author: Naveed Massjouni Date : 2010-10-23 22:32:37 +0000 Updating tests to use tempfile instead of tempdir. Also some minor cleanup. Change: 41036cf91bc00e6c2e171167b5a505dd0c1fd58f Author: Al Newkirk Date : 2010-10-23 20:51:31 +0000 removed unlinks Change: 9cf2981f072ce37ff315f65d73eb0c94cb631ccf Author: Al Newkirk Date : 2010-10-23 20:22:11 +0000 Merge branch 'master' of git://github.com/alnewkirk/Dancer-Plugin-DBIC Change: edcdb12454b7b77650369956261a900119ede57a Author: Al Newkirk Date : 2010-10-23 20:21:19 +0000 new version, POD update, tests fail Change: dc17f97f26864a90d9f9aad0ba832c058ed0e869 Author: Naveed Massjouni Date : 2010-10-23 19:14:45 +0000 Merge branch 'master' of github.com:alnewkirk/Dancer-Plugin-DBIC Change: 904531c4f2c94a46a7c6601f0f79fd4a13e10d92 Author: franck cuny Date : 2010-10-23 15:00:30 +0000 add simple TestApp to test with Dancer Change: e8466f7bec40c119f162f1d7d8f1efd13656c977 Author: franck cuny Date : 2010-10-23 15:00:12 +0000 use File::Spec and File::Temp for temp. db Change: 85942ba4a199db88bfacf58d05e288d697d403df Author: franck cuny Date : 2010-10-23 14:59:51 +0000 update .gitignore Change: f8c6106dba97bd91109d1cdff53eea6c89c8702e Author: Naveed Massjouni Date : 2010-10-22 01:52:08 +0000 Updating version. Change: 1206fed0773d8b68d1880446cfbec948b96ff97a Author: Naveed Massjouni Date : 2010-10-22 01:48:50 +0000 The setup in the tests no longer need to be in BEGIN blocks. Thanks to sukria's idea of not calling plugin_setting() at compile time. Change: 32ddee89133e1c44dec3e8f92176b8e2e6351e71 Author: Alexis Sukrieh Date : 2010-10-19 18:42:59 +0000 FIX for Dancer::Test Change: 4623f97cfa6e328054e54c8027d11c87c13c97d5 Author: unknown Date : 2010-10-17 04:30:04 +0000 new version Change: 2a29b4e6d320085f347a8c66d86bc443018827d4 Author: unknown Date : 2010-10-12 04:44:24 +0000 new version Change: 142002882d5052741b5ff81f9d0bd6a8a112e211 Author: Naveed Massjouni Date : 2010-10-12 03:40:27 +0000 Fixed a bug where schema was reloaded unnecessarily when schema() is invoked with no arguments. Now we will use cached schema if it is available. Change: 652a782d2eb723a4b8b8c7f76dba66527e312b72 Author: Naveed Massjouni Date : 2010-10-09 19:13:21 +0000 Updating README. Change: fb3fe7dbdebe380c4d0db5ce5ca402d9c3b5cbed Author: Naveed Massjouni Date : 2010-10-09 19:11:05 +0000 Updating documentation to describe 'schema' function and new usage. Change: e5dfe24aafed0a34ac4aa38e6da723ba51a80a12 Author: Naveed Massjouni Date : 2010-10-09 17:47:52 +0000 Handle the case where a schema that isn't configured is requested. Change: 84c11b14c534996d5f5c2869c77020926beacd60 Author: Naveed Massjouni Date : 2010-10-09 17:21:47 +0000 Added 01-single-schema.t for testing simplest usage, where only 1 schema is configured. Also there is no reason to define routes in the test, so I removed those. Change: 226f155d4df05f3b12a33446b8878a92dfccb509 Author: Naveed Massjouni Date : 2010-10-09 16:49:39 +0000 Renaming test files. Change: 4b52d79c83a28992dc1b9bfb9a522894c71f6ac5 Author: Naveed Massjouni Date : 2010-10-09 16:46:27 +0000 Plugin now registers exactly one keyword, schema. This works more like the Database plugin, which exports just the keyword database. So usage now is: schema->resultset('Users')->find($id) or schema('foo')->resultset('Users')->find($id) Change: 47a5fc78b6c5faee62ccf32b7b827b61963f8910 Author: Naveed Massjouni Date : 2010-10-09 02:22:39 +0000 Fixed warning in tests about redefining 'pass'. Change: f3630e7119a43697b7c94195b0f2cc3b2bc83146 Author: Naveed Massjouni Date : 2010-10-06 20:01:35 +0000 Updating version info. Change: 05f9a80e44a5d30c97e32076edfdac0ffabff618 Author: Naveed Massjouni Date : 2010-10-06 20:00:24 +0000 Minor pod edit in SYNOPSIS. Change: e84749351fff769bb04942dc7bb21dc730a5b9a5 Author: Naveed Massjouni Date : 2010-10-06 16:40:21 +0000 Added tests for multiple schemas. Change: febd2f426c69ea80f701ee6af854d75ee8e69378 Author: Naveed Massjouni Date : 2010-10-06 07:36:57 +0000 Capture db connection info in a more succint way. Change: eeda87362ad6ff475cc3b82683c058f1120aae58 Author: Naveed Massjouni Date : 2010-10-06 07:30:23 +0000 Adding tests for actual DBIC classes. Change: c076e5bed3843c6597d5d4c2012acc0ac3020389 Author: Naveed Massjouni Date : 2010-10-06 03:18:57 +0000 Removing auto_load option from tests. It is implied when schema_class is not provided. Change: 519e37016a5b2d31b782eb2765a8446826b554f1 Author: Naveed Massjouni Date : 2010-10-06 02:54:15 +0000 Making example in README nicer. Change: 70557240fe8720619fe3998ea8c4a6e9f0b80943 Author: Naveed Massjouni Date : 2010-10-06 02:51:10 +0000 Updating DESCRIPTION pod. Change: 2d7751a82779b93636ba6a9213e064e47b0cac3a Author: Naveed Massjouni Date : 2010-10-06 02:27:30 +0000 Making example in SYNOPSIS pod nicer. Change: b00f081d7d775fa225fba6ed2e819d63f7fc9409 Author: Naveed Massjouni Date : 2010-10-06 02:18:55 +0000 Cleaning up POD and README. Change: 98ca5f2512cf14a6903f26bae45dd2f1266cb4ad Author: Naveed Massjouni Date : 2010-10-06 02:09:53 +0000 Auto loading will now happen if a schema_class option is not provided. Change: f1e65d3282a9a1e8b13ef2e2d2852808e6dfd2f5 Author: Naveed Massjouni Date : 2010-10-05 23:35:35 +0000 Changed 'generate' config param to 'auto_load'. Updated tests to reflect that. Change: c08d144537f7520dbbfac0e578666d7d39eb076b Author: Naveed Massjouni Date : 2010-10-05 23:11:17 +0000 pckg config param is renamed to schema_class. Cleaned up code as well. Change: 66a73d284d3daa456477449e155bd2c8bf6698f7 Author: Naveed Massjouni Date : 2010-10-04 18:53:02 +0000 Initial check in of some basic tests. Got tests passing. Change: 789ecf25ae720391aa996795b07b621b0367d6fc Author: Naveed Massjouni Date : 2010-10-04 16:47:34 +0000 Revert "Adding Makefile.PL. Adding version and abstract to main module." This reverts commit 240eee073c3aa29579b4b7de64da4229f93ce1b4. Change: 240eee073c3aa29579b4b7de64da4229f93ce1b4 Author: Naveed Massjouni Date : 2010-10-04 15:57:22 +0000 Adding Makefile.PL. Adding version and abstract to main module. Change: 853c2e1069f534f710b4a82b7da3bf9f8f9c7ed1 Author: Al Newkirk Date : 2010-10-03 13:22:23 +0000 new version Change: 6cda2da35e7666c6c92290650bdc1d10a61fb4ea Author: Al Newkirk Date : 2010-10-03 13:19:46 +0000 added better connection definition thanks to franckcuny Change: 4355d3b1422e06a56f884ecd385538a630e9cff1 Author: unknown Date : 2010-10-02 15:28:58 +0000 new version, reverse auto-gen policy Change: 3a71fc305917aec09f04a806b6d05b90a4adaf99 Author: unknown Date : 2010-09-11 00:07:51 +0000 updated gitignore Change: 8a404f90b2dc156d70a6e630fae5c76ba21eb9c3 Author: unknown Date : 2010-09-11 00:06:56 +0000 added skip_automake for classes with existing schemas, now only calls connect once Change: 7e7ea606462aaee44346ca82990881c34c0fdb94 Author: unknown Date : 2010-09-05 20:34:13 +0000 updated README Change: 373175eab1bb2aac0bcf870ac4bdee5edf3ba1c5 Author: unknown Date : 2010-09-05 19:48:49 +0000 fixed dist.ini Change: fb8c47e91d6a8249c88b53eb5d26d2d3083c580d Author: unknown Date : 2010-09-05 19:43:21 +0000 initial commit ================ End of releases. ================ META.yml100644001750001750 202012620110470 16133 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104--- abstract: 'DBIx::Class interface for Dancer applications' author: - 'Al Newkirk ' - 'Naveed Massjouni ' build_requires: DBD::SQLite: 0 DBI: 0 DBIx::Class::Core: 0 DBIx::Class::Schema: 0 Dancer: 1.3098 Dancer::Test: 0 File::Spec: 0 File::Temp: 0 IO::Handle: 0 IPC::Open3: 0 Module::Load::Conditional: 0 Test::Exception: 0 Test::More: 0 Test::Requires: 0 base: 0 lib: 0 perl: 5.006 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.037, CPAN::Meta::Converter version 2.142690' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Dancer-Plugin-DBIC recommends: DBIx::Class::Schema::Loader: 0.07002 requires: DBICx::Sugar: 0 Dancer: 1.3098 Dancer::Plugin: 0 strict: 0 utf8: 0 warnings: 0 resources: bugtracker: https://github.com/ironcamel/Dancer-Plugin-DBIC/issues repository: git://github.com/ironcamel/Dancer-Plugin-DBIC.git version: 0.2104 MANIFEST100644001750001750 55212620110470 16003 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.037. CHANGES LICENSE MANIFEST META.yml Makefile.PL README dist.ini lib/Dancer/Plugin/DBIC.pm t/00-compile.t t/01-single-schema.t t/02-multiple-schemas.t t/03-dynamic-schemas.t t/04-testapp.t t/05-schema-aliases.t t/06-replicated.t t/lib/Foo.pm t/lib/Foo/Result/User.pm t/lib/TestApp.pm dist.ini100644001750001750 170512620110470 16337 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104name = Dancer-Plugin-DBIC author = Al Newkirk author = Naveed Massjouni license = Perl_5 copyright_holder = awncorp copyright_year = 2010 version = 0.2104 [@Filter] -bundle = @Basic -remove = GatherDir -remove = Readme [AutoPrereqs] [ChangelogFromGit] max_age = 3650 [CopyFilesFromBuild] copy = Makefile.PL [GatherDir] exclude_filename = Makefile.PL [MetaResources] bugtracker.web = https://github.com/ironcamel/Dancer-Plugin-DBIC/issues repository.type = git repository.url = git://github.com/ironcamel/Dancer-Plugin-DBIC.git repository.web = https://github.com/ironcamel/Dancer-Plugin-DBIC [OurPkgVersion] [Prereqs] Dancer = 1.3098 DBICx::Sugar = 0 [Prereqs / RuntimeRecommends] DBIx::Class::Schema::Loader = 0.07002 [PodWeaver] [ReadmeAnyFromPod / ReadmePodInRoot] type = markdown filename = README.md location = root [ReadmeFromPod] [Test::Compile] Makefile.PL100644001750001750 377612620110470 16657 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.037. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "DBIx::Class interface for Dancer applications", "AUTHOR" => "Al Newkirk , Naveed Massjouni ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Dancer-Plugin-DBIC", "EXE_FILES" => [], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "Dancer::Plugin::DBIC", "PREREQ_PM" => { "DBICx::Sugar" => 0, "Dancer" => "1.3098", "Dancer::Plugin" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "DBD::SQLite" => 0, "DBI" => 0, "DBIx::Class::Core" => 0, "DBIx::Class::Schema" => 0, "Dancer" => "1.3098", "Dancer::Test" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Load::Conditional" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Requires" => 0, "base" => 0, "lib" => 0 }, "VERSION" => "0.2104", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "DBD::SQLite" => 0, "DBI" => 0, "DBICx::Sugar" => 0, "DBIx::Class::Core" => 0, "DBIx::Class::Schema" => 0, "Dancer" => "1.3098", "Dancer::Plugin" => 0, "Dancer::Test" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Load::Conditional" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Requires" => 0, "base" => 0, "lib" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); lib000755001750001750 012620110470 15541 5ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tFoo.pm100644001750001750 15212620110470 16740 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/t/libpackage Foo; use base 'DBIx::Class::Schema'; use strict; use warnings; __PACKAGE__->load_namespaces; 1; t000755001750001750 012620110470 14773 5ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.210404-testapp.t100644001750001750 220712620110470 17222 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse Test::More; use lib 't/lib'; use Dancer::Test apps => [ 't::lib::TestApp' ]; use Dancer::Plugin::DBIC qw(rset schema); use Dancer qw(:syntax :tests); use t::lib::TestApp; eval { require DBD::SQLite }; plan skip_all => 'DBD::SQLite required to run these tests' if $@; set plugins => { DBIC => { foo => { schema_class => 'Foo', dsn => 'dbi:SQLite:dbname=:memory:', }, } }; schema->deploy; ok rset('User')->create({ name => 'sukria' }); ok rset('User')->create({ name => 'bigpresh' }); response_status_is [ GET => '/' ], 200, "GET / is found"; response_content_like [ GET => '/' ], qr/2/, "content looks good for /"; response_status_is [ GET => '/user/sukria' ], 200, 'GET /user/sukria is found'; response_content_like [ GET => '/user/sukria' ], qr/sukria/, 'content looks good for /user/sukria'; response_content_like [ GET => '/user/bigpresh' ], qr/bigpresh/, "content looks good for /user/bigpresh"; response_status_is [ DELETE => '/user/bigpresh' ], 200, 'DELETE /user/bigpresh is ok'; response_content_like [ GET => '/' ], qr/1/, 'content looks good for /'; done_testing; 00-compile.t100644001750001750 212612620110470 17166 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Dancer/Plugin/DBIC.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; TestApp.pm100644001750001750 43612620110470 17602 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/t/libpackage t::lib::TestApp; use Dancer; use Dancer::Plugin::DBIC qw(rset); get '/' => sub { rset('User')->count }; get '/user/:name' => sub { rset('User')->find( param 'name' )->name }; del '/user/:name' => sub { rset('User')->find( param 'name' )->delete; return 'ok'; }; 1; 06-replicated.t100644001750001750 431412620110470 17661 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse Test::More; use lib 't/lib'; use Module::Load::Conditional qw(can_load); use Dancer::Plugin::DBIC qw(schema rset); use File::Temp qw(tempfile); use Dancer qw(:syntax set); use DBI; my $reqs = { 'DBD::SQLite' => 0, 'Moose' => 0.98, 'MooseX::Types' => 0.21, 'MooseX::Types::LoadableClass' => 0.011, }; if ( can_load modules => $reqs ) { plan tests => 7; } else { plan skip_all => "required modules to run these tests are not available"; } my $dbfiles = [ (tempfile(SUFFIX => '.db'))[1], (tempfile(SUFFIX => '.db'))[1], (tempfile(SUFFIX => '.db'))[1] ]; my $dbhandlers = [ DBI->connect("dbi:SQLite:dbname=$dbfiles->[1]"), DBI->connect("dbi:SQLite:dbname=$dbfiles->[2]") ]; ok $dbhandlers->[0]->do('create table user (name varchar(100) primary key, age int)'); ok $dbhandlers->[1]->do('create table user (name varchar(100) primary key, age int)'); $dbhandlers->[0]->do('insert into user values(?,?)', {}, 'bob', 20); $dbhandlers->[1]->do('insert into user values(?,?)', {}, 'bob', 30); set plugins => { DBIC => { default => { dsn => "dbi:SQLite:dbname=$dbfiles->[0]", schema_class => 'Foo', replicated => { balancer_type => '::Random', replicants => [ [ "dbi:SQLite:dbname=$dbfiles->[1]" ], [ "dbi:SQLite:dbname=$dbfiles->[2]" ], ], }, }, }, }; schema->deploy; # add a 10 year old bob to master ok rset('User')->create({ name => 'bob', age => 10 }); # should find an older bob from one of the replicants is rset('User')->count({ name => 'bob', age => { '>=', 20 } }), 1, 'found older bob in one of the replicants'; # now force the query to use the master db, which has the 10 year old bob is rset('User')->count({ name => 'bob', age => 10 }, {force_pool => 'master'}), 1, 'found the 30 year old bob in the master db'; my %set = (); for (1 .. 100) { my $bob = rset('User')->single({ name => 'bob' }); $set{$bob->age}++; } is keys %set => 2, 'random balancer accessed both replicants' or diag explain \%set; ok $set{20} && $set{30}; unlink @$dbfiles; 01-single-schema.t100644001750001750 211012620110470 20247 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse Test::More tests => 4; use lib 't/lib'; use Dancer qw(:syntax :tests); use Dancer::Plugin::DBIC; use Test::Exception; eval { require DBD::SQLite }; plan skip_all => 'DBD::SQLite required to run these tests' if $@; set plugins => { DBIC => { foo => { schema_class => 'Foo', dsn => 'dbi:SQLite:dbname=:memory:', }, } }; schema->deploy; ok rset('User')->create({ name => 'bob', age => 2 }); subtest 'schema' => sub { my $user = schema->resultset('User')->find('bob'); is $user->age => '2', 'bob is a baby'; $user = schema('foo')->resultset('User')->find('bob'); is $user->age => '2', 'found Bob via explicit schema name'; }; subtest 'resultset' => sub { my $user = resultset('User')->find('bob'); is $user->age => '2', 'found bob via resultset'; $user = rset('User')->find('bob'); is $user->age => '2', 'found bob via rset'; }; subtest 'invalid schema name' => sub { throws_ok { schema('bar')->resultset('User')->find('bob') } qr/schema bar is not configured/, 'missing schema error thrown'; }; 05-schema-aliases.t100644001750001750 210712620110470 20421 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse Test::More tests => 4; use lib 't/lib'; use Dancer::Plugin::DBIC qw(rset schema); use Dancer qw(:syntax :tests); use Test::Exception; eval { require DBD::SQLite }; plan skip_all => 'DBD::SQLite required to run these tests' if $@; set plugins => { DBIC => { default => { schema_class => 'Foo', dsn => 'dbi:SQLite:dbname=:memory:', }, foo => { alias => 'default', }, badalias => { alias => 'zzz', }, } }; schema->deploy; ok rset('User')->create({ name => 'bob', age => 30 }); subtest 'default schema' => sub { ok my $user = rset('User')->find('bob'), 'found bob'; is $user->age => '30', 'bob is getting old'; }; subtest 'schema alias' => sub { ok my $user = schema('foo')->resultset('User')->find('bob'), 'found bob'; is $user->age => '30', 'bob is still old'; }; subtest 'bad alias' => sub { throws_ok { schema('badalias')->resultset('User')->find('bob') } qr/schema alias zzz does not exist in the config/, 'got bad alias error'; }; 03-dynamic-schemas.t100644001750001750 166112620110470 20611 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/t# Test dynamic schema loading by not providing a schema_class config option. # These tests require DBIx::Class::Schema::Loader to be installed use strict; use warnings; use Test::More tests => 3; use Dancer qw(:syntax !pass); use Dancer::Plugin::DBIC; use DBI; use File::Temp qw(tempfile); use Test::Requires qw( DBD::SQLite DBIx::Class::Schema::Loader ); my (undef, $dbfile) = tempfile SUFFIX => '.db'; set plugins => { DBIC => { foo => { dsn => "dbi:SQLite:dbname=$dbfile", } } }; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile"); ok $dbh->do(q{ create table user (name varchar(100) primary key, age int) }), 'Created sqlite test db.'; my @users = ( ['bob', 40] ); for my $user (@users) { $dbh->do('insert into user values(?,?)', {}, @$user) } my $user = schema('foo')->resultset('User')->find('bob'); ok $user, 'Found bob.'; is $user->age => '40', 'bob is even older'; unlink $dbfile; 02-multiple-schemas.t100644001750001750 405112620110470 21013 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/tuse Test::More tests => 2; use lib 't/lib'; use Dancer qw(:syntax set); use Dancer::Plugin::DBIC qw(schema); use File::Temp qw(tempfile); use Test::Exception; eval { require DBD::SQLite }; plan skip_all => 'DBD::SQLite required to run these tests' if $@; # tempfile() returns a file handler + a filename. # We're only interested in storing the filename. my $dbfiles = [ (tempfile(SUFFIX => '.db'))[1], (tempfile(SUFFIX => '.db'))[1] ]; subtest 'two schemas' => sub { set plugins => { DBIC => { foo => { schema_class => 'Foo', dsn => "dbi:SQLite:dbname=$dbfiles->[0]", }, bar => { schema_class => 'Foo', dsn => "dbi:SQLite:dbname=$dbfiles->[1]", }, } }; schema('foo')->deploy; ok schema('foo')->resultset('User')->create({ name => 'bob', age => 30 }); schema('bar')->deploy; ok schema('bar')->resultset('User')->create({ name => 'sue', age => 20 }); my $user = schema('foo')->resultset('User')->find('bob'); ok $user, 'found bob'; is $user->age => '30', 'bob is getting old'; $user = schema('bar')->resultset('User')->find('sue'); ok $user, 'found sue'; is $user->age => '20', 'sue is the right age'; throws_ok { schema('poo')->resultset('User')->find('bob') } qr/schema poo is not configured/, 'Missing schema error thrown'; throws_ok { schema->resultset('User')->find('bob') } qr/The schema default is not configured/, 'Missing default schema error thrown'; }; subtest 'two schemas with a default schema' => sub { set plugins => { DBIC => { default => { schema_class => 'Foo', dsn => "dbi:SQLite:dbname=$dbfiles->[0]", }, bar => { schema_class => 'Foo', dsn => "dbi:SQLite:dbname=$dbfiles->[1]", }, } }; ok my $bob = schema->resultset('User')->find('bob'), 'found bob'; is $bob->age => 30; }; unlink @$dbfiles; Result000755001750001750 012620110470 17542 5ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/t/lib/FooUser.pm100644001750001750 46012620110470 21136 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/t/lib/Foo/Resultpackage Foo::Result::User; use base 'DBIx::Class::Core'; use strict; use warnings; __PACKAGE__->table("user"); __PACKAGE__->add_columns( name => { data_type => "varchar", is_nullable => 0, size => 100 }, age => { data_type => "int", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("name"); 1; Plugin000755001750001750 012620110470 17730 5ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/lib/DancerDBIC.pm100644001750001750 1756012620110470 21160 0ustar00naveednaveed000000000000Dancer-Plugin-DBIC-0.2104/lib/Dancer/Pluginpackage Dancer::Plugin::DBIC; our $VERSION = '0.2104'; # VERSION use strict; use warnings; use utf8; use Dancer::Plugin; use DBICx::Sugar; sub _schema { my ($name) = @_; DBICx::Sugar::config( plugin_setting ); return DBICx::Sugar::schema($name); }; sub _rset { my ($rset_name) = @_; return _schema()->resultset($rset_name); } register schema => \&_schema; register resultset => \&_rset; register rset => \&_rset; register_plugin; # ABSTRACT: DBIx::Class interface for Dancer applications 1; __END__ =pod =encoding UTF-8 =head1 NAME Dancer::Plugin::DBIC - DBIx::Class interface for Dancer applications =head1 VERSION version 0.2104 =head1 SYNOPSIS use Dancer; use Dancer::Plugin::DBIC qw(schema resultset rset); get '/users/:user_id' => sub { my $user_id = param 'user_id'; my $user; # all of the following are equivalent: $user = schema('default')->resultset('User')->find($user_id); $user = schema->resultset('User')->find($user_id); $user = resultset('User')->find($user_id); $user = rset('User')->find($user_id); template user_profile => { user => $user }; }; dance; =head1 DESCRIPTION This plugin makes it very easy to create L applications that interface with databases. It automatically exports the keyword C which returns a L object. You just need to configure your database connection information. For performance, schema objects are cached in memory and are lazy loaded the first time they are accessed. This plugin is now just a thin wrapper around L. =head1 CONFIGURATION Configuration can be done in your L config file. =head2 simple example Here is a simple example. It defines one database named C: plugins: DBIC: default: dsn: dbi:SQLite:dbname=myapp.db schema_class: MyApp::Schema =head2 multiple schemas In this example, there are 2 databases configured named C and C: plugins: DBIC: default: dsn: dbi:SQLite:dbname=myapp.db schema_class: MyApp::Schema foo: dsn: dbi:Pg:dbname=foo schema_class: Foo::Schema user: bob password: secret options: RaiseError: 1 PrintError: 1 Each database configured must at least have a dsn option. The dsn option should be the L driver connection string. All other options are optional. If you only have one schema configured, or one of them is named C, you can call C without an argument to get the only or C schema, respectively. If a schema_class option is not provided, then L will be used to dynamically load the schema by introspecting the database corresponding to the dsn value. You need L installed for this to work. WARNING: Dynamic loading is not recommended for production environments. It is almost always better to provide a schema_class option. The schema_class option should be the name of your L class. See L Optionally, a database configuration may have user, password, and options parameters as described in the documentation for C in L. =head2 connect_info Alternatively, you may also declare your connection information inside an array named C: plugins: DBIC: default: schema_class: MyApp::Schema connect_info: - dbi:Pg:dbname=foo - bob - secret - RaiseError: 1 PrintError: 1 =head2 replicated You can also add database read slaves to your configuration with the C config option. This will automatically make your read queries go to a slave and your write queries go to the master. Keep in mind that this will require additional dependencies: L See L for more details. Here is an example configuration that adds two read slaves: plugins: DBIC: default: schema_class: MyApp::Schema dsn: dbi:Pg:dbname=master replicated: balancer_type: ::Random # optional balancer_args: # optional auto_validate_every: 5 # optional master_read_weight:1 # optional # pool_type and pool_args are also allowed and are also optional replicants: - - dbi:Pg:dbname=slave1 - user1 - password1 - quote_names: 1 pg_enable_utf8: 1 - - dbi:Pg:dbname=slave2 - user2 - password2 - quote_names: 1 pg_enable_utf8: 1 =head2 alias Schema aliases allow you to reference the same underlying database by multiple names. For example: plugins: DBIC: default: dsn: dbi:Pg:dbname=master schema_class: MyApp::Schema slave1: alias: default Now you can access the default schema with C, C, or C. This can come in handy if, for example, you have master/slave replication in your production environment but only a single database in your development environment. You can continue to reference C in your code in both environments by simply creating a schema alias in your development.yml config file, as shown above. =head1 FUNCTIONS =head2 schema my $user = schema->resultset('User')->find('bob'); The C keyword returns a L object ready for you to use. If you have configured only one database, then you can simply call C with no arguments. If you have configured multiple databases, you can still call C with no arguments if there is a database named C in the configuration. With no argument, the C schema is returned. Otherwise, you B provide C with the name of the database: my $user = schema('foo')->resultset('User')->find('bob'); =head2 resultset This is a convenience method that will save you some typing. Use this B when accessing the C schema. my $user = resultset('User')->find('bob'); is equivalent to: my $user = schema->resultset('User')->find('bob'); =head2 rset my $user = rset('User')->find('bob'); This is simply an alias for C. =head1 SCHEMA GENERATION Setting the schema_class option and having proper DBIx::Class classes is the recommended approach for performance and stability. You can use the L command line tool provided by L to help you. For example, if your app were named Foo, then you could run the following from the root of your project directory: dbicdump -o dump_directory=./lib Foo::Schema dbi:SQLite:/path/to/foo.db For this example, your C setting would be C<'Foo::Schema'>. =head1 SEE ALSO =over 4 =item * L =back =head1 CONTRIBUTORS =over 4 =item * Alexis Sukrieh =item * Dagfinn Ilmari Mannsåker > =item * David Precious =item * Fabrice Gabolde > =item * Franck Cuny =item * Steven Humphrey > =item * Yanick Champoux > =back =head1 AUTHORS =over 4 =item * Al Newkirk =item * Naveed Massjouni =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by awncorp. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut