
CYAN YELLOW MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’S VOICE® IN WEB DEVELOPMENT Companion This is an incredibly eBook Available useful book. I’ve been using Catalyst The Definitive Guide to Catalyst: The Definitive in production longer Writing Extensible, Scalable, and Maintainable Perl-Based Web Applications than anyone else, but I’ve still learned Dear Reader, dozens of ways I Guide to can improve my We wrote this book because we’re both impressed with Catalyst’s flexibility. Its code. The amount of goal is not just to make the first five minutes of web programming easy and The Definitive Guide to information on every productive, but also to ensure that things are just as quick six months into your aspect of Catalyst project. This is achieved with a “don’t repeat yourself” philosophy. Kieren finds programming, major Catalyst an excellent environment in which to write code for analysis and pre- and minor, is just sentation of research data. Matt’s experience is more typical, although most Catalyst amazing. web developers don’t need to work with teams writing applications expected to process 10 million requests per day. Jesse Sheidlower, In this book, you can expect to build on Catalyst basics toward a develop- Editor at Large, Oxford ment process that emphasizes extensibility and maintainability. You will learn English Dictionary, and Catalyst Core Team how to use Catalyst with databases, how to perform user access control, how to member use the Catalyst dispatcher to the fullest extent, and how to deploy your appli- cation to a live web server. For more advanced topics, we cover producing and Catalyst consuming REST-based web services and extending Catalyst’s internals, and we briefly outline the Reaction component UI framework, which is built on top of Catalyst. Finally, the book has a “cookbook” chapter containing a range of recipes for common tasks as well as development hints and tips. Writing Extensible, Scalable, and With a little familiarity with Perl, you’ll find Catalyst an excellent framework for writing well-structured, readable, and maintainable code for use on the Web. Maintainable Perl-Based Web Applications Kieren Diment and Matt S Trout THE APRESS ROADMAP Write well-structured, readable, and maintainable Perl for use on the Web. Pro Perl Companion eBook Beginning Perl The Definitive Guide to Catalyst See last page for details on $10 eBook version Diment, ISBN 978-1-4302-2365-8 Trout and SOURCE CODE ONLINE 9 0 0 0 0 Kieren Diment Matt S Trout www.apress.com with Eden Cardim, Jay Kuri, and Jess Robinson Shelve in Foreword by Marcus Ramberg, Perl Catalyst Release Manager User level: 9 781430 223658 Intermediate–Advanced this print for content only—size & color not accurate spine = 0.831" 360 page count Download at Boykma.Com The Definitive Guide to Catalyst Writing Extensible, Scalable, and Maintainable Perl-Based Web Applications Kieren Diment and Matt S Trout with Eden Cardim, Jay Kuri, and Jess Robinson Download at Boykma.Com 23658fm.indd 1 6/19/09 10:58:58 AM The Definitive Guide to Catalyst: Writing Extensible, Scalable, and Maintainable Perl-Based Web Applications Copyright © 2009 by Kieren Diment and Matt S Trout All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2365-8 ISBN-13 (electronic): 978-1-4302-2366-5 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Duncan Parkes Technical Reviewer: Jacinta Richardson Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Denise Santoro Lincoln Copy Editor: Nicole Flores Associate Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Patrick Cunningham Proofreader: April Eddy Indexer: Carol Burbo Artist: April Milne Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www. apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precau- tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indi- rectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. Download at Boykma.Com 23658fm.indd 2 6/19/09 10:58:58 AM For Lorna, Freya, and Hunter Download at Boykma.Com 23658fm.indd 3 6/19/09 10:58:58 AM Download at Boykma.Com 23658fm.indd 4 6/19/09 10:58:58 AM Contents at a Glance Foreword ........................................................................xv About the Authors ............................................................... xix About the Technical Reviewer . xxi Acknowledgments ...............................................................xxiii Introduction .................................................................... xxv CHAPTER 1 Introducing the Catalyst Web Application Framework ............ 1 CHAPTER 2 Catalyst Setup and Background Knowledge .................... 19 CHAPTER 3 Your First Catalyst Application ................................. 53 CHAPTER 4 Extending LolCatalyst-Lite ......................................81 CHAPTER 5 Deployment ...................................................109 CHAPTER 6 Database Models ..............................................135 CHAPTER 7 The Catalyst Dispatcher ...................................... 167 CHAPTER 8 Authentication and Authorization ..............................189 CHAPTER 9 Interacting with Web Services in Your Applications ............ 219 CHAPTER 10 Extending Catalyst ........................................... 233 CHAPTER 11 Catalyst Cookbook ........................................... 247 CHAPTER 12 The Reaction Component UI Framework ........................303 APPENDIX A Compiling Your Own Perl ..................................... 315 APPENDIX B Making Your Own CPAN Mirror with CPAN::Mini or minicpan.sh ................................317 INDEX ...................................................................... 319 v Download at Boykma.Com 23658fm.indd 5 6/19/09 10:58:58 AM Download at Boykma.Com 23658fm.indd 6 6/19/09 10:58:58 AM Contents Foreword ........................................................................xv About the Authors ............................................................... xix About the Technical Reviewer . xxi Acknowledgments ...............................................................xxiii Introduction .................................................................... xxv CHAPTER 1 Introducing the Catalyst Web Application Framework ... 1 Catalyst’s Usage and History .......................................2 The Model/View/Controller Pattern ..................................2 URL Path Dispatch Logic ......................................6 High-Level Session Management ............................. 7 Authentication and Authorization ............................. 7 Logging ................................................... 7 Templates ................................................. 8 Testing .....................................................8 Deployment .................................................8 Catalyst vs. CGI ................................................. 9 Introducing Persistence FastCGI ............................. 12 mod_perl ..................................................12 Catalyst vs. Other Frameworks ....................................13 URI Routing via External File vs. Self-Contained Controllers ..... 13 Catalyst vs. CGI::Application ..................................14 Catalyst vs. Jifty ............................................16 Summary .......................................................17 CHAPTER 2 Catalyst Setup and Background Knowledge ............. 19 Installing Catalyst ................................................19 Choosing Hardware and Software .............................19 Obtaining Perl ..............................................21 Setting Up CPAN .......................................... 23 Installation .................................................24
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages362 Page
-
File Size-