Changeset 12023
- Timestamp:
- 07/26/10 02:57:10 (19 months ago)
- Location:
- trunk/Padre-Plugin-Catalyst
- Files:
-
- 12 edited
-
. (modified) (1 prop)
-
Build.PL (modified) (1 diff)
-
README (modified) (1 diff)
-
lib/Padre/Plugin/Catalyst.pm (modified) (15 diffs)
-
lib/Padre/Plugin/Catalyst/Helper.pm (modified) (12 diffs)
-
lib/Padre/Plugin/Catalyst/NewApp.pm (modified) (11 diffs)
-
lib/Padre/Plugin/Catalyst/Outline.pm (modified) (7 diffs)
-
lib/Padre/Plugin/Catalyst/Panel.pm (modified) (3 diffs)
-
lib/Padre/Plugin/Catalyst/Util.pm (modified) (5 diffs)
-
lib/Padre/Wx/Menu/Catalyst.pm (modified) (3 diffs)
-
t/00-load.t (modified) (1 diff)
-
t/01-perl_interpreter.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre-Plugin-Catalyst
- Property svn:ignore
-
old new 3 3 _build 4 4 META.yml 5 MYMETA.yml 5 6 Makefile.PL 7 *.tar.gz
-
- Property svn:ignore
-
trunk/Padre-Plugin-Catalyst/Build.PL
r9598 r12023 14 14 15 15 my $builder = $class->new( 16 module_name=> 'Padre::Plugin::Catalyst',17 license=> 'perl',18 dist_author=> 'Breno G. de Oliveira <garu@cpan.org>',19 dist_version_from=> 'lib/Padre/Plugin/Catalyst.pm',20 dist_abstract=> 'Catalyst helper interface for Padre',21 configure_requires=> { 'Padre::PluginBuilder' => 0.12, },22 build_requires=> {23 'Test::More' => 0,24 'Module::Build' => 0.30,25 'Locale::Msgfmt' => 0.14,26 },27 requires => {28 'Padre'=> 0.51,29 'Catalyst::Devel'=> 1.0,30 'Catalyst::Runtime'=> 5.70,31 'Module::Pluggable::Object' => 3.9,32 'ExtUtils::Install'=> '1.52',33 },34 recommends => {35 'Task::CatInABox'=> 0.03,36 'Task::Catalyst::Tutorial' => 0.06,37 },38 add_to_cleanup => [ 'Padre-Plugin-Catalyst-*'],39 create_makefile_pl => 'traditional',40 meta_merge=> {41 resources => {42 homepage => 'http://padre.perlide.org/',43 repository => 'http://svn.perlide.org/padre/trunk/Padre-Plugin-Catalyst/',44 }45 },16 module_name => 'Padre::Plugin::Catalyst', 17 license => 'perl', 18 dist_author => 'Breno G. de Oliveira <garu@cpan.org>', 19 dist_version_from => 'lib/Padre/Plugin/Catalyst.pm', 20 dist_abstract => 'Catalyst helper interface for Padre', 21 configure_requires => { 'Padre::PluginBuilder' => 0.12, }, 22 build_requires => { 23 'Test::More' => 0, 24 'Module::Build' => 0.30, 25 'Locale::Msgfmt' => 0.14, 26 }, 27 requires => { 28 'Padre' => 0.51, 29 'Catalyst::Devel' => 1.0, 30 'Catalyst::Runtime' => 5.70, 31 'Module::Pluggable::Object' => 3.9, 32 'ExtUtils::Install' => '1.52', 33 }, 34 recommends => { 35 'Task::CatInABox' => 0.03, 36 'Task::Catalyst::Tutorial' => 0.06, 37 }, 38 add_to_cleanup => ['Padre-Plugin-Catalyst-*'], 39 create_makefile_pl => 'traditional', 40 meta_merge => { 41 resources => { 42 homepage => 'http://padre.perlide.org/', 43 repository => 'http://svn.perlide.org/padre/trunk/Padre-Plugin-Catalyst/', 44 } 45 }, 46 46 ); 47 47 -
trunk/Padre-Plugin-Catalyst/README
r3423 r12023 1 1 Padre-Plugin-Catalyst 2 2 3 The README is used to introduce the module and provide instructions on 4 how to install the module, any machine dependencies it may have (for 5 example C compilers and installed libraries) and any other information 6 that should be provided before the module is installed. 7 8 A README file is required for CPAN modules since CPAN extracts the README 9 file from a module distribution so that people browsing the archive 10 can use it to get an idea of the module's uses. It is usually a good idea 11 to provide version information here so that people can decide whether 12 fixes for the module are worth downloading. 13 14 15 INSTALLATION 3 Catalyst helper interface for Padre 16 4 17 5 To install this module, run the following commands: -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst.pm
r11902 r12023 5 5 use strict; 6 6 7 use Padre::Util ('_T');7 use Padre::Util ('_T'); 8 8 use Padre::Perl; 9 9 … … 11 11 12 12 # The plugin name to show in the Plugin Manager and menus 13 sub plugin_name { 'Catalyst'}14 13 sub plugin_name {'Catalyst'} 14 15 15 # Declare the Padre interfaces this plugin uses 16 16 sub padre_interfaces { 17 'Padre::Plugin' => 0.43, 18 # 'Padre::Document::Perl' => 0.16, 19 # 'Padre::Wx::Main' => 0.16, 20 # 'Padre::DB' => 0.16, 17 'Padre::Plugin' => 0.43, 18 19 # 'Padre::Document::Perl' => 0.16, 20 # 'Padre::Wx::Main' => 0.16, 21 # 'Padre::DB' => 0.16, 21 22 } 22 23 23 24 sub plugin_icon { 24 my $icon = [ 25 '16 16 46 1' , ' c None' , '. c #D15C5C','+ c #E88888', '@ c #E10000',26 '# c #D03131' , '$ c #D26262', '% c #D26161','& c #E99F9F', '* c #EFACAC',27 '= c #EFADAD' , '- c #E79090', '; c #D14949','> c #D22727', ', c #E26666',28 '\' c #E26363', ') c #E26464', '! c #D42A2A','~ c #D40101', '{ c #D50B0B',29 '] c #D71313' , '^ c #D50C0C', '/ c #D40404','( c #D26767', '_ c #DF5353',30 ': c #E15B5B' , '< c #D95D5D', '[ c #D21313','} c #D30000', '| c #DA0000',31 '1 c #D90000' , '2 c #D31111', '3 c #D14646','4 c #DC1313', '5 c #EC0000',32 '6 c #E20000' , '7 c #F00000', '8 c #F20000','9 c #D33232', '0 c #D64646',33 'a c #D46969' , 'b c #D35555', 'c c #D23A3A','d c #E89090', 'e c #E98E8E',34 'f c #D60000' , 'g c #D70101', ' ',' . ',35 ' + ', ' @# ', ' ' ,' ',25 my $icon = [ 26 '16 16 46 1', ' c None', '. c #D15C5C', '+ c #E88888', '@ c #E10000', 27 '# c #D03131', '$ c #D26262', '% c #D26161', '& c #E99F9F', '* c #EFACAC', 28 '= c #EFADAD', '- c #E79090', '; c #D14949', '> c #D22727', ', c #E26666', 29 '\' c #E26363', ') c #E26464', '! c #D42A2A', '~ c #D40101', '{ c #D50B0B', 30 '] c #D71313', '^ c #D50C0C', '/ c #D40404', '( c #D26767', '_ c #DF5353', 31 ': c #E15B5B', '< c #D95D5D', '[ c #D21313', '} c #D30000', '| c #DA0000', 32 '1 c #D90000', '2 c #D31111', '3 c #D14646', '4 c #DC1313', '5 c #EC0000', 33 '6 c #E20000', '7 c #F00000', '8 c #F20000', '9 c #D33232', '0 c #D64646', 34 'a c #D46969', 'b c #D35555', 'c c #D23A3A', 'd c #E89090', 'e c #E98E8E', 35 'f c #D60000', 'g c #D70101', ' ', ' . ', 36 ' + ', ' @# ', ' ', ' ', 36 37 ' $% ', ' &*=-; ', ' >,\'\')! ', ' ~{]]^/ ', 37 '(_: < [}|1}2 ', '345 67869 ', ' 0a b c ', ' de',38 '(_: < [}|1}2 ', '345 67869 ', ' 0a b c ', ' de', 38 39 ' fg', ' ', 39 40 ]; 40 return Wx::Bitmap->newFromXPM( $icon);41 return Wx::Bitmap->newFromXPM($icon); 41 42 } 42 43 … … 59 60 60 61 sub menu_plugins { 61 my $self = shift; 62 my $main = shift; 63 64 # Create a simple menu with a single About entry 65 my $menu = Wx::Menu->new; 66 Wx::Event::EVT_MENU( 67 $main, 68 $menu->Append(-1, _T('New Catalyst Application')), 69 sub { 70 require Padre::Plugin::Catalyst::NewApp; 71 Padre::Plugin::Catalyst::NewApp::on_newapp(); 72 return; 73 }, 74 ); 75 my $menu_new = Wx::Menu->new; 76 $menu->Append(-1, _T('Create new...'), $menu_new); 77 Wx::Event::EVT_MENU( 78 $main, 79 $menu_new->Append(-1, _T('Model')), 80 sub { 81 require Padre::Plugin::Catalyst::Helper; 82 Padre::Plugin::Catalyst::Helper::on_create_model(); 83 }, 84 ); 85 Wx::Event::EVT_MENU( 86 $main, 87 $menu_new->Append(-1, _T('View')), 88 sub { 89 require Padre::Plugin::Catalyst::Helper; 90 Padre::Plugin::Catalyst::Helper::on_create_view(); 91 }, 92 ); 93 Wx::Event::EVT_MENU( 94 $main, 95 $menu_new->Append(-1, _T('Controller')), 96 sub { 97 require Padre::Plugin::Catalyst::Helper; 98 Padre::Plugin::Catalyst::Helper::on_create_controller(); 99 }, 100 ); 101 102 $menu->AppendSeparator; 103 Wx::Event::EVT_MENU( 104 $main, 105 $menu->Append(-1, _T('Start Web Server')), 106 sub { $self->on_start_server }, 107 ); 108 # when we start the plugin, the "stop web server" option 109 # is disabled. 110 my $stop_server_item = $menu->Append(-1, _T('Stop Web Server')); 111 Wx::Event::EVT_MENU( 112 $main, 113 $stop_server_item, 114 sub { $self->on_stop_server }, 115 ); 116 $stop_server_item->Enable(0); 117 118 $menu->AppendSeparator; 119 my $docs_menu = Wx::Menu->new; 120 $menu->Append(-1, _T('Catalyst Online References'), $docs_menu); 121 122 my $tutorial_menu = Wx::Menu->new; 123 $docs_menu->Append(-1, _T('Beginner\'s Tutorial'), $tutorial_menu); 124 Wx::Event::EVT_MENU( 125 $main, 126 $tutorial_menu->Append(-1, _T('Overview')), 127 sub { 128 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial'); 129 }, 130 ); 131 132 Wx::Event::EVT_MENU( 133 $main, 134 $tutorial_menu->Append(-1, _T('1. Introduction')), 135 sub { 136 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::01_Intro'); 137 }, 138 ); 139 Wx::Event::EVT_MENU( 140 $main, 141 $tutorial_menu->Append(-1, _T('2. Catalyst Basics')), 142 sub { 143 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::02_CatalystBasics'); 144 }, 145 ); 146 Wx::Event::EVT_MENU( 147 $main, 148 $tutorial_menu->Append(-1, _T('3. More Catalyst Basics')), 149 sub { 150 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::03_MoreCatalystBasics'); 151 }, 152 ); 153 Wx::Event::EVT_MENU( 154 $main, 155 $tutorial_menu->Append(-1, _T('4. Basic CRUD')), 156 sub { 157 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::04_BasicCRUD'); 158 }, 159 ); 160 Wx::Event::EVT_MENU( 161 $main, 162 $tutorial_menu->Append(-1, _T('5. Authentication')), 163 sub { 164 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::05_Authentication'); 165 }, 166 ); 167 Wx::Event::EVT_MENU( 168 $main, 169 $tutorial_menu->Append(-1, _T('6. Authorization')), 170 sub { 171 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::06_Authorization'); 172 }, 173 ); 174 Wx::Event::EVT_MENU( 175 $main, 176 $tutorial_menu->Append(-1, _T('7. Debugging')), 177 sub { 178 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::07_Debugging'); 179 }, 180 ); 181 Wx::Event::EVT_MENU( 182 $main, 183 $tutorial_menu->Append(-1, _T('8. Testing')), 184 sub { 185 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::08_Testing'); 186 }, 187 ); 188 Wx::Event::EVT_MENU( 189 $main, 190 $tutorial_menu->Append(-1, _T('9. Advanced CRUD')), 191 sub { 192 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::09_AdvancedCRUD'); 193 }, 194 ); 195 Wx::Event::EVT_MENU( 196 $main, 197 $tutorial_menu->Append(-1, _T('10. Appendices')), 198 sub { 199 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::10_Appendices'); 200 }, 201 ); 202 203 Wx::Event::EVT_MENU( 204 $main, 205 $docs_menu->Append(-1, _T('Catalyst Cookbook')), 206 sub { 207 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Cookbook'); 208 }, 209 ); 210 Wx::Event::EVT_MENU( 211 $main, 212 $docs_menu->Append(-1, _T('Recommended Plugins')), 213 sub { 214 Padre::Wx::launch_browser('http://dev.catalystframework.org/wiki/recommended_plugins'); 215 }, 216 ); 217 Wx::Event::EVT_MENU( 218 $main, 219 $docs_menu->Append(-1, _T('Catalyst Community Live Support')), 220 sub { 221 Padre::Wx::launch_irc( 'irc.perl.org' => 'catalyst' ); 222 }, 223 ); 224 225 Wx::Event::EVT_MENU( 226 $main, 227 $docs_menu->Append(-1, _T('Examples')), 228 sub { 229 Padre::Wx::launch_browser('http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/'); 230 }, 231 ); 232 233 Wx::Event::EVT_MENU( 234 $main, 235 $docs_menu->Append(-1, _T('Catalyst Wiki')), 236 sub { 237 Padre::Wx::launch_browser('http://dev.catalystframework.org/wiki/'); 238 }, 239 ); 240 Wx::Event::EVT_MENU( 241 $main, 242 $docs_menu->Append(-1, _T('Catalyst Website')), 243 sub { 244 Padre::Wx::launch_browser('http://www.catalystframework.org/'); 245 }, 246 ); 247 248 $menu->AppendSeparator; 249 Wx::Event::EVT_MENU( 250 $main, 251 $menu->Append(-1, _T('Update Application Scripts')), 252 sub { $self->on_update_script }, 253 ); 254 62 my $self = shift; 63 my $main = shift; 64 65 # Create a simple menu with a single About entry 66 my $menu = Wx::Menu->new; 67 Wx::Event::EVT_MENU( 68 $main, 69 $menu->Append( -1, _T('New Catalyst Application') ), 70 sub { 71 require Padre::Plugin::Catalyst::NewApp; 72 Padre::Plugin::Catalyst::NewApp::on_newapp(); 73 return; 74 }, 75 ); 76 my $menu_new = Wx::Menu->new; 77 $menu->Append( -1, _T('Create new...'), $menu_new ); 78 Wx::Event::EVT_MENU( 79 $main, 80 $menu_new->Append( -1, _T('Model') ), 81 sub { 82 require Padre::Plugin::Catalyst::Helper; 83 Padre::Plugin::Catalyst::Helper::on_create_model(); 84 }, 85 ); 86 Wx::Event::EVT_MENU( 87 $main, 88 $menu_new->Append( -1, _T('View') ), 89 sub { 90 require Padre::Plugin::Catalyst::Helper; 91 Padre::Plugin::Catalyst::Helper::on_create_view(); 92 }, 93 ); 94 Wx::Event::EVT_MENU( 95 $main, 96 $menu_new->Append( -1, _T('Controller') ), 97 sub { 98 require Padre::Plugin::Catalyst::Helper; 99 Padre::Plugin::Catalyst::Helper::on_create_controller(); 100 }, 101 ); 102 255 103 $menu->AppendSeparator; 256 104 Wx::Event::EVT_MENU( 257 $main, 258 $menu->Append(-1, _T('About')), 259 sub { $self->on_show_about }, 260 ); 261 262 # Return it and the label for our plug-in 263 return ( $self->plugin_name => $menu ); 264 265 #TODO: add status bar comment for each menu entry. 266 # look into Padre::Wx::Menu and wxWidgets for $item->SetHelp('foo') 105 $main, 106 $menu->Append( -1, _T('Start Web Server') ), 107 sub { $self->on_start_server }, 108 ); 109 110 # when we start the plugin, the "stop web server" option 111 # is disabled. 112 my $stop_server_item = $menu->Append( -1, _T('Stop Web Server') ); 113 Wx::Event::EVT_MENU( 114 $main, 115 $stop_server_item, 116 sub { $self->on_stop_server }, 117 ); 118 $stop_server_item->Enable(0); 119 120 $menu->AppendSeparator; 121 my $docs_menu = Wx::Menu->new; 122 $menu->Append( -1, _T('Catalyst Online References'), $docs_menu ); 123 124 my $tutorial_menu = Wx::Menu->new; 125 $docs_menu->Append( -1, _T('Beginner\'s Tutorial'), $tutorial_menu ); 126 Wx::Event::EVT_MENU( 127 $main, 128 $tutorial_menu->Append( -1, _T('Overview') ), 129 sub { 130 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial'); 131 }, 132 ); 133 134 Wx::Event::EVT_MENU( 135 $main, 136 $tutorial_menu->Append( -1, _T('1. Introduction') ), 137 sub { 138 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::01_Intro'); 139 }, 140 ); 141 Wx::Event::EVT_MENU( 142 $main, 143 $tutorial_menu->Append( -1, _T('2. Catalyst Basics') ), 144 sub { 145 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::02_CatalystBasics'); 146 }, 147 ); 148 Wx::Event::EVT_MENU( 149 $main, 150 $tutorial_menu->Append( -1, _T('3. More Catalyst Basics') ), 151 sub { 152 Padre::Wx::launch_browser( 153 'http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::03_MoreCatalystBasics'); 154 }, 155 ); 156 Wx::Event::EVT_MENU( 157 $main, 158 $tutorial_menu->Append( -1, _T('4. Basic CRUD') ), 159 sub { 160 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::04_BasicCRUD'); 161 }, 162 ); 163 Wx::Event::EVT_MENU( 164 $main, 165 $tutorial_menu->Append( -1, _T('5. Authentication') ), 166 sub { 167 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::05_Authentication'); 168 }, 169 ); 170 Wx::Event::EVT_MENU( 171 $main, 172 $tutorial_menu->Append( -1, _T('6. Authorization') ), 173 sub { 174 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::06_Authorization'); 175 }, 176 ); 177 Wx::Event::EVT_MENU( 178 $main, 179 $tutorial_menu->Append( -1, _T('7. Debugging') ), 180 sub { 181 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::07_Debugging'); 182 }, 183 ); 184 Wx::Event::EVT_MENU( 185 $main, 186 $tutorial_menu->Append( -1, _T('8. Testing') ), 187 sub { 188 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::08_Testing'); 189 }, 190 ); 191 Wx::Event::EVT_MENU( 192 $main, 193 $tutorial_menu->Append( -1, _T('9. Advanced CRUD') ), 194 sub { 195 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::09_AdvancedCRUD'); 196 }, 197 ); 198 Wx::Event::EVT_MENU( 199 $main, 200 $tutorial_menu->Append( -1, _T('10. Appendices') ), 201 sub { 202 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::10_Appendices'); 203 }, 204 ); 205 206 Wx::Event::EVT_MENU( 207 $main, 208 $docs_menu->Append( -1, _T('Catalyst Cookbook') ), 209 sub { 210 Padre::Wx::launch_browser('http://search.cpan.org/perldoc?Catalyst::Manual::Cookbook'); 211 }, 212 ); 213 Wx::Event::EVT_MENU( 214 $main, 215 $docs_menu->Append( -1, _T('Recommended Plugins') ), 216 sub { 217 Padre::Wx::launch_browser('http://dev.catalystframework.org/wiki/recommended_plugins'); 218 }, 219 ); 220 Wx::Event::EVT_MENU( 221 $main, 222 $docs_menu->Append( -1, _T('Catalyst Community Live Support') ), 223 sub { 224 Padre::Wx::launch_irc( 'irc.perl.org' => 'catalyst' ); 225 }, 226 ); 227 228 Wx::Event::EVT_MENU( 229 $main, 230 $docs_menu->Append( -1, _T('Examples') ), 231 sub { 232 Padre::Wx::launch_browser('http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/'); 233 }, 234 ); 235 236 Wx::Event::EVT_MENU( 237 $main, 238 $docs_menu->Append( -1, _T('Catalyst Wiki') ), 239 sub { 240 Padre::Wx::launch_browser('http://dev.catalystframework.org/wiki/'); 241 }, 242 ); 243 Wx::Event::EVT_MENU( 244 $main, 245 $docs_menu->Append( -1, _T('Catalyst Website') ), 246 sub { 247 Padre::Wx::launch_browser('http://www.catalystframework.org/'); 248 }, 249 ); 250 251 $menu->AppendSeparator; 252 Wx::Event::EVT_MENU( 253 $main, 254 $menu->Append( -1, _T('Update Application Scripts') ), 255 sub { $self->on_update_script }, 256 ); 257 258 $menu->AppendSeparator; 259 Wx::Event::EVT_MENU( 260 $main, 261 $menu->Append( -1, _T('About') ), 262 sub { $self->on_show_about }, 263 ); 264 265 # Return it and the label for our plug-in 266 return ( $self->plugin_name => $menu ); 267 268 #TODO: add status bar comment for each menu entry. 269 # look into Padre::Wx::Menu and wxWidgets for $item->SetHelp('foo') 267 270 } 268 271 269 272 270 273 sub event_on_context_menu { 271 my ($self, $document, $editor, $menu, $event) = (@_);272 274 my ( $self, $document, $editor, $menu, $event ) = (@_); 275 273 276 my $pos; 274 277 if ( $event->isa("Wx::MouseEvent") ) { … … 284 287 285 288 # Fall back to the cursor position if necessary 286 $pos = $editor->GetCurrentPos() unless ($pos); 287 288 my $template = _get_template($editor, $pos); 289 if ($template) { 290 $menu->AppendSeparator; 291 my $item = $menu->Append( -1, 292 sprintf(_T("Open Template '%s'"), $template), 293 ); 294 Wx::Event::EVT_MENU( 295 $self->main, 296 $item, 297 sub { \&_open_template(shift, $template) }, 298 ); 299 } 300 289 $pos = $editor->GetCurrentPos() unless ($pos); 290 291 my $template = _get_template( $editor, $pos ); 292 if ($template) { 293 $menu->AppendSeparator; 294 my $item = $menu->Append( 295 -1, 296 sprintf( _T("Open Template '%s'"), $template ), 297 ); 298 Wx::Event::EVT_MENU( 299 $self->main, 300 $item, 301 sub { \&_open_template( shift, $template ) }, 302 ); 303 } 304 301 305 } 302 306 303 307 sub _open_template { 304 my ($main, $template) = (@_); 305 306 require File::Spec; 307 require File::Find; 308 require Padre::Plugin::Catalyst::Util; 309 310 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 311 my $template_dir = File::Spec->catdir( $project_dir, 'root' ); 312 313 my @files; 314 File::Find::find( 315 sub { 316 if($File::Find::name =~ /$template$/ ) { 317 push @files, $File::Find::name; 318 } 319 }, $template_dir 320 ); 321 322 unless (@files) { 323 Wx::MessageBox( 324 sprintf(_T("Template '%s' not found in '%s'"), 325 $template, $template_dir 326 ), _T('Error'), Wx::wxOK, $main); 327 } 328 329 # if we get over one result, we default to the 330 # shortest path 331 my $file = shift @files; 332 foreach (@files) { 333 $file = $_ if length($file) > length($_); 334 } 335 $main->setup_editors($file); 308 my ( $main, $template ) = (@_); 309 310 require File::Spec; 311 require File::Find; 312 require Padre::Plugin::Catalyst::Util; 313 314 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 315 my $template_dir = File::Spec->catdir( $project_dir, 'root' ); 316 317 my @files; 318 File::Find::find( 319 sub { 320 if ( $File::Find::name =~ /$template$/ ) { 321 push @files, $File::Find::name; 322 } 323 }, 324 $template_dir 325 ); 326 327 unless (@files) { 328 Wx::MessageBox( 329 sprintf( 330 _T("Template '%s' not found in '%s'"), 331 $template, $template_dir 332 ), 333 _T('Error'), 334 Wx::wxOK, $main 335 ); 336 } 337 338 # if we get over one result, we default to the 339 # shortest path 340 my $file = shift @files; 341 foreach (@files) { 342 $file = $_ if length($file) > length($_); 343 } 344 $main->setup_editors($file); 336 345 } 337 346 338 347 sub _get_template { 339 my ($editor, $pos) = (@_);340 341 my $line= $editor->LineFromPosition($pos);342 my $line_start = $editor->PositionFromLine($line);348 my ( $editor, $pos ) = (@_); 349 350 my $line = $editor->LineFromPosition($pos); 351 my $line_start = $editor->PositionFromLine($line); 343 352 my $line_end = $editor->GetLineEndPosition($line); 344 353 my $cursor_col = $pos - $line_start; 345 354 my $line_content = $editor->GetTextRange( $line_start, $line_end ); 346 355 347 356 #TODO: improve template detection 348 if ( $line_content =~ /([\/\w]+\.tt\d?)/ ) {349 return $1;357 if ( $line_content =~ /([\/\w]+\.tt\d?)/ ) { 358 return $1; 350 359 } 351 360 } 352 361 353 362 sub on_update_script { 354 my $main = Padre->ide->wx->main;363 my $main = Padre->ide->wx->main; 355 364 356 365 require File::Spec; 357 366 require Padre::Plugin::Catalyst::Util; 358 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return;359 360 my @dir = File::Spec->splitdir($project_dir);367 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 368 369 my @dir = File::Spec->splitdir($project_dir); 361 370 my $project = $dir[-1]; 362 371 $project =~ s{-}{::}g; 363 372 364 # go to the selected file's PARENT directory365 # (so we can run catalyst.pl on the project dir)373 # go to the selected file's PARENT directory 374 # (so we can run catalyst.pl on the project dir) 366 375 my $pwd = Cwd::cwd(); 367 376 chdir $project_dir; 368 377 chdir File::Spec->updir; 369 378 370 $main->run_command("catalyst.pl -force -scripts $project");371 372 # restore current dir373 chdir $pwd; 379 $main->run_command("catalyst.pl -force -scripts $project"); 380 381 # restore current dir 382 chdir $pwd; 374 383 } 375 384 376 385 sub on_start_server { 377 my $self = shift;378 379 #TODO FIXME: if the user closed the panel,380 # how do we know? and how do we show it again?381 # as it is, Padre crashes :(386 my $self = shift; 387 388 #TODO FIXME: if the user closed the panel, 389 # how do we know? and how do we show it again? 390 # as it is, Padre crashes :( 382 391 #Padre::Current->main->bottom->show($self->panel); 383 384 my $main = Padre->ide->wx->main;385 392 393 my $main = Padre->ide->wx->main; 394 386 395 require File::Spec; 387 396 require Padre::Plugin::Catalyst::Util; 388 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return;397 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 389 398 390 399 my $server_filename = Padre::Plugin::Catalyst::Util::get_catalyst_project_name($project_dir); 391 392 $server_filename .= '_server.pl'; 393 394 my $server_full_path = File::Spec->catfile($project_dir, 'script', $server_filename ); 395 if(! -e $server_full_path) { 396 Wx::MessageBox( 397 sprintf(_T("Catalyst development web server not found at\n%s\n\nPlease make sure the active document is from your Catalyst project."), 398 $server_full_path 399 ), 400 _T('Server not found'), Wx::wxOK, $main 401 ); 402 return; 403 } 404 405 # go to the selected file's directory 406 # (catalyst instructs us to always run their scripts 407 # from the basedir) 400 401 $server_filename .= '_server.pl'; 402 403 my $server_full_path = File::Spec->catfile( $project_dir, 'script', $server_filename ); 404 if ( !-e $server_full_path ) { 405 Wx::MessageBox( 406 sprintf( 407 _T( "Catalyst development web server not found at\n%s\n\nPlease make sure the active document is from your Catalyst project." 408 ), 409 $server_full_path 410 ), 411 _T('Server not found'), 412 Wx::wxOK, $main 413 ); 414 return; 415 } 416 417 # go to the selected file's directory 418 # (catalyst instructs us to always run their scripts 419 # from the basedir) 408 420 my $pwd = Cwd::cwd(); 409 421 chdir $project_dir; 410 422 411 my $perl = Padre::Perl->perl;412 my $command = "$perl " . File::Spec->catfile('script', $server_filename);413 $command .= ' -r ' if $self->panel->{checkbox}->IsChecked;414 415 #$main->run_command($command); 416 # somewhat the same as $main->run_command,417 # but in our very own panel, and with our own rigs418 $self->run_command($command);419 420 # restore current dir421 chdir $pwd;422 423 # handle menu graying424 Padre::Plugin::Catalyst::Util::toggle_server_menu(0);425 $self->panel->toggle_panel(0);426 427 # TODO: actually check whether this is true.428 my $ret = Wx::MessageBox(423 my $perl = Padre::Perl->perl; 424 my $command = "$perl " . File::Spec->catfile( 'script', $server_filename ); 425 $command .= ' -r ' if $self->panel->{checkbox}->IsChecked; 426 427 #$main->run_command($command); 428 # somewhat the same as $main->run_command, 429 # but in our very own panel, and with our own rigs 430 $self->run_command($command); 431 432 # restore current dir 433 chdir $pwd; 434 435 # handle menu graying 436 Padre::Plugin::Catalyst::Util::toggle_server_menu(0); 437 $self->panel->toggle_panel(0); 438 439 # TODO: actually check whether this is true. 440 my $ret = Wx::MessageBox( 429 441 _T('Web server appears to be running. Launch web browser now?'), 430 442 _T('Start Web Browser?'), 431 Wx::wxYES_NO |Wx::wxCENTRE,443 Wx::wxYES_NO | Wx::wxCENTRE, 432 444 $main, 433 445 ); 434 446 if ( $ret == Wx::wxYES ) { 435 Padre::Wx::launch_browser('http://localhost:3000');436 }437 438 return;447 Padre::Wx::launch_browser('http://localhost:3000'); 448 } 449 450 return; 439 451 } 440 452 … … 442 454 ### run_command() adapted from Padre::Wx::Main's version 443 455 sub run_command { 444 my ($self, $command)= (@_);445 446 # clear the panel447 $self->panel->output->Remove( 0, $self->panel->output->GetLastPosition );448 449 # If this is the first time a command has been run,456 my ( $self, $command ) = (@_); 457 458 # clear the panel 459 $self->panel->output->Remove( 0, $self->panel->output->GetLastPosition ); 460 461 # If this is the first time a command has been run, 450 462 # set up the ProcessStream bindings. 451 463 unless ($Wx::Perl::ProcessStream::VERSION) { … … 454 466 $self->main->error( 455 467 sprintf( 456 _T( 457 'Wx::Perl::ProcessStream is version %s' 468 _T( 'Wx::Perl::ProcessStream is version %s' 458 469 . ' which is known to cause problems. Get at least 0.20 by typing' 459 470 . "\ncpan Wx::Perl::ProcessStream" … … 469 480 sub { 470 481 $_[1]->Skip(1); 471 my $outpanel = $_[0]; #->{panel};482 my $outpanel = $_[0]; #->{panel}; 472 483 $outpanel->style_good; 473 484 $outpanel->AppendText( $_[1]->GetLine . "\n" ); … … 479 490 sub { 480 491 $_[1]->Skip(1); 481 my $outpanel = $_[0]; #->{panel};492 my $outpanel = $_[0]; #->{panel}; 482 493 $outpanel->style_neutral; 483 494 $outpanel->AppendText( $_[1]->GetLine . "\n" ); … … 497 508 498 509 # Start the command 499 my $process = Wx::Perl::ProcessStream::Process->new( 500 $command,501 "Run $command",502 $self->panel->output503 );510 my $process = Wx::Perl::ProcessStream::Process->new( 511 $command, 512 "Run $command", 513 $self->panel->output 514 ); 504 515 $self->{server} = $process->Run; 505 516 … … 512 523 _T("Error"), Wx::wxOK, $self 513 524 ); 514 # $self->menu->run->enable; 525 526 # $self->menu->run->enable; 515 527 } 516 528 … … 519 531 520 532 sub on_stop_server { 521 my $self = shift;522 523 #TODO FIXME: if the user closed the panel,524 # how do we know? and how do we show it again?525 # as it is, Padre crashes :(533 my $self = shift; 534 535 #TODO FIXME: if the user closed the panel, 536 # how do we know? and how do we show it again? 537 # as it is, Padre crashes :( 526 538 #Padre::Current->main->bottom->show($self->panel); 527 539 528 540 if ( $self->{server} ) { 529 541 my $processid = $self->{server}->GetProcessId(); 530 kill(9, $processid); 542 kill( 9, $processid ); 543 531 544 #$self->{server}->TerminateProcess; 532 545 } 533 546 delete $self->{server}; 534 547 535 $self->panel->output->AppendText( "\n" . _T('Web server stopped successfully.') . "\n");536 537 # handle menu graying538 require Padre::Plugin::Catalyst::Util;539 Padre::Plugin::Catalyst::Util::toggle_server_menu(1);540 $self->panel->toggle_panel(1);548 $self->panel->output->AppendText( "\n" . _T('Web server stopped successfully.') . "\n" ); 549 550 # handle menu graying 551 require Padre::Plugin::Catalyst::Util; 552 Padre::Plugin::Catalyst::Util::toggle_server_menu(1); 553 $self->panel->toggle_panel(1); 541 554 542 555 return; 543 556 } 544 557 545 sub on_show_about { 558 sub on_show_about { 546 559 require Catalyst; 547 560 require Class::Unload; … … 549 562 $about->SetName("Padre::Plugin::Catalyst"); 550 563 $about->SetDescription( _T('Catalyst support for Padre') . "\n\n" 551 . _T('This system is running Catalyst version') . " $Catalyst::VERSION\n"552 );553 $about->SetVersion( $VERSION);554 Class::Unload->unload('Catalyst');555 556 Wx::AboutBox( $about);564 . _T('This system is running Catalyst version') 565 . " $Catalyst::VERSION\n" ); 566 $about->SetVersion($VERSION); 567 Class::Unload->unload('Catalyst'); 568 569 Wx::AboutBox($about); 557 570 return; 558 571 } 559 572 560 573 sub plugin_enable { 561 my $self = shift;562 563 require Padre::Plugin::Catalyst::Panel;564 $self->{panel} = Padre::Plugin::Catalyst::Panel->new($self);565 566 Padre::Current->main->bottom->show($self->{panel});567 568 # load Catalyst main menu569 $self->editor_changed;570 571 # TODO: Please uncomment this to test the Catalyst side-panel572 # require Padre::Plugin::Catalyst::Outline;573 # $self->{outline} = Padre::Plugin::Catalyst::Outline->new($self);574 my $self = shift; 575 576 require Padre::Plugin::Catalyst::Panel; 577 $self->{panel} = Padre::Plugin::Catalyst::Panel->new($self); 578 579 Padre::Current->main->bottom->show( $self->{panel} ); 580 581 # load Catalyst main menu 582 $self->editor_changed; 583 584 # TODO: Please uncomment this to test the Catalyst side-panel 585 # require Padre::Plugin::Catalyst::Outline; 586 # $self->{outline} = Padre::Plugin::Catalyst::Outline->new($self); 574 587 575 588 } … … 578 591 579 592 sub plugin_disable { 580 my $self = shift; 581 # $self->panel->Destroy; 582 Padre::Current->main->bottom->hide($self->{panel}); 583 $self->on_stop_server; 584 585 586 # cleanup loaded classes 587 require Class::Unload; 588 Class::Unload->unload('Padre::Plugin::Catalyst::NewApp'); 589 Class::Unload->unload('Padre::Plugin::Catalyst::Helper'); 590 Class::Unload->unload('Padre::Plugin::Catalyst::Util'); 591 Class::Unload->unload('Padre::Plugin::Catalyst::Panel'); 592 Class::Unload->unload('Catalyst'); 593 my $self = shift; 594 595 # $self->panel->Destroy; 596 Padre::Current->main->bottom->hide( $self->{panel} ); 597 $self->on_stop_server; 598 599 600 # cleanup loaded classes 601 require Class::Unload; 602 Class::Unload->unload('Padre::Plugin::Catalyst::NewApp'); 603 Class::Unload->unload('Padre::Plugin::Catalyst::Helper'); 604 Class::Unload->unload('Padre::Plugin::Catalyst::Util'); 605 Class::Unload->unload('Padre::Plugin::Catalyst::Panel'); 606 Class::Unload->unload('Catalyst'); 593 607 } 594 608 595 609 # FIXME: Padre does *NOT* seem to call this if a document is closed. 596 610 sub editor_changed { 597 my $self = shift; 598 my $document = $self->main->current->document || return $self->enable(0); 599 600 #$document->{menu} = [] if (!defined($document->{menu})) or (ref($document->{menu}) ne 'ARRAY'); 601 #$document->{menu} = [grep (!/^menu\.Catalyst$/,@{$document->{menu}}) ]; 602 603 # when not inside a catalyst project, disable stuff 604 my $toggle = 0; 605 require Padre::Plugin::Catalyst::Util; 606 if (Padre::Plugin::Catalyst::Util::in_catalyst_project($document->filename)) { 607 608 # enable Catalyst main menu 609 #push @{$document->{menu}}, 'menu.Catalyst'; 610 $toggle = 1; 611 } 612 # enable/disable Catalyst panel and menu entries 613 $self->enable($toggle); 611 my $self = shift; 612 my $document = $self->main->current->document || return $self->enable(0); 613 614 #$document->{menu} = [] if (!defined($document->{menu})) or (ref($document->{menu}) ne 'ARRAY'); 615 #$document->{menu} = [grep (!/^menu\.Catalyst$/,@{$document->{menu}}) ]; 616 617 # when not inside a catalyst project, disable stuff 618 my $toggle = 0; 619 require Padre::Plugin::Catalyst::Util; 620 if ( Padre::Plugin::Catalyst::Util::in_catalyst_project( $document->filename ) ) { 621 622 # enable Catalyst main menu 623 #push @{$document->{menu}}, 'menu.Catalyst'; 624 $toggle = 1; 625 } 626 627 # enable/disable Catalyst panel and menu entries 628 $self->enable($toggle); 614 629 } 615 630 … … 617 632 # is **NOT** part of a Catalyst project 618 633 sub enable { 619 my ($self, $toggle) = (@_);620 my $is_server_on = (defined $self->{server} ? 1 : 0);621 622 # freeze menu entries623 # FIXME: this isn't working during startup624 require Padre::Plugin::Catalyst::Util;625 Padre::Plugin::Catalyst::Util::toggle_menu_items($toggle, $is_server_on);626 627 # freeze the panel628 $self->panel->{button}->Enable($toggle);629 unless ($is_server_on) {630 $self->panel->{checkbox}->Enable($toggle);631 }634 my ( $self, $toggle ) = (@_); 635 my $is_server_on = ( defined $self->{server} ? 1 : 0 ); 636 637 # freeze menu entries 638 # FIXME: this isn't working during startup 639 require Padre::Plugin::Catalyst::Util; 640 Padre::Plugin::Catalyst::Util::toggle_menu_items( $toggle, $is_server_on ); 641 642 # freeze the panel 643 $self->panel->{button}->Enable($toggle); 644 unless ($is_server_on) { 645 $self->panel->{checkbox}->Enable($toggle); 646 } 632 647 } 633 648 … … 635 650 42; 636 651 __END__ 652 637 653 =head1 NAME 638 654 -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst/Helper.pm
r10157 r12023 15 15 # TODO: these should've been passed as a parameter 16 16 # but I'm too tired to figure how to do it 17 # under a Wx::Dialog 17 # under a Wx::Dialog 18 18 my $helpers_for = { 19 'view' => [],20 'model' => [],21 'controller' => [],19 'view' => [], 20 'model' => [], 21 'controller' => [], 22 22 }; 23 23 24 24 sub dialog { 25 my $layout = shift;26 my $ok_sub = shift;27 28 my $main = Padre->ide->wx->main;29 my $config = Padre->ide->config;30 25 my $layout = shift; 26 my $ok_sub = shift; 27 28 my $main = Padre->ide->wx->main; 29 my $config = Padre->ide->config; 30 31 31 my $dialog = Padre::Wx::Dialog->new( 32 32 parent => $main, 33 33 title => _T('Create New Component'), 34 34 layout => $layout, 35 width => [ 100, 200],35 width => [ 100, 200 ], 36 36 bottom => 20, 37 37 ); 38 38 39 39 $dialog->{_widgets_}->{_ok_}->SetDefault; 40 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_ok_}, $ok_sub);41 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_cancel_}, \&cancel_clicked);40 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_ok_}, $ok_sub ); 41 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_cancel_}, \&cancel_clicked ); 42 42 43 43 $dialog->{_widgets_}->{_name_}->SetFocus; … … 47 47 48 48 sub get_model_layout { 49 my $available_models 50 = $helpers_for->{'model'}; #shift; TODO: ungloball this 51 49 my $available_models = $helpers_for->{'model'}; #shift; TODO: ungloball this 50 52 51 my @layout = ( 53 [ 54 [ 'Wx::StaticText', undef, _T('Model Name:') ], 55 [ 'Wx::TextCtrl', '_name_', 'DB' ], 56 ], 57 [ 58 [ 'Wx::StaticText', undef, _T('Type') ], 59 [ 'Wx::Choice', '_type_', $available_models ], 60 ], 61 [ 62 [ 'Wx::StaticText', undef , _T('Additional Parameters:') ], 63 [ 'Wx::TextCtrl' , '_extra_params_', '' ], 64 ], 65 [ 66 [ 'Wx::CheckBox', '_force_', 'force', 0 ], #TODO add -mechanize parameter too 67 ], 68 [ 69 [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 70 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 52 [ [ 'Wx::StaticText', undef, _T('Model Name:') ], 53 [ 'Wx::TextCtrl', '_name_', 'DB' ], 54 ], 55 [ [ 'Wx::StaticText', undef, _T('Type') ], 56 [ 'Wx::Choice', '_type_', $available_models ], 57 ], 58 [ [ 'Wx::StaticText', undef, _T('Additional Parameters:') ], 59 [ 'Wx::TextCtrl', '_extra_params_', '' ], 60 ], 61 [ [ 'Wx::CheckBox', '_force_', 'force', 0 ], #TODO add -mechanize parameter too 62 ], 63 [ [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 64 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 71 65 ], 72 66 ); … … 75 69 76 70 sub get_view_layout { 77 my $available_views = $helpers_for->{'view'}; #shift; TODO: ungloball this78 71 my $available_views = $helpers_for->{'view'}; #shift; TODO: ungloball this 72 79 73 my @layout = ( 80 [ 81 [ 'Wx::StaticText', undef, _T('View Name:') ], 82 [ 'Wx::TextCtrl', '_name_', 'TT' ], 83 ], 84 [ 85 [ 'Wx::StaticText', undef, _T('Type') ], 86 [ 'Wx::Choice', '_type_', $available_views ], 87 ], 88 [ 89 [ 'Wx::CheckBox', '_force_', _T('force'), 0 ], #TODO add -mechanize parameter too 90 ], 91 [ 92 [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 93 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 74 [ [ 'Wx::StaticText', undef, _T('View Name:') ], 75 [ 'Wx::TextCtrl', '_name_', 'TT' ], 76 ], 77 [ [ 'Wx::StaticText', undef, _T('Type') ], 78 [ 'Wx::Choice', '_type_', $available_views ], 79 ], 80 [ [ 'Wx::CheckBox', '_force_', _T('force'), 0 ], #TODO add -mechanize parameter too 81 ], 82 [ [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 83 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 94 84 ], 95 85 ); … … 98 88 99 89 sub get_controller_layout { 100 my $available_controllers 101 = $helpers_for->{'controller'}; #shift; TODO: ungloball this 102 90 my $available_controllers = $helpers_for->{'controller'}; #shift; TODO: ungloball this 91 103 92 my @layout = ( 104 [ 105 [ 'Wx::StaticText', undef, _T('Controller Name:') ], 106 [ 'Wx::TextCtrl', '_name_', '' ], 107 ], 108 [ 109 [ 'Wx::StaticText', undef, _T('Type') ], 110 [ 'Wx::Choice', '_type_', $available_controllers ], 111 ], 112 [ 113 [ 'Wx::StaticText', undef , _T('Additional Parameters:') ], 114 [ 'Wx::TextCtrl' , '_extra_params_', '' ], 115 ], 116 [ 117 [ 'Wx::CheckBox', '_force_', 'force', 0 ], #TODO add -mechanize parameter too 118 ], 119 [ 120 [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 121 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 93 [ [ 'Wx::StaticText', undef, _T('Controller Name:') ], 94 [ 'Wx::TextCtrl', '_name_', '' ], 95 ], 96 [ [ 'Wx::StaticText', undef, _T('Type') ], 97 [ 'Wx::Choice', '_type_', $available_controllers ], 98 ], 99 [ [ 'Wx::StaticText', undef, _T('Additional Parameters:') ], 100 [ 'Wx::TextCtrl', '_extra_params_', '' ], 101 ], 102 [ [ 'Wx::CheckBox', '_force_', 'force', 0 ], #TODO add -mechanize parameter too 103 ], 104 [ [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 105 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 122 106 ], 123 107 ); … … 127 111 128 112 sub find_helpers_for { 129 my $type = shift;113 my $type = shift; 130 114 my $none_str = _T('[none]'); 131 115 132 116 require Module::Pluggable::Object; 133 my @available_helpers = map { s{Catalyst::Helper::$type\:\:}{}; $_134 } Module::Pluggable::Object->new(135 'search_path' => "Catalyst::Helper::$type",136 )->plugins()137 ;117 my @available_helpers = map { 118 s{Catalyst::Helper::$type\:\:}{}; $_ 119 } Module::Pluggable::Object->new( 120 'search_path' => "Catalyst::Helper::$type", 121 )->plugins(); 138 122 push @available_helpers, $none_str; 139 140 ## Put preferred types first on the list. For example, 123 124 ## Put preferred types first on the list. For example, 141 125 # as a view, TT is preferred. 142 126 # TODO: make this configurable under a Plugin Preferences window 143 my $favourite = find_favourites( $type, \@available_helpers);127 my $favourite = find_favourites( $type, \@available_helpers ); 144 128 $favourite ||= $none_str; 145 129 146 130 # puts favourite option always on top of the list 147 131 @available_helpers = ( 148 $favourite,149 grep {$_ ne $favourite} sort @available_helpers132 $favourite, 133 grep { $_ ne $favourite } sort @available_helpers 150 134 ); 151 135 return \@available_helpers; … … 153 137 154 138 sub find_favourites { 155 my $type = shift;156 my $helpers = shift;139 my $type = shift; 140 my $helpers = shift; 157 141 my $none_str = _T('[none]'); 158 if ( $type eq 'View') {159 foreach ( @{$helpers}) {160 return $_ if ( $_ eq 'TT');142 if ( $type eq 'View' ) { 143 foreach ( @{$helpers} ) { 144 return $_ if ( $_ eq 'TT' ); 161 145 } 162 } 163 elsif ($type eq 'Model') { 164 foreach (@{$helpers}) { 165 return $_ if ($_ eq 'DBIC::Schema'); 146 } elsif ( $type eq 'Model' ) { 147 foreach ( @{$helpers} ) { 148 return $_ if ( $_ eq 'DBIC::Schema' ); 166 149 } 167 150 } 168 151 169 152 # no favorites found. 170 153 return; … … 175 158 $helpers_for->{'view'} = find_helpers_for('View'); # TODO: unglobal this 176 159 my $layout = get_view_layout(); 177 my $dialog = dialog( $layout, \&create_view);160 my $dialog = dialog( $layout, \&create_view ); 178 161 $dialog->Show(1); 179 162 return; … … 184 167 $helpers_for->{'controller'} = find_helpers_for('Controller'); # TODO: unglobal this 185 168 my $layout = get_controller_layout(); 186 my $dialog = dialog( $layout, \&create_controller);169 my $dialog = dialog( $layout, \&create_controller ); 187 170 $dialog->Show(1); 188 171 return; … … 191 174 192 175 sub on_create_model { 193 $helpers_for->{'model'} = find_helpers_for('Model'); # TODO: unglobal this176 $helpers_for->{'model'} = find_helpers_for('Model'); # TODO: unglobal this 194 177 my $layout = get_model_layout(); 195 my $dialog = dialog( $layout, \&create_model);178 my $dialog = dialog( $layout, \&create_model ); 196 179 $dialog->Show(1); 197 180 return; … … 208 191 sub create_view { 209 192 my $dialog = shift; 210 my $data = $dialog->get_data;193 my $data = $dialog->get_data; 211 194 $dialog->Destroy; 212 create( 'View', $data);195 create( 'View', $data ); 213 196 } 214 197 215 198 sub create_model { 216 199 my $dialog = shift; 217 my $data = $dialog->get_data;200 my $data = $dialog->get_data; 218 201 $dialog->Destroy; 219 create( 'Model', $data);202 create( 'Model', $data ); 220 203 } 221 204 222 205 sub create_controller { 223 206 my $dialog = shift; 224 my $data = $dialog->get_data;207 my $data = $dialog->get_data; 225 208 $dialog->Destroy; 226 create( 'Controller', $data);209 create( 'Controller', $data ); 227 210 } 228 211 … … 231 214 my $type = lc(shift); 232 215 my $data = shift; 233 my $main = Padre->ide->wx->main;234 235 unless ( $data->{'_name_'}) {216 my $main = Padre->ide->wx->main; 217 218 unless ( $data->{'_name_'} ) { 236 219 Wx::MessageBox( 237 sprintf( _T("You must provide a name for your %s module"), $type),238 _T('Module name required'), Wx::wxOK, $main220 sprintf( _T("You must provide a name for your %s module"), $type ), 221 _T('Module name required'), Wx::wxOK, $main 239 222 ); 240 223 return; 241 224 } 242 243 require Padre::Plugin::Catalyst::Util; 244 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 245 246 my $helper_filename = Padre::Plugin::Catalyst::Util::get_catalyst_project_name($project_dir); 247 $helper_filename .= '_create.pl'; 248 249 my $helper_full_path = File::Spec->catfile($project_dir, 'script', $helper_filename ); 250 if(! -e $helper_full_path) { 251 Wx::MessageBox( 252 sprintf(_T("Catalyst helper script not found at\n%s\n\nPlease make sure the active document is from your Catalyst project."), 253 $helper_full_path 254 ), 255 _T('Helper not found'), Wx::wxOK, $main 256 ); 257 return; 258 } 259 225 226 require Padre::Plugin::Catalyst::Util; 227 my $project_dir = Padre::Plugin::Catalyst::Util::get_document_base_dir() || return; 228 229 my $helper_filename = Padre::Plugin::Catalyst::Util::get_catalyst_project_name($project_dir); 230 $helper_filename .= '_create.pl'; 231 232 my $helper_full_path = File::Spec->catfile( $project_dir, 'script', $helper_filename ); 233 if ( !-e $helper_full_path ) { 234 Wx::MessageBox( 235 sprintf( 236 _T( "Catalyst helper script not found at\n%s\n\nPlease make sure the active document is from your Catalyst project." 237 ), 238 $helper_full_path 239 ), 240 _T('Helper not found'), 241 Wx::wxOK, $main 242 ); 243 return; 244 } 245 260 246 # Prepare the output window for the output 261 247 $main->show_output(1); 262 248 $main->output->Remove( 0, $main->output->GetLastPosition ); 263 249 264 my $perl = Padre::Perl->perl; 265 push my @cmd, 266 $perl, 267 File::Spec->catfile('script', $helper_filename), 268 $type, 269 ; 270 250 my $perl = Padre::Perl->perl; 251 push my @cmd, $perl, File::Spec->catfile( 'script', $helper_filename ), $type,; 252 271 253 my $helper = $helpers_for->{$type}; #TODO: unglobal this 272 push @cmd, 273 $data->{'_name_'}, 274 ( ${$helper}[$data->{'_type_'}] eq '[none]' 275 ? '' 276 : ${$helper}[$data->{'_type_'}] 277 ), 278 ( defined $data->{'_extra_params_'} 279 ? $data->{'_extra_params_'} 280 : '' 281 ), 254 push @cmd, $data->{'_name_'}, 255 ( 256 ${$helper}[ $data->{'_type_'} ] eq '[none]' ? '' 257 : ${$helper}[ $data->{'_type_'} ] 258 ), 259 ( 260 defined $data->{'_extra_params_'} ? $data->{'_extra_params_'} 261 : '' 262 ), 282 263 ; 283 264 284 if ( $data->{'_force_'}) {265 if ( $data->{'_force_'} ) { 285 266 push @cmd, '-force'; 286 267 } 287 268 288 $main->output->AppendText(_T('running:') . "@cmd\n"); 269 $main->output->AppendText( _T('running:') . "@cmd\n" ); 270 289 271 # go to the selected directory 290 272 my $pwd = Cwd::cwd(); 291 273 chdir $project_dir; 292 274 293 # FIXME: STDERR output is going to the console275 # FIXME: STDERR output is going to the console 294 276 my $output_text = qx{@cmd}; 295 277 $main->output->AppendText($output_text); 296 278 297 279 chdir $pwd; # restore directory 298 280 299 $main->output->AppendText( "\n" . _T("Catalyst helper script ended.") . "\n");281 $main->output->AppendText( "\n" . _T("Catalyst helper script ended.") . "\n" ); 300 282 301 283 require Padre::Plugin::Catalyst::Util; 302 284 my $file = Padre::Plugin::Catalyst::Util::find_file_from_output( 303 $data->{'_name_'},304 $output_text305 );285 $data->{'_name_'}, 286 $output_text 287 ); 306 288 if ($file) { 307 $file = Cwd::realpath($file); # avoid relative paths289 $file = Cwd::realpath($file); # avoid relative paths 308 290 my $ret = Wx::MessageBox( 309 sprintf( _T("%s apparently created. Do you want to open it now?"), $type),291 sprintf( _T("%s apparently created. Do you want to open it now?"), $type ), 310 292 _T('Done'), 311 Wx::wxYES_NO |Wx::wxCENTRE,293 Wx::wxYES_NO | Wx::wxCENTRE, 312 294 $main, 313 295 ); … … 320 302 $main->refresh; 321 303 } 322 } 323 else { 324 Wx::MessageBox( 325 sprintf(_T("Error creating %s. Please check the error output and try again"), $type), 326 _T('Error'), 327 Wx::wxOK|Wx::wxCENTRE, 328 $main, 329 ); 330 } 304 } else { 305 Wx::MessageBox( 306 sprintf( _T("Error creating %s. Please check the error output and try again"), $type ), 307 _T('Error'), 308 Wx::wxOK | Wx::wxCENTRE, 309 $main, 310 ); 311 } 331 312 return; 332 313 } -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst/NewApp.pm
r10155 r12023 14 14 15 15 sub on_newapp { 16 my $main = Padre->ide->wx->main;17 18 my $has_catalyst_devel = eval 'use Catalyst::Devel; 1;'; ## no critic (ProhibitStringyEval)19 unless ( $has_catalyst_devel) {20 my $error_str = _T(<<ERR);16 my $main = Padre->ide->wx->main; 17 18 my $has_catalyst_devel = eval 'use Catalyst::Devel; 1;'; ## no critic (ProhibitStringyEval) 19 unless ($has_catalyst_devel) { 20 my $error_str = _T(<<ERR); 21 21 To use the Catalyst development tools including catalyst.pl and the 22 22 generated script/myapp_create.pl you need Catalyst::Helper, which is … … 29 29 return $main->error($error_str); 30 30 31 }32 33 my $dialog = dialog($main);34 $dialog->Show(1);35 return;31 } 32 33 my $dialog = dialog($main); 34 $dialog->Show(1); 35 return; 36 36 } 37 37 … … 39 39 40 40 my @layout = ( 41 [ 42 [ 'Wx::StaticText', undef, _T('Application Name:') ], 43 [ 'Wx::TextCtrl', '_app_name_', ''], 41 [ [ 'Wx::StaticText', undef, _T('Application Name:') ], 42 [ 'Wx::TextCtrl', '_app_name_', '' ], 44 43 ], 45 [ 46 [ 'Wx::StaticText', undef, _T('Parent Directory:')], 47 [ 'Wx::DirPickerCtrl', '_directory_', '', _T('Pick parent directory')], 44 [ [ 'Wx::StaticText', undef, _T('Parent Directory:') ], 45 [ 'Wx::DirPickerCtrl', '_directory_', '', _T('Pick parent directory') ], 48 46 ], 49 47 ); 50 48 require Catalyst; 51 if ( $Catalyst::VERSION < 5.80013) {49 if ( $Catalyst::VERSION < 5.80013 ) { 52 50 push @layout, 53 [51 [ 54 52 [ 'Wx::CheckBox', '_short_', _T('short names'), 0 ], 55 ];53 ]; 56 54 } 57 55 push @layout, 58 56 [ 59 [ 'Wx::Button', '_ok_', Wx::wxID_OK],60 [ 'Wx::Button', '_cancel_',Wx::wxID_CANCEL ],57 [ 'Wx::Button', '_ok_', Wx::wxID_OK ], 58 [ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL ], 61 59 ]; 62 60 … … 65 63 66 64 sub dialog { 67 my $parent = shift;68 my $config = Padre->ide->config;69 65 my $parent = shift; 66 my $config = Padre->ide->config; 67 70 68 my $layout = get_layout(); 71 69 my $dialog = Padre::Wx::Dialog->new( … … 73 71 title => _T('New Catalyst Application'), 74 72 layout => $layout, 75 width => [ 100, 200],73 width => [ 100, 200 ], 76 74 bottom => 20, 77 75 ); 78 79 $dialog->{_widgets_}->{_directory_}->SetPath( $config->module_start_directory);80 76 77 $dialog->{_widgets_}->{_directory_}->SetPath( $config->module_start_directory ); 78 81 79 $dialog->{_widgets_}->{_ok_}->SetDefault; 82 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_ok_}, \&ok_clicked);83 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_cancel_}, \&cancel_clicked);80 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_ok_}, \&ok_clicked ); 81 Wx::Event::EVT_BUTTON( $dialog, $dialog->{_widgets_}->{_cancel_}, \&cancel_clicked ); 84 82 85 83 $dialog->{_widgets_}->{_app_name_}->SetFocus; … … 90 88 91 89 sub cancel_clicked { 92 my ( $dialog, $event) = @_;90 my ( $dialog, $event ) = @_; 93 91 94 92 $dialog->Destroy; … … 98 96 99 97 sub ok_clicked { 100 my ( $dialog, $event) = @_;98 my ( $dialog, $event ) = @_; 101 99 102 100 my $data = $dialog->get_data; … … 107 105 # TODO improve input validation ! 108 106 if ( $data->{'_app_name_'} =~ m{^\s*$|[^\w\:]}o ) { 109 Wx::MessageBox(_T('Invalid Application name'), _T('missing field'), Wx::wxOK, $main); 110 return; 107 Wx::MessageBox( _T('Invalid Application name'), _T('missing field'), Wx::wxOK, $main ); 108 return; 109 } elsif ( not $data->{'_directory_'} ) { 110 Wx::MessageBox( _T('You need to select a base directory'), _T('missing field'), Wx::wxOK, $main ); 111 return; 111 112 } 112 elsif (not $data->{'_directory_'}) { 113 Wx::MessageBox(_T('You need to select a base directory'), _T('missing field'), Wx::wxOK, $main); 114 return; 115 } 116 113 117 114 # We should probably call Catalyst::Helper directly 118 115 # (new() and mk_app()) here, as long as we can redirect 119 116 # print statements to $main->output->AppendText(). 120 #121 # Perhaps if run_command() were to block before continuing,122 # we could use something like:117 # 118 # Perhaps if run_command() were to block before continuing, 119 # we could use something like: 123 120 #$main->run_command('catalyst.pl ' . $data->{'_app_name_'}); 124 121 … … 128 125 129 126 my @command = ( 130 # use catalyst.bat on Windows 131 'catalyst' . ($^O =~ /Win/o ? '' : '.pl'), 132 ( $data->{'_short_'} 133 ? '-short' 134 : '' 135 ), 136 $data->{'_app_name_'}, 137 ); 138 127 128 # use catalyst.bat on Windows 129 'catalyst' . ( $^O =~ /Win/o ? '' : '.pl' ), 130 ( $data->{'_short_'} 131 ? '-short' 132 : '' 133 ), 134 $data->{'_app_name_'}, 135 ); 136 139 137 # go to the selected directory 140 138 my $pwd = Cwd::cwd(); 141 139 chdir $data->{'_directory_'}; 142 140 143 141 # run command, then immediately restore directory 144 my $output_text = qx(@command); 142 my $output_text = qx(@command); 145 143 chdir $pwd; 146 144 … … 148 146 149 147 my $ret = Wx::MessageBox( 150 sprintf( _T("%s apparently created. Do you want to open it now?"), $data->{_app_name_}),148 sprintf( _T("%s apparently created. Do you want to open it now?"), $data->{_app_name_} ), 151 149 'Done', 152 Wx::wxYES_NO |Wx::wxCENTRE,150 Wx::wxYES_NO | Wx::wxCENTRE, 153 151 $main, 154 152 ); … … 156 154 require Padre::Plugin::Catalyst::Util; 157 155 my $file = Padre::Plugin::Catalyst::Util::find_file_from_output( 158 'Root',159 $output_text160 );156 'Root', 157 $output_text 158 ); 161 159 $file = File::Spec->catfile( $data->{'_directory_'}, $file ); 162 160 $file = Cwd::realpath($file); # avoid relative paths -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst/Outline.pm
r10155 r12023 4 4 use warnings; 5 5 6 use Padre::Wx ();7 use Padre::Util ('_T');6 use Padre::Wx (); 7 use Padre::Util ('_T'); 8 8 use Wx; 9 9 … … 14 14 15 15 sub new { 16 my $class = shift;17 my $plugin = shift;18 my $main = Padre::Current->main;19 20 my $self = $class->SUPER::new(16 my $class = shift; 17 my $plugin = shift; 18 my $main = Padre::Current->main; 19 20 my $self = $class->SUPER::new( 21 21 $main->right, 22 22 -1, … … 31 31 $self, $self, 32 32 sub { 33 # $self->on_tree_item_set_focus( $_[1] ); 33 34 # $self->on_tree_item_set_focus( $_[1] ); 34 35 }, 35 36 ); … … 39 40 $self, $self, 40 41 sub { 41 # $self->on_tree_item_activated( $_[1] ); 42 43 # $self->on_tree_item_activated( $_[1] ); 42 44 } 43 45 ); 44 46 45 47 $self->Hide; 46 # $self->Show; 47 $main->right->show($self); 48 $self->fill; 48 49 # $self->Show; 50 $main->right->show($self); 51 $self->fill; 49 52 50 53 return $self; … … 53 56 # fill() fills the TreeCtrl with information regarding the project 54 57 sub fill { 55 my $self = shift;56 57 my $tree_ref = $self->update_tree;58 my $root = $self->AddRoot( 'Root', -1, -1, Wx::TreeItemData->new('Data'));59 $self->populate($root, $tree_ref);58 my $self = shift; 59 60 my $tree_ref = $self->update_tree; 61 my $root = $self->AddRoot( 'Root', -1, -1, Wx::TreeItemData->new('Data') ); 62 $self->populate( $root, $tree_ref ); 60 63 } 61 64 … … 65 68 # to display? 66 69 sub update_tree { 67 return { 68 'Model' => { 69 }, 70 'View' => { 71 'TT' => 1, 72 }, 73 'Controller' => { 74 'Root' => 1, 75 'Foo' => { 76 'Bar' => 1, 77 } 78 }, 79 'Templates' => { 80 'one.tt' => 1, 81 'two.tt' => 1, 82 'three.tt' => 1, 83 }, 84 }; 70 return { 71 'Model' => {}, 72 'View' => { 73 'TT' => 1, 74 }, 75 'Controller' => { 76 'Root' => 1, 77 'Foo' => { 78 'Bar' => 1, 79 } 80 }, 81 'Templates' => { 82 'one.tt' => 1, 83 'two.tt' => 1, 84 'three.tt' => 1, 85 }, 86 }; 85 87 } 86 88 … … 88 90 # with its sorted values, recursively 89 91 sub populate { 90 my ($self, $root, $tree_ref) = (@_);91 92 foreach my $item ( sort keys %{$tree_ref} ) {93 my $node = $self->AppendItem( $root, $item, -1, -1, Wx::TreeItemData->new($item));94 95 if ( ref $tree_ref->{$item} ) {96 $self->populate( $node, $tree_ref->{$item} );97 }98 }92 my ( $self, $root, $tree_ref ) = (@_); 93 94 foreach my $item ( sort keys %{$tree_ref} ) { 95 my $node = $self->AppendItem( $root, $item, -1, -1, Wx::TreeItemData->new($item) ); 96 97 if ( ref $tree_ref->{$item} ) { 98 $self->populate( $node, $tree_ref->{$item} ); 99 } 100 } 99 101 } 100 102 -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst/Panel.pm
r10155 r12023 7 7 8 8 use Padre::Wx (); 9 use Padre::Util ('_T'); 10 use Wx (); 9 use Wx (); 11 10 use base 'Wx::Panel'; 12 11 13 12 sub new { 14 my $class = shift;15 my $main = shift;16 my $self = $class->SUPER::new( Padre::Current->main->bottom );13 my $class = shift; 14 my $main = shift; 15 my $self = $class->SUPER::new( Padre::Current->main->bottom ); 17 16 18 require Scalar::Util;;17 require Scalar::Util; 19 18 $self->{main} = $main; 20 Scalar::Util::weaken( $self->{main});19 Scalar::Util::weaken( $self->{main} ); 21 20 22 # main container21 # main container 23 22 my $box = Wx::BoxSizer->new(Wx::wxVERTICAL); 24 23 25 24 # top box, holding buttons, icons and checkboxes 26 25 my $top_box = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 27 26 28 # visual led showing server state 27 # visual led showing server state 29 28 my $led = Wx::StaticBitmap->new( $self, -1, Wx::wxNullBitmap ); 30 29 $led->SetBitmap( $self->led('red') ); 31 30 $top_box->Add( $led, 0, Wx::wxALIGN_CENTER_VERTICAL ); 32 $self->{led} = $led;33 31 $self->{led} = $led; 32 34 33 # button to toggle server 35 my $button = Wx::Button->new( $self, -1, _T('Start Server') ); 34 my $button = Wx::Button->new( $self, -1, Wx::gettext('Start Server') ); 35 36 36 #Wx::Event::EVT_BUTTON( $self, $button, \&Padre::Plugin::Catalyst::toggle_server ); 37 Wx::Event::EVT_BUTTON( $self, $button,38 sub { 39 my $panel = shift; 40 if ( $panel->{button}->GetLabel eq _T('Start Server') ) { 41 $panel->{main}->on_start_server; 42 } 43 else {44 $panel->{main}->on_stop_server;45 }46 },47 );48 $top_box->Add( $button, 0, Wx::wxALIGN_CENTER_VERTICAL);49 37 Wx::Event::EVT_BUTTON( 38 $self, $button, 39 sub { 40 my $panel = shift; 41 if ( $panel->{button}->GetLabel eq Wx::gettext('Start Server') ) { 42 $panel->{main}->on_start_server; 43 } else { 44 $panel->{main}->on_stop_server; 45 } 46 }, 47 ); 48 $top_box->Add( $button, 0, Wx::wxALIGN_CENTER_VERTICAL ); 49 50 50 # checkbox to auto-restart 51 my $checkbox = Wx::CheckBox->new( $self, -1, _T('auto-restart'));51 my $checkbox = Wx::CheckBox->new( $self, -1, Wx::gettext('auto-restart') ); 52 52 Wx::Event::EVT_CHECKBOX( $self, $checkbox, sub { shift->{config}->{auto_restart} ^= 1 } ); 53 53 $top_box->Add( $checkbox, 0, Wx::wxALIGN_CENTER_VERTICAL ); 54 54 55 55 # finishing up the top_box 56 56 #$box->Add( $top_box, 1, Wx::wxGROW ); 57 57 $box->Add( $top_box, 0, Wx::wxALIGN_LEFT | Wx::wxALIGN_CENTER_VERTICAL ); 58 58 59 # output panel for server60 require Padre::Wx::Output;61 my $output = Padre::Wx::Output->new($self);59 # output panel for server 60 require Padre::Wx::Output; 61 my $output = Padre::Wx::Output->new($self); 62 62 $box->Add( $output, 1, Wx::wxGROW ); 63 63 64 # wrapping it up64 # wrapping it up 65 65 $self->SetSizer($box); 66 66 67 67 # holding on to some objects we'll need to manipulate later on 68 68 $self->{output} = $output; … … 70 70 $self->{checkbox} = $checkbox; 71 71 72 return $self;72 return $self; 73 73 } 74 74 75 75 sub output { return shift->{output} } 76 76 77 sub gettext_label { return _T('Catalyst Dev Server') }77 sub gettext_label { return Wx::gettext('Catalyst Dev Server') } 78 78 79 79 sub toggle_panel { 80 my ($self, $enable) = (@_);81 82 my $new_label = [ _T('Stop Server'), _T('Start Server') ];83 84 $self->{checkbox}->Enable($enable);85 $self->{button}->SetLabel( $new_label->[$enable] );86 87 $self->{led}->SetBitmap( $self->led( $enable == 1 ? 'red' : 'green' ) );80 my ( $self, $enable ) = (@_); 81 82 my $new_label = [ Wx::gettext('Stop Server'), Wx::gettext('Start Server') ]; 83 84 $self->{checkbox}->Enable($enable); 85 $self->{button}->SetLabel( $new_label->[$enable] ); 86 87 $self->{led}->SetBitmap( $self->led( $enable == 1 ? 'red' : 'green' ) ); 88 88 } 89 89 … … 93 93 # and now some xpm icons for the server leds 94 94 sub led { 95 my ($self, $color) = (@_);95 my ( $self, $color ) = (@_); 96 96 97 my @red = (98 '20 20 192 2', ' c None', '. c #DE9898','+ c #EC9D9D', '@ c #FA9C9C',99 '# c #FD9898', '$ c #FC8B8B', '% c #F67979','& c #E46A6A', '* c #CD5757',100 '= c #C88989', '- c #F9ACAC', '; c #FFB8B8','> c #FFBEBE', ', c #FEBDBD',101 '\' c #FFB5B5', ') c #FFA6A6', '! c #FE9393','~ c #FF7D7D', '{ c #FF6868',102 '] c #E85151', '^ c #BB3D3D', '/ c #DE9797','( c #FAACAC', '_ c #FFC2C2',103 ': c #FFD1D1', '< c #FED9D9', '[ c #FFD8D8','} c #FFCECE', '| c #FFBDBD',104 '1 c #FFA8A8', '2 c #FF8E8E', '3 c #FF7575','4 c #FF5D5D', '5 c #FF4646',105 '6 c #BD7B7B', '7 c #FFA2A2', '8 c #FFBCBC','9 c #FFD4D4', '0 c #FFE5E5',106 'a c #FFEDED', 'b c #FFE2E2', 'c c #FFD0D0','d c #FFB7B7', 'e c #FF9C9C',107 'f c #FF8080', 'g c #FF6666', 'h c #FF4F4F','i c #F33A3A', 'j c #F28F8F',108 'k c #FFA9A9', 'l c #FEC6C6', 'm c #FFDFDF','n c #FFF0F0', 'o c #FFFAFA',109 'p c #FFF8F8', 'q c #FFDADA', 'r c #FFC0C0','s c #FFA3A3', 't c #FF8787',110 'u c #FF6B6B', 'v c #FF5252', 'w c #FF3D3D','x c #D77C7C', 'y c #FD8C8C',111 'z c #FFAAAA', 'A c #FFC7C7', 'B c #FFE0E0','C c #FFF2F2', 'D c #FFFCFC',112 'E c #FFEFEF', 'F c #FFDCDC', 'G c #FFA5A5','H c #FF8888', 'I c #FF6C6C',113 'J c #FF5454', 'K c #FF3E3E', 'L c #FF2B2B','M c #C26A6A', 'N c #FFC1C1',114 'O c #FFD9D9', 'P c #FFEAEA', 'Q c #FFF3F3','R c #FFE8E8', 'S c #FFD5D5',115 'T c #FFA1A1', 'U c #FF8585', 'V c #FF6969','W c #FF5151', 'X c #A83838',116 'Y c #F25F5F', 'Z c #FF7E7E', '` c #FF9999',' . c #FFB4B4', '.. c #FFCACA',117 '+. c #FFB0B0', '@. c #FF9797', '#. c #FF7C7C','$. c #FF6363', '%. c #FF4D4D',118 '&. c #FF3A3A', '*. c #FE2B2B', '=. c #E52525','-. c #FB5A5A', ';. c #FF7272',119 '>. c #FF8A8A',',. c #FFC3C3', '\'. c #FFB3B3', '). c #FF9F9F', '!. c #FF7070',120 '~. c #FF5A5A', '{. c #FF4747', ']. c #FF3535','^. c #FF2727', '/. c #E32727',121 '(. c #F14C4C', '_. c #FF7777', ':. c #FF8B8B','<. c #FFAFAF', '[. c #FFAEAE',122 '}. c #FFA7A7', '|. c #FF9A9A', '1. c #FF7676','2. c #FF6262', '3. c #FF2E2E',123 '4. c #FF2323', '5. c #E22222', '6. c #D24343','7. c #FF7474', '8. c #FF8181',124 '9. c #FF8C8C', '0. c #FF9191', 'a. c #FF7373','b. c #FF5353', 'c. c #FF4343',125 'd. c #FF2828', 'e. c #FE1E1E', 'f. c #E71A1A','g. c #FE5151', 'h. c #FF7171',126 'i. c #FF5E5E', 'j. c #FF4444', 'k. c #FF3737','l. c #FE2222', 'm. c #FF1414',127 'n. c #EF3939', 'o. c #FE3F3F', 'p. c #FF4949','q. c #FF5858', 'r. c #FF5B5B',128 's. c #FF4040', 't. c #FF3636', 'u. c #FF2C2C','v. c #FF1A1A', 'w. c #CB2727',129 'x. c #C73636', 'y. c #FF2F2F', 'z. c #FE3838','A. c #FF4242', 'B. c #FF4545',130 'C. c #FF3F3F', 'D. c #FF3939', 'E. c #FF3232','F. c #FF2929', 'G. c #FF1C1C',131 'H. c #FF1010', 'I. c #C53535', 'J. c #FF2D2D','K. c #FF3131', 'L. c #FF3333',132 'M. c #FF2A2A', 'N. c #FF2525', 'O. c #FE1F1F','P. c #FE1A1A', 'Q. c #FF1111',133 'R. c #B03737', 'S. c #FF1E1E', 'T. c #FE2424','U. c #FF2424', 'V. c #FF2121',134 'W. c #FF1717', 'X. c #FF0808', 'Y. c #DE2424','Z. c #F21F1F', '`. c #FF1818',135 ' + c #FF1616', '.+ c #FF1313', '++ c #EE1A1A','@+ c #D22222', '#+ c #983C3C',136 '$+ c #963E3E','%+ c #963D3D', '&+ c #983A3A',137 ' ',138 ' ',139 ' . + @ # $ % & * ',140 ' = - ; > , \' ) ! ~ { ] ^ ',141 ' / ( _ : < [ } | 1 2 3 4 5 ^ ',142 ' 6 7 8 9 0 a a b c d e f g h i ^ ',143 ' j k l m n o p a q r s t u v w ^ ',144 ' x y z A B C D o E F _ G H I J K L ^ ',145 ' M H G N O P Q C R S | T U V W w L X ',146 ' Y Z ` ...q b b [ A +.@.#.$.%.&.*.=. ',147 ' -.;.>.T \' ,.....N \'.).H !.~.{.].^./. ',148 ' (.$._.:.e 1 <.[.}.|.>.1.2.h K 3.4.5. ',149 ' 6.v $.7.8.9.0.0.9.8.a.$.b.c.].d.e.f. ',150 ' ^ c.g.4 { h.3 3 h.V i.W j.k.L l.m.^ ',151 ' n.o.p.W q.r.r.q.v p.s.t.u.4.v.w.^ ',152 ' x.y.z.K A.B.B.c.C.D.E.F.4.G.H.^ ',153 ' I.^.J.K.L.L.E.3.M.N.O.P.Q.^ ',154 ' R.S.4.T.N.U.V.S.P.W.X.^ ',155 ' ^ Y.Z.`.`. +.+++@+^ ',156 ' ^ #+$+%+&+^ ',157 );97 my @red = ( 98 '20 20 192 2', ' c None', '. c #DE9898', '+ c #EC9D9D', '@ c #FA9C9C', 99 '# c #FD9898', '$ c #FC8B8B', '% c #F67979', '& c #E46A6A', '* c #CD5757', 100 '= c #C88989', '- c #F9ACAC', '; c #FFB8B8', '> c #FFBEBE', ', c #FEBDBD', 101 '\' c #FFB5B5', ') c #FFA6A6', '! c #FE9393', '~ c #FF7D7D', '{ c #FF6868', 102 '] c #E85151', '^ c #BB3D3D', '/ c #DE9797', '( c #FAACAC', '_ c #FFC2C2', 103 ': c #FFD1D1', '< c #FED9D9', '[ c #FFD8D8', '} c #FFCECE', '| c #FFBDBD', 104 '1 c #FFA8A8', '2 c #FF8E8E', '3 c #FF7575', '4 c #FF5D5D', '5 c #FF4646', 105 '6 c #BD7B7B', '7 c #FFA2A2', '8 c #FFBCBC', '9 c #FFD4D4', '0 c #FFE5E5', 106 'a c #FFEDED', 'b c #FFE2E2', 'c c #FFD0D0', 'd c #FFB7B7', 'e c #FF9C9C', 107 'f c #FF8080', 'g c #FF6666', 'h c #FF4F4F', 'i c #F33A3A', 'j c #F28F8F', 108 'k c #FFA9A9', 'l c #FEC6C6', 'm c #FFDFDF', 'n c #FFF0F0', 'o c #FFFAFA', 109 'p c #FFF8F8', 'q c #FFDADA', 'r c #FFC0C0', 's c #FFA3A3', 't c #FF8787', 110 'u c #FF6B6B', 'v c #FF5252', 'w c #FF3D3D', 'x c #D77C7C', 'y c #FD8C8C', 111 'z c #FFAAAA', 'A c #FFC7C7', 'B c #FFE0E0', 'C c #FFF2F2', 'D c #FFFCFC', 112 'E c #FFEFEF', 'F c #FFDCDC', 'G c #FFA5A5', 'H c #FF8888', 'I c #FF6C6C', 113 'J c #FF5454', 'K c #FF3E3E', 'L c #FF2B2B', 'M c #C26A6A', 'N c #FFC1C1', 114 'O c #FFD9D9', 'P c #FFEAEA', 'Q c #FFF3F3', 'R c #FFE8E8', 'S c #FFD5D5', 115 'T c #FFA1A1', 'U c #FF8585', 'V c #FF6969', 'W c #FF5151', 'X c #A83838', 116 'Y c #F25F5F', 'Z c #FF7E7E', '` c #FF9999', ' . c #FFB4B4', '.. c #FFCACA', 117 '+. c #FFB0B0', '@. c #FF9797', '#. c #FF7C7C', '$. c #FF6363', '%. c #FF4D4D', 118 '&. c #FF3A3A', '*. c #FE2B2B', '=. c #E52525', '-. c #FB5A5A', ';. c #FF7272', 119 '>. c #FF8A8A', ',. c #FFC3C3', '\'. c #FFB3B3', '). c #FF9F9F', '!. c #FF7070', 120 '~. c #FF5A5A', '{. c #FF4747', ']. c #FF3535', '^. c #FF2727', '/. c #E32727', 121 '(. c #F14C4C', '_. c #FF7777', ':. c #FF8B8B', '<. c #FFAFAF', '[. c #FFAEAE', 122 '}. c #FFA7A7', '|. c #FF9A9A', '1. c #FF7676', '2. c #FF6262', '3. c #FF2E2E', 123 '4. c #FF2323', '5. c #E22222', '6. c #D24343', '7. c #FF7474', '8. c #FF8181', 124 '9. c #FF8C8C', '0. c #FF9191', 'a. c #FF7373', 'b. c #FF5353', 'c. c #FF4343', 125 'd. c #FF2828', 'e. c #FE1E1E', 'f. c #E71A1A', 'g. c #FE5151', 'h. c #FF7171', 126 'i. c #FF5E5E', 'j. c #FF4444', 'k. c #FF3737', 'l. c #FE2222', 'm. c #FF1414', 127 'n. c #EF3939', 'o. c #FE3F3F', 'p. c #FF4949', 'q. c #FF5858', 'r. c #FF5B5B', 128 's. c #FF4040', 't. c #FF3636', 'u. c #FF2C2C', 'v. c #FF1A1A', 'w. c #CB2727', 129 'x. c #C73636', 'y. c #FF2F2F', 'z. c #FE3838', 'A. c #FF4242', 'B. c #FF4545', 130 'C. c #FF3F3F', 'D. c #FF3939', 'E. c #FF3232', 'F. c #FF2929', 'G. c #FF1C1C', 131 'H. c #FF1010', 'I. c #C53535', 'J. c #FF2D2D', 'K. c #FF3131', 'L. c #FF3333', 132 'M. c #FF2A2A', 'N. c #FF2525', 'O. c #FE1F1F', 'P. c #FE1A1A', 'Q. c #FF1111', 133 'R. c #B03737', 'S. c #FF1E1E', 'T. c #FE2424', 'U. c #FF2424', 'V. c #FF2121', 134 'W. c #FF1717', 'X. c #FF0808', 'Y. c #DE2424', 'Z. c #F21F1F', '`. c #FF1818', 135 ' + c #FF1616', '.+ c #FF1313', '++ c #EE1A1A', '@+ c #D22222', '#+ c #983C3C', 136 '$+ c #963E3E', '%+ c #963D3D', '&+ c #983A3A', 137 ' ', 138 ' ', 139 ' . + @ # $ % & * ', 140 ' = - ; > , \' ) ! ~ { ] ^ ', 141 ' / ( _ : < [ } | 1 2 3 4 5 ^ ', 142 ' 6 7 8 9 0 a a b c d e f g h i ^ ', 143 ' j k l m n o p a q r s t u v w ^ ', 144 ' x y z A B C D o E F _ G H I J K L ^ ', 145 ' M H G N O P Q C R S | T U V W w L X ', 146 ' Y Z ` ...q b b [ A +.@.#.$.%.&.*.=. ', 147 ' -.;.>.T \' ,.....N \'.).H !.~.{.].^./. ', 148 ' (.$._.:.e 1 <.[.}.|.>.1.2.h K 3.4.5. ', 149 ' 6.v $.7.8.9.0.0.9.8.a.$.b.c.].d.e.f. ', 150 ' ^ c.g.4 { h.3 3 h.V i.W j.k.L l.m.^ ', 151 ' n.o.p.W q.r.r.q.v p.s.t.u.4.v.w.^ ', 152 ' x.y.z.K A.B.B.c.C.D.E.F.4.G.H.^ ', 153 ' I.^.J.K.L.L.E.3.M.N.O.P.Q.^ ', 154 ' R.S.4.T.N.U.V.S.P.W.X.^ ', 155 ' ^ Y.Z.`.`. +.+++@+^ ', 156 ' ^ #+$+%+&+^ ', 157 ); 158 158 159 # I'm too lazy to create a green XPM160 my @green = ();161 foreach (@red) {162 my $color = $_;163 $color =~ s/#(\w\w)(\w\w)/#$2$1/;164 push @green, $color;165 }; 159 # I'm too lazy to create a green XPM 160 my @green = (); 161 foreach (@red) { 162 my $color = $_; 163 $color =~ s/#(\w\w)(\w\w)/#$2$1/; 164 push @green, $color; 165 } 166 166 167 my $led = {168 red => \@red,169 green => \@green,170 };171 172 return Wx::Bitmap->newFromXPM( $led->{$color} )173 if exists $led->{$color};174 175 return;167 my $led = { 168 red => \@red, 169 green => \@green, 170 }; 171 172 return Wx::Bitmap->newFromXPM( $led->{$color} ) 173 if exists $led->{$color}; 174 175 return; 176 176 } 177 177 -
trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst/Util.pm
r10157 r12023 4 4 5 5 # some code used all around the Plugin 6 use Cwd ();7 use File::Spec ();8 use Padre::Util ('_T');6 use Cwd (); 7 use File::Spec (); 8 use Padre::Util ('_T'); 9 9 10 10 our $VERSION = '0.08'; … … 17 17 return unless $project_dir; 18 18 19 require File::Spec;20 my @dirs= File::Spec->splitdir($project_dir);21 my $project_name = lc($dirs[-1]);22 $project_name =~ tr{-}{_};23 24 return $project_name;19 require File::Spec; 20 my @dirs = File::Spec->splitdir($project_dir); 21 my $project_name = lc( $dirs[-1] ); 22 $project_name =~ tr{-}{_}; 23 24 return $project_name; 25 25 } 26 26 27 27 sub find_file_from_output { 28 my $filename = shift;28 my $filename = shift; 29 29 my $output_text = shift; 30 30 31 31 $filename .= '.pm'; 32 33 if ( $output_text =~ m{created "(.+$filename(?:\.new)?)"}) {32 33 if ( $output_text =~ m{created "(.+$filename(?:\.new)?)"} ) { 34 34 return $1; 35 } 36 else { 35 } else { 37 36 return; # sorry, not found 38 37 } … … 41 40 sub get_document_base_dir { 42 41 my $main = Padre->ide->wx->main; 43 my $doc = $main->current->document;44 42 my $doc = $main->current->document; 43 45 44 unless ($doc) { 46 Wx::MessageBox(47 _T('Could not open current document. Please make sure you have at least one document open.'), 48 _T('Catalyst project dir not found'), Wx::wxOK, $main49 );50 return;51 }45 Wx::MessageBox( 46 _T('Could not open current document. Please make sure you have at least one document open.'), 47 _T('Catalyst project dir not found'), Wx::wxOK, $main 48 ); 49 return; 50 } 52 51 53 52 my $filename = $doc->filename; … … 58 57 # Catalyst project 59 58 sub in_catalyst_project { 60 require File::Spec;61 my $filename = shift or return;59 require File::Spec; 60 my $filename = shift or return; 62 61 63 my $project_dir = Padre::Util::get_project_dir($filename);64 65 foreach my $dir ( qw(lib root script t)) {66 return unless -d File::Spec->catdir( $project_dir, $dir );67 }68 return 1;62 my $project_dir = Padre::Util::get_project_dir($filename); 63 64 foreach my $dir (qw(lib root script t)) { 65 return unless -d File::Spec->catdir( $project_dir, $dir ); 66 } 67 return 1; 69 68 } 70 69 … … 73 72 # should move it to Padre::Plugin or similar 74 73 sub get_plugin_menu_item_by_label { 75 my $menu_item = shift;76 my $main= Padre::ide->wx->main;74 my $menu_item = shift; 75 my $main = Padre::ide->wx->main; 77 76 78 # find plugin menu79 my $menu = $main->menu->{'plugins'}->{'plugin_menus'};80 my $plugin_menu;81 foreach (@{$menu}) {82 if ($_->GetLabel eq 'Catalyst') {83 $plugin_menu = $_;84 last;85 }86 }87 return unless $plugin_menu;77 # find plugin menu 78 my $menu = $main->menu->{'plugins'}->{'plugin_menus'}; 79 my $plugin_menu; 80 foreach ( @{$menu} ) { 81 if ( $_->GetLabel eq 'Catalyst' ) { 82 $plugin_menu = $_; 83 last; 84 } 85 } 86 return unless $plugin_menu; 88 87 89 # find requested menu element90 my $submenu = $plugin_menu->GetSubMenu;91 foreach my $item ($submenu->GetMenuItems) {92 return $item if $item->GetLabel eq $menu_item;93 }94 return;88 # find requested menu element 89 my $submenu = $plugin_menu->GetSubMenu; 90 foreach my $item ( $submenu->GetMenuItems ) { 91 return $item if $item->GetLabel eq $menu_item; 92 } 93 return; 95 94 } 96 95 97 96 sub toggle_server_menu { 98 my $toggle = shift;97 my $toggle = shift; 99 98 100 my $menu_start = get_plugin_menu_item_by_label( 101 _T('Start Web Server') 102 ); 103 my $menu_stop = get_plugin_menu_item_by_label( 104 _T('Stop Web Server') 105 ); 106 if ($menu_start and $menu_stop) { 107 $menu_start->Enable($toggle); 108 $menu_stop->Enable(!$toggle); 109 } 99 my $menu_start = get_plugin_menu_item_by_label( _T('Start Web Server') ); 100 my $menu_stop = get_plugin_menu_item_by_label( _T('Stop Web Server') ); 101 if ( $menu_start and $menu_stop ) { 102 $menu_start->Enable($toggle); 103 $menu_stop->Enable( !$toggle ); 104 } 110 105 } 111 106 112 107 sub toggle_menu_items { 113 my ($toggle, $is_server_on) = (@_); 114 115 #TODO: caching this on startup would probably make things marginally faster 116 my $menu_helpers = get_plugin_menu_item_by_label(_T('Create new...')); 117 my $menu_start = get_plugin_menu_item_by_label(_T('Start Web Server')); 118 my $menu_stop = get_plugin_menu_item_by_label(_T('Stop Web Server')); 119 my $menu_update = get_plugin_menu_item_by_label(_T('Update Application Scripts')); 120 121 $menu_helpers->Enable($toggle) if $menu_helpers; 122 $menu_update->Enable($toggle) if $menu_update; 123 124 if ($toggle == 0) { 125 $menu_start->Enable($toggle) if $menu_start; 126 $menu_stop->Enable($toggle) if $menu_stop; 127 } 128 else { 129 $menu_start->Enable(! $is_server_on) if $menu_start; 130 $menu_stop->Enable($is_server_on) if $menu_stop; 131 } 108 my ( $toggle, $is_server_on ) = (@_); 109 110 #TODO: caching this on startup would probably make things marginally faster 111 my $menu_helpers = get_plugin_menu_item_by_label( _T('Create new...') ); 112 my $menu_start = get_plugin_menu_item_by_label( _T('Start Web Server') ); 113 my $menu_stop = get_plugin_menu_item_by_label( _T('Stop Web Server') ); 114 my $menu_update = get_plugin_menu_item_by_label( _T('Update Application Scripts') ); 115 116 $menu_helpers->Enable($toggle) if $menu_helpers; 117 $menu_update->Enable($toggle) if $menu_update; 118 119 if ( $toggle == 0 ) { 120 $menu_start->Enable($toggle) if $menu_start; 121 $menu_stop->Enable($toggle) if $menu_stop; 122 } else { 123 $menu_start->Enable( !$is_server_on ) if $menu_start; 124 $menu_stop->Enable($is_server_on) if $menu_stop; 125 } 132 126 } 133 127 -
trunk/Padre-Plugin-Catalyst/lib/Padre/Wx/Menu/Catalyst.pm
r9576 r12023 32 32 # Menu items 33 33 # TODO: Add the menu items. Sample: 34 # $self->{beginner_check} = $self->add_menu_action(35 # $self,36 # 'perl.beginner_check',37 # );38 #39 # $self->AppendSeparator;34 # $self->{beginner_check} = $self->add_menu_action( 35 # $self, 36 # 'perl.beginner_check', 37 # ); 38 # 39 # $self->AppendSeparator; 40 40 41 41 return $self; … … 49 49 50 50 sub refresh { 51 my $self = shift;51 my $self = shift; 52 52 53 # TODO: Change to refresh options for real items53 # TODO: Change to refresh options for real items 54 54 55 55 my $current = _CURRENT(@_); … … 59 59 # Disable document-specific entries if we are in a Perl project 60 60 # but not in a Perl document. 61 # FIXME: the two commands below crash unless they are defined. Should they62 # ALWAYS be defined or should we leave them like so? (garu)61 # FIXME: the two commands below crash unless they are defined. Should they 62 # ALWAYS be defined or should we leave them like so? (garu) 63 63 $self->{beginner_check}->Enable($perl) if defined $self->{beginner_check}; 64 64 65 65 # Apply config-driven state 66 66 $self->{autocomplete_brackets}->Check( $config->autocomplete_brackets ) 67 if defined $self->{autocomplete_brackets};67 if defined $self->{autocomplete_brackets}; 68 68 69 69 return; -
trunk/Padre-Plugin-Catalyst/t/00-load.t
r3645 r12023 4 4 5 5 BEGIN { 6 use_ok( 'Padre::Plugin::Catalyst');6 use_ok('Padre::Plugin::Catalyst'); 7 7 } 8 8 9 diag( "Testing Padre::Plugin::Catalyst $Padre::Plugin::Catalyst::VERSION, Perl $], $^X");9 diag("Testing Padre::Plugin::Catalyst $Padre::Plugin::Catalyst::VERSION, Perl $], $^X"); -
trunk/Padre-Plugin-Catalyst/t/01-perl_interpreter.t
r7840 r12023 4 4 5 5 BEGIN { 6 ok(my $perl = Padre::Perl->perl, "Get perl interpreter");7 ok(defined $perl, "Perl interpreter defined");6 ok( my $perl = Padre::Perl->perl, "Get perl interpreter" ); 7 ok( defined $perl, "Perl interpreter defined" ); 8 8 } 9 9 10 10 SKIP: { 11 skip("old method. perl_interpreter was moved to Padre::Perl->perl", 1);12 ok(my $perl = Padre->perl_interpreter, "Padre perl_interpreter");13 } ;11 skip( "old method. perl_interpreter was moved to Padre::Perl->perl", 1 ); 12 ok( my $perl = Padre->perl_interpreter, "Padre perl_interpreter" ); 13 } 14 14
Note: See TracChangeset
for help on using the changeset viewer.
