Hi Guys,

thanks for Sabo Gabor and for YAPC:EU:2011

I learned how to create your own functions in Padre in My.pm

#i use replace_slash (for windows) replace_start_digit (if i copy from vi/vim 
(set nu))
sub replace_slash {
    my $self = shift;
    my $main = $self->main;

    my $doc  = Padre::Current->document;
    my $text = $doc->text_get();
    $text =~ s#\\#/#g;
    $doc->text_set($text);

    return;
}

sub replace_start_digit {
    my $self = shift;
    my $main = $self->main;

    my $doc  = Padre::Current->document;
    my $text = $doc->text_get();
    $text =~ s/^[0-9]+\s*//mg;
    $doc->text_set($text);

    return;
}
#and invoke it here
sub menu_plugins_simple {
    my $self = shift;
    return $self->plugin_name => [
        'About' => sub { $self->show_about },

        'Replace_slash' => sub { $self->replace_slash },
        'Replace_start_digit' => sub { $self->replace_start_digit },

        # 'A Sub-Menu...' => [
        #     'Sub-Menu Entry' => sub { $self->yet_another_method },
        # ],
    ];
}

23.08.2011, 23:00, padre-dev-requ...@perlide.org:
> Send Padre-dev mailing list submissions to
>         padre-dev@perlide.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.perlide.org/mailman/listinfo/padre-dev
> or, via email, send a message with subject or body 'help' to
>         padre-dev-requ...@perlide.org
>
> You can reach the person managing the list at
>         padre-dev-ow...@perlide.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Padre-dev digest..."
>
> Today's Topics:
>
>    1. Re: Syntax checking for YAML and JSON files (Adam Kennedy)
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 23 Aug 2011 13:37:14 +1000
> From: Adam Kennedy <adamkennedybac...@gmail.com>
> Subject: Re: [Padre-dev] Syntax checking for YAML and JSON files
> To: Padre development discussion list <padre-dev@perlide.org>
> Message-ID:
>         <CAMpOPe6TNW4-=6amjsjmooassuyrstra8t4cgz8yvdtytyr...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> If you parse with YAML.pm you get full resolution line and column numbers.
>
> So yes I think it's very doable, although we don't include YAML.pm in
> our dependencies so it would need to be in a plugin.
>
> We would, however, need to do a more thorough abstraction of the
> Perl-specific parts of the syntax checker from the generic parts.
>
> That probably means doing more parsing and analysis in the background
> task that wraps the perl -c command line call, and inventing
> some kind of more abstract "problem" object that full describes that
> the front-end should display.
>
> This is a good idea in general, because with a single common problem
> object we can write adapters for critic and other tools, run them all
> in parallel if possible and merge all the problems back onto a single
> editor window.
>
> So we could run multiple parallel checking routines and show all the
> results together.
>
> Adam K
>
> On 22 August 2011 15:51, Gabor Szabo <szab...@gmail.com> wrote:
>
>>  I was just editing a YAML file with the syntax checker open.
>>  It was blank.
>>  That's when I thought we could implement a syntax checker by
>>  trying to parse the file using YAML::Load
>>
>>  Same with JSON files.
>>
>>  What do you think?
>>
>>  Gabor
>>  _______________________________________________
>>  Padre-dev mailing list
>>  Padre-dev@perlide.org
>>  http://mail.perlide.org/mailman/listinfo/padre-dev
>
> ------------------------------
>
> _______________________________________________
> Padre-dev mailing list
> Padre-dev@perlide.org
> http://mail.perlide.org/mailman/listinfo/padre-dev
>
> End of Padre-dev Digest, Vol 37, Issue 14
> *****************************************

--
Николай Мишин
_______________________________________________
Padre-dev mailing list
Padre-dev@perlide.org
http://mail.perlide.org/mailman/listinfo/padre-dev

Reply via email to