Changeset 2214


Ignore:
Timestamp:
12/28/08 07:53:07 (3 years ago)
Author:
szabgab
Message:

add a pre_process call before execution a script from Padre
that allows the checking of the current file for beginner errors.

Location:
trunk/Padre
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/Changes

    r2209 r2214  
    33v0.23 ?????????? 
    44 
     5    Add naive way to locate some of the annoying errors beginners 
     6        might make that perl does not catch. (SZABGAB) 
    57    Makefile.PL tricks EU:MM into not loading every single dependency, 
    68        making our dependency-heavy Makefile.PL far saner (ADAMK) 
  • trunk/Padre/lib/Padre/Config.pm

    r2184 r2214  
    3737    editor_methods            => 'alphabetical', 
    3838    editor_codefolding        => 0, 
     39    editor_perl5_beginner     => 1, 
    3940 
    4041    # Indentation settings 
  • trunk/Padre/lib/Padre/Document.pm

    r2184 r2214  
    590590# abstract method, each subclass should implement it 
    591591sub keywords           { return {} } 
    592 sub get_functions      { return () }; 
    593 sub get_function_regex { return '' }; 
     592sub get_functions      { return () } 
     593sub get_function_regex { return '' } 
     594sub pre_process        { return 1  } 
    594595 
    595596# should return ($length, @words) 
  • trunk/Padre/lib/Padre/Document/Perl.pm

    r2184 r2214  
    129129    chdir $dir; 
    130130    return qq{"$perl" "$filename"}; 
     131} 
     132 
     133sub pre_process { 
     134    my ( $self ) = @_; 
     135    my $config = Padre->ide->config; 
     136 
     137print "pre\n"; 
     138use Data::Dumper; 
     139#print Dumper $config; 
     140    if ($config->{editor_perl5_beginner}) { 
     141    print "process\n"; 
     142        require Padre::Document::Perl::Beginner; 
     143        my $b = Padre::Document::Perl::Beginner->new; 
     144        if ($b->check( $self->text_get )) { 
     145            return 1; 
     146        } else { 
     147            $self->set_errstr( $b->error ); 
     148            return; 
     149        } 
     150    } 
     151 
     152    return 1; 
    131153} 
    132154 
  • trunk/Padre/lib/Padre/Wx/Dialog/Preferences.pm

    r2184 r2214  
    5454            ['Wx::CheckBox',    'editor_use_wordwrap', '', 
    5555                ($config->{editor_use_wordwrap} ? 1 : 0) ], 
     56        ], 
     57        [ 
     58            [ 'Wx::StaticText', undef,              Wx::gettext('Perl beginner mode')], 
     59            ['Wx::CheckBox',    'editor_perl5_beginner', '', 
     60                ($config->{editor_perl5_beginner} ? 1 : 0) ], 
    5661        ], 
    5762        [ 
     
    172177    $config->{editor_current_line_background_color} =~ s/#//; 
    173178 
    174     foreach my $f (qw(editor_use_tabs editor_use_wordwrap editor_auto_indentation_style)) { 
     179    foreach my $f (qw(editor_use_tabs editor_use_wordwrap editor_auto_indentation_style editor_perl5_beginner)) { 
    175180        $config->{$f} = $data->{$f} ? 1 : 0; 
    176181    } 
  • trunk/Padre/lib/Padre/Wx/MainWindow.pm

    r2202 r2214  
    844844    } 
    845845    if ($cmd) { 
    846         $self->run_command( $cmd ); 
     846        if ($document->pre_process) { 
     847            $self->run_command( $cmd ); 
     848        } else { 
     849            $self->error( $document->errstr ); 
     850        } 
    847851    } 
    848852    return; 
  • trunk/Padre/t/02-new.t

    r2169 r2214  
    5353        editor_indentwidth            => 4, 
    5454        editor_use_tabs               => 1, 
     55        editor_perl5_beginner         => 1, 
    5556 
    5657        search_terms       => [], 
Note: See TracChangeset for help on using the changeset viewer.