Thread Kephra: Texteditor nur in Perl
(538 answers)
Opened by lichtkind at 2008-03-09 00:08
So, für meinen Kephra habe ich jetzt folgendes gemacht:
/config/extention/output/executables.yaml: Kephra.pm habe ich etwas angepasst: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #.... use Cwd; use File::Spec::Functions ':ALL'; use File::HomeDir (); use File::UserConfig (); use File::Basename (); use Config::General (); use YAML::Tiny (); our $basedir; BEGIN{ $basedir = rel2abs( File::Basename::dirname( __FILE__ ) ); } use Wx; # Core wxWidgets Framework use Wx::STC; # Scintilla editor component #.... Kephra::Extention::Output: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #... use Kephra::Extention::Output::Config; #... sub run { my $win = Kephra::App::Window::_ref(); my $doc = Kephra::Document::_get_current_file_path(); Kephra::File::save_current(); if ($doc) { clear_output(); my $type = Kephra::Document::SyntaxMode::get(); Kephra::Extention::Output::Config::load( $Kephra::basedir ); my $prog = Kephra::Extention::Output::Config::get( $type ) || 'perl'; my $proc = Wx::Perl::ProcessStream->OpenProcess(qq~"$prog" "$doc"~ , 'Output-Extention', $win); } else { Kephra::App::StatusBar::info_msg( $Kephra::localisation{app}{menu}{document} . ' ' . $Kephra::localisation{app}{general}{untitled} . "\n" ); } } Kephra::Extention::Output::Config: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 package Kephra::Extention::Output::Config; use strict; use warnings; use File::Spec; use YAML::Tiny; our $VERSION = 0.01; my %hash; sub load { my $basename = shift; my $conf = File::Spec->catfile( $basename, '..', 'config', 'extention', 'output', 'executables.yaml' ); my $ref = YAML::Tiny->read( $conf ); if( $ref and $ref->[0] ){ %hash = %{ $ref->[0] }; } } sub get { my ($key) = @_; return $hash{$key}; } 1; et voilá (für mich genügt das erstmal) OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/) -- Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html Perl-Entwicklung: http://perl-services.de/ |