| 1 | package Catalyst::Helper::View::TTSimple; | ||
| 2 | |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use File::Spec; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Catalyst::Helper::View::TTSimple - Simplified TT layout for building web sites. | ||
| 10 | |||
| 11 | =cut | ||
| 12 | |||
| 13 | 2 | our $VERSION = '0.01'; | |
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use the helper to build the view module and associated templates. | ||
| 18 | |||
| 19 | $ script/myapp_create.pl view TT TTSimple | ||
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | This helper module creates a simple TT skeleton layout in your catalyst project. It goes further than Catalyst::Helper::View::TT and a bit less than Catalyst:Helper::View::TTSite in that it creates just the bare essentials to get you started. | ||
| 24 | |||
| 25 | =head2 What gets generated? | ||
| 26 | |||
| 27 | This creates a xhtml layout container, javascript directory, stylesheet directory and a TT index which would be encapsulated by the layout. If you have ever worked with Rails this should be very familiar to you. | ||
| 28 | |||
| 29 | project_root/ | ||
| 30 | root/ | ||
| 31 | site/ | ||
| 32 | layout (the xhtml layout) | ||
| 33 | wrapper (wraps content to layout) | ||
| 34 | config/ | ||
| 35 | main (main configuration processed before anything) | ||
| 36 | src/ | ||
| 37 | index.tt2 (encapsulated index file) | ||
| 38 | |||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | =head2 METHODS | ||
| 43 | |||
| 44 | =head3 mk_compclass | ||
| 45 | |||
| 46 | Generates the component class. | ||
| 47 | |||
| 48 | =head3 mk_templates | ||
| 49 | |||
| 50 | Generates the templates. | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 0 | ▶ | sub mk_compclass { |
|
Subroutine
mk_compclass: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | 0 | my ( $self, $helper, @args ) = @_; | |
| 56 | 0 | my $file = $helper->{file}; | |
| 57 | 0 | $helper->render_file( 'compclass', $file ); | |
| 58 | 0 | $self->mk_templates( $helper, @args ); | |
| 59 | } | ||
| 60 | |||
| 61 | 0 | ▶ | sub mk_templates { |
|
Subroutine
mk_templates: not called CC=2 SCAR=17.9
Pod
documented
| |||
| 62 | 0 | my ($self,$helper)=@_; | |
| 63 | |||
| 64 | 0 | my $base = $helper->{base}; | |
| 65 | 0 | my $stdir = File::Spec->catfile($base, 'root', 'static' , 'stylesheets'); | |
| 66 | 0 | my $jtdir = File::Spec->catfile($base, 'root', 'static' , 'javascripts'); | |
| 67 | 0 | my $idir = File::Spec->catfile($base,'root', 'static' , 'images'); | |
| 68 | 0 | my $ldir = File::Spec->catfile( $base, 'root', 'lib' ); | |
| 69 | 0 | my $sdir = File::Spec->catfile( $base, 'root', 'src' ); | |
| 70 | 0 | my $cdir = File::Spec->catfile( $ldir, 'config' ); | |
| 71 | 0 | my $sitedir = File::Spec->catfile( $ldir, 'site' ); | |
| 72 | |||
| 73 | 0 | $helper->mk_dir($ldir); | |
| 74 | 0 | $helper->mk_dir($sdir); | |
| 75 | 0 | $helper->mk_dir($stdir); | |
| 76 | 0 | $helper->mk_dir($jtdir); | |
| 77 | 0 | $helper->mk_dir($cdir); | |
| 78 | 0 | $helper->mk_dir($sitedir); | |
| 79 | |||
| 80 | 0 | $helper->render_file( "config_main", | |
| 81 | File::Spec->catfile( $cdir, "main" ) ); | ||
| 82 | |||
| 83 | 0 | foreach my $file (qw( wrapper layout )) { | |
| 84 | 0 | $helper->render_file( "site_$file", | |
| 85 | File::Spec->catfile( $sitedir, $file ) ); | ||
| 86 | } | ||
| 87 | |||
| 88 | 0 | $helper->mk_file(File::Spec->catfile($jtdir,'application.js'),''); | |
| 89 | 0 | $helper->mk_file(File::Spec->catfile($stdir,'master.css'),''); | |
| 90 | 0 | $helper->render_file("index.tt2", File::Spec->catfile($sdir,'index.tt2')); | |
| 91 | } | ||
| 92 | |||
| 93 | =head1 AUTHOR | ||
| 94 | |||
| 95 | Victor Igumnov, C<< <victori at lamer0.com> >> | ||
| 96 | |||
| 97 | =head1 BUGS | ||
| 98 | |||
| 99 | Please report any bugs or feature requests to | ||
| 100 | C<bug-catalyst-helper-view-ttsimple at rt.cpan.org>, or through the web interface at | ||
| 101 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Helper-View-TTSimple>. | ||
| 102 | I will be notified, and then you'll automatically be notified of progress on | ||
| 103 | your bug as I make changes. | ||
| 104 | |||
| 105 | =head1 SUPPORT | ||
| 106 | |||
| 107 | You can find documentation for this module with the perldoc command. | ||
| 108 | |||
| 109 | perldoc Catalyst::Helper::View::TTSimple | ||
| 110 | |||
| 111 | You can also look for information at: | ||
| 112 | |||
| 113 | =over 4 | ||
| 114 | |||
| 115 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 116 | |||
| 117 | L<http://annocpan.org/dist/Catalyst-Helper-View-TTSimple> | ||
| 118 | |||
| 119 | =item * CPAN Ratings | ||
| 120 | |||
| 121 | L<http://cpanratings.perl.org/d/Catalyst-Helper-View-TTSimple> | ||
| 122 | |||
| 123 | =item * RT: CPAN's request tracker | ||
| 124 | |||
| 125 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Helper-View-TTSimple> | ||
| 126 | |||
| 127 | =item * Search CPAN | ||
| 128 | |||
| 129 | L<http://search.cpan.org/dist/Catalyst-Helper-View-TTSimple> | ||
| 130 | |||
| 131 | =back | ||
| 132 | |||
| 133 | =head1 ACKNOWLEDGEMENTS | ||
| 134 | |||
| 135 | =head1 COPYRIGHT & LICENSE | ||
| 136 | |||
| 137 | Copyright 2006 Victor Igumnov, all rights reserved. | ||
| 138 | |||
| 139 | This program is free software; you can redistribute it and/or modify it | ||
| 140 | under the same terms as Perl itself. | ||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | |||
| 145 | 2 | 1; | |
| 146 | |||
| 147 | __DATA__ | ||