APPENDIX A Compiling Your Own Perl Compiling Perl on a Unix-like system is simple. First, obtain the source for Perl from CPAN (dppl6++_l]j*lanh*knc+on_+NA=@IA*dpih). Then input the following sequence of commands: p]nvtrblanh)1*4*4*p]n*cv _`lanh)1*4*4 od?kjbecqna)`ao i]ga i]gapaop oq`ki]gaejop]hh On most Unix systems, this code will result in your lanh being installed into the +qon+ hk_]h+ directory tree. If you want it installed elsewhere—for example, in the local directory in your home directory—then replace od?kjbecqna)`a with the following: od?kjbecqna)`ao)@lnabet9z+hk_]h+ which should enable you to install Perl on your computer without root access. Note that the )`ao flag uses all the default options for compiling Perl. If you know that you want nonstandard configuration, just use the flag )`a instead to be prompted for your requirements. Be aware that the source for Perl 5.10.0 requires a patch to work properly with Catalyst. This is fixed in subsequent versions of Perl 5.10. If you need to test code guaranteed to run on a wide range of systems, you should con- sider using Perl version 5.8.7. Perl versions greater than 5.8.7 contain features that were not available in earlier versions of Perl, so Perl 5.8.7 is feature complete for all versions of Perl that Catalyst will run on (version 5.8.1 and later). Put another way, versions 5.8.8 and later have new features that you can’t rely on in earlier releases. This should only be important to you if you’re going to be programming libraries for CPAN that will be used very heavily, and you’re having to pay very close attention to Perl’s internals. Further details for installation of Perl are available in the EJOP=HH file in the Perl distribu- tion. If you are on a non-Unix system and you want to compile Perl, you will want to look at EJOP=HH*ukqnlh]pbkni (e.g., EJOP=HH*s/. for Windows) as well. However, for Windows we rec- ommend Strawberry Perl (dppl6++opn]s^annulanh*_ki). 315 316 APPENDIX A N COMPILING YOUR OWN PERL Once you’ve compiled Perl, you need to make sure that your L=PD environment variable is set. Assuming you installed Perl into +hk_]h, you need to put +hk_]h+^ej in your path. The best way of doing this (assuming that your shell is Bash) is to put the following in your *^]odn_: atlknpL=PD9 DKIA+hk_]h+^ej6 L=PD atlknpI=JL=PD9 DKIA+hk_]h+i]j6 I=JL=PD Issue the command a_dk ODAHH and ensure that the output is +^ej+^]od or at that it at least ends in +^]od to make sure that you’re using the Bash shell. Once you’ve done this, you need to either log off and then log in again or issue the follow- ing command from the shell: okqn_a*^]odn_ Patching Perl 5.10.0 to Work (Properly) with Catalyst Details on how to fix this issue are described here: dppl6++sss*jjpl*lanh*knc+cnkql+lanh* lanh1*_d]jcao+.,,4+,.+ioc.--,2*dpih. Condensing the instructions from this bug report, you should download Perl 5.10 (dppl6++ sss*_l]j*knc+on_+lanh)1*-,*,*p]n*cv). Prior to following the instructions in the main part of this appendix, modify the file pkga*_ (pklharah) on line 692 as follows (presented in diff for- mat): ahoa l]noan):jatppkga9,7 aj`eb 'l]noan):annkn[_kqjp9kl]noan;kl]noan):annkn[_kqjp6,7 l]noan):_klheja9JKHEJA7 l]noan):hat[op]pa9HAT[JKNI=H7 l]noan):atla_p9TOP=PA7 APPENDIX B Making Your Own CPAN Mirror with CPAN::Mini or minicpan.sh Catalyst is very heavy on CPAN dependencies, so it can be useful to have your own CPAN mirror on your local machine or local network. Using CPAN::Mini, especially on a slow net- work, speeds downloading of CPAN modules dramatically and is recommended for anyone doing a lot of Perl development. CPAN::Mini is available by installing it from CPAN. An alternative is ieje_l]j*od, which is available from dppl6++pnkqp*ia*qg+lanh+iennkn*od*ptp. We’ll describe using CPAN::Mini here. The advantage of the ieje_l]j*od script is that you can uncomment a single line and get a full CPAN mirror. ieje_l]j*od is also a good bit faster than CPAN::Mini. First, install CPAN::Mini from the shell: _l]j?L=J66Ieje Next, create a *ieje_l]jn_ file in your home directory with the following content: hk_]h6+l]pd+pk+ukqn+_l]j+iennkn naikpa6dppl6++ukqn*_hkoaop*_l]j*iennkn at]_p[iennkn6- Then you can run the ieje_l]j command from your shell: ieje_l]j The first command installs CPAN::Mini, and the second makes a mirror of the fairly com- plete contents of the most relevant parts of the CPAN archive. Once this is done, you can configure CPAN to use your local mirror: _l]j _l]j:k_kjboapqnhheopbeha6+++dkia+g`+ieje_l]j+ _l]j:k_kjb_kiiep 317 318 APPENDIX B N MAKING YOUR OWN CPAN MIRROR WITH CPAN::MINI OR MINICPAN.SH Note that you need to use the absolute path to the ieje_l]j directory in your home direc- tory as just shown. You can update your mirror at any time by reissuing the ieje_l]j command. As noted, it’s best to have this as an automated job running daily. Browsing Your minicpan on the Web You can install the module CPAN::Mini::Webserver from CPAN to provide a web interface to browse your current ieje_l]j. Once the module is installed, you just run the command ieje_l]j[sa^oanran from the shell, and then point your browser to dppl6++hk_]hdkop6.52/ (although the port is configurable). From here, you can make your ieje_l]j and web server accessible over the local network so that small groups can use the local mirror. Index Numbers and Symbols ActionClass attribute, 237 502 (bad gateway) response code, 227 creating to serialize the stash to the re- & (ampersand), parameters separated by, 26 sponse body, 240 \ (backslash) character, for breaking long line action classes, as type of Catalyst::Controllers, of shell command, 29 237 + (plus) symbol, in code, 239 ActionClass('REST') attribute, 225 *:Args, using, 106 action for, 171 *:CaptureArgs(0), 98 actions */error_404 action, 99 adding new to application, 238 */name/who/add, calling to update database in Reaction UI, 307 of residents, 185 of Interface Model, 306 *:PathPart, 98 add_unique_constraint, adding unique in- $c->authenticate call, adding additional argu- dexes to, 143 ment to, 287 all_from directive, in default Makefile.PL file, $c->authenticate() call, altering to reflect new 57 requirements, 205 ALTER TABLE statement, running to update $c->check_any_user_role() method, example table in SQLite database, 146 using, 192 ampersand (&), parameters separated by, 26 $c->check_user_roles() method, example AnnoCPAN, website address, 45 using, 192 Apache $c->detach, demonstrating use of with code, external configuration, 120 178 modules that deal with FastCGI, 119 $c->forward, demonstrating use of with code, static configuration, 119 178 using as a back end to front-end proxy, 125 $c->go, flow control logic for, 180–181 Apache::Registry, 12 $c->logout() method, calling to de-authenti- Apache web server, 115–116 cate a user, 206 load balancing, 115 $c->model('Textile')->textile method, calling website address for obtaining, 115 from controller code, 242 API access, within your application, 285 $c->push stack() helper method, adding to API authorization, persistent login and, application, 182–183 281–285 $c->req->args, overriding values of for a for- App::Ack (CPAN), installing, 128, 129 ward or detach, 179–180 Apple, Perl in OS X 10.3 and later, 22 $c->textile method, adding into MyApp, 242 application $c->user_exists() call, 207 adding authentication for web portion of, $c->user() method, returning current user 74–75 with, 207 adding new features to, 97 $c->visit, flow control logic for, 180–181 as pure UI, 82 $self->next::method(@_) call, 239 extending, 96–102 $userid value, validation, 156 getting started writing, 59–60 normal approach to designing, 82–83 A requiring authentication for, 79 running first code from a test, 83 ab tool, in Apache, 123 running parts of as stand-alone script, ACCEPT_CONTEXT method, 254–255 277–278 access_denied action application example, in Reaction, 308 adding to lib/SneakyCat/Controller/Ideas. apply_label argument, in Reaction Root con- pm, 213 troller, 313 Acme::EyeDrops, output during installation Apress, website address, 195 of, 130 Arguments, in create scripts documentation, Acme::LOLCAT module, required in default 139–140 Makefile.PL file, 58 319 320 NINDEX attributes base controllers adding more than one new, 240–241 adding multiple, 234 adding to controller actions, 237–241 in Catalyst, 233–234 cleaning up multiple with roles, 241 intelligent use of, 272–274 Auth::Schema argument, in create scripts Bash aliases, to make starting development documentation, 140 server easier, 299–300 Auth::Schema::Result::UserRoles, 144 begin action, uncommenting in each control- Auth::Schema::Result::Users class, adding ler, 174 code to for checking validity of e-mail, BEGIN block, using in controllers, 241 153 begin dispatch type, 171 AuthDB argument, in create scripts documen- belongs_to relationship, arguments to, 144 tation, 139 blib, 132 auth.db database file, 138 blocking server, built-in server as, 111 authdb.sql, updating to add column to users browsers, quickly resolving compatibility is- table, 146 sues, 255–258 authenticated user, working with, 216–218 browsing your Minicpan on the web, 318 authentication BSD, Catalyst needs preinstalled on, 22 adding for web portion of application, bug tracker, open source CPAN RT service, 45 74–75 BUILDARGS subroutine, in Moose, 42 and authorization, 189–218 _build_greeting subroutine, 34 function of authenticate call, 205–206 _build_schema method, 224 requiring for the whole application, 79 BUILD subroutine, in Moose, 42 requiring for web services requests
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-