Padre-Plugin-PDL-0.05/ 0000755 0001750 0001750 00000000000 11730332335 014232 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/Padre-Plugin-PDL.fbp 0000644 0001750 0001750 00000002345 11730315451 017633 0 ustar azawawi azawawi
Padre-Plugin-PDL-0.05/META.yml 0000644 0001750 0001750 00000001446 11730332127 015507 0 ustar azawawi azawawi ---
abstract: 'PDL support for Padre'
author:
- 'Ahmad M. Zawawi '
build_requires:
ExtUtils::MakeMaker: 6.59
Locale::Msgfmt: 0.15
Test::More: 0.88
configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.06'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Padre-Plugin-PDL
no_index:
directory:
- eg
- inc
- share
- t
requires:
Moose: 2.0402
PDL: 2.4.10
Padre: 0.94
perl: 5.8.0
resources:
bugtracker: http://padre.perlide.org/
homepage: http://padre.perlide.org/trac/wiki/PadrePluginPDL
license: http://dev.perl.org/licenses/
repository: http://svn.perlide.org/padre/trunk/Padre-Plugin-PDL
version: 0.05
Padre-Plugin-PDL-0.05/README 0000644 0001750 0001750 00000001564 11730315451 015120 0 ustar azawawi azawawi Padre-Plugin-PDL
This plugin enables Padre to provide PDL help integration
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
perldoc Padre::Plugin::PDL
You can also look for information at:
RT, CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Padre-Plugin-PDL
AnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/Padre-Plugin-PDL
CPAN Ratings
http://cpanratings.perl.org/d/Padre-Plugin-PDL
Search CPAN
http://search.cpan.org/dist/Padre-Plugin-PDL
COPYRIGHT AND LICENCE
Copyright (C) 2012 Ahmad M. Zawawi
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Padre-Plugin-PDL-0.05/MYMETA.yml 0000644 0001750 0001750 00000001465 11730332127 015756 0 ustar azawawi azawawi ---
abstract: 'PDL support for Padre'
author:
- 'Ahmad M. Zawawi '
build_requires:
ExtUtils::MakeMaker: 6.59
Locale::Msgfmt: 0.15
Test::More: 0.88
configure_requires:
ExtUtils::MakeMaker: 6.59
dynamic_config: 0
generated_by: 'Module::Install version 1.06, CPAN::Meta::Converter version 2.112150'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Padre-Plugin-PDL
no_index:
directory:
- eg
- inc
- share
- t
requires:
Moose: 2.0402
PDL: v2.4.10
Padre: 0.94
perl: 5.008
resources:
bugtracker: http://padre.perlide.org/
homepage: http://padre.perlide.org/trac/wiki/PadrePluginPDL
license: http://dev.perl.org/licenses/
repository: http://svn.perlide.org/padre/trunk/Padre-Plugin-PDL
version: 0.05
Padre-Plugin-PDL-0.05/lib/ 0000755 0001750 0001750 00000000000 11730332335 015000 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/lib/Padre/ 0000755 0001750 0001750 00000000000 11730332335 016033 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/lib/Padre/Plugin/ 0000755 0001750 0001750 00000000000 11730332335 017271 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/ 0000755 0001750 0001750 00000000000 11730332335 017710 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/Document.pm 0000644 0001750 0001750 00000000562 11730315400 022021 0 ustar azawawi azawawi package Padre::Plugin::PDL::Document;
use 5.008;
use strict;
use warnings;
use Padre::Document::Perl ();
our $VERSION = '0.05';
our @ISA = 'Padre::Document::Perl';
sub get_help_provider {
require Padre::Plugin::PDL::Help;
return Padre::Plugin::PDL::Help->new;
}
1;
__END__
=pod
=head1 NAME
Padre::Plugin::PDL::Document - Padre PDL-enabled Perl document
=cut
Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/Role/ 0000755 0001750 0001750 00000000000 11730332335 020611 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/Role/NeedsPluginEvent.pm 0000644 0001750 0001750 00000001145 11730315400 024361 0 ustar azawawi azawawi package Padre::Plugin::PDL::Role::NeedsPluginEvent;
use Moose::Role;
requires 'on_save_as';
requires 'new_document_from_string';
sub fire_plugin_event {
my $orig = shift;
my $self = shift;
# Save the return value
my $result = $self->$orig(@_);
# Fire event that Padre does not implement at the moment
$self->{ide}->plugin_manager->plugin_event('editor_changed');
# And return the original result
return $result;
}
# Hook up to new_document_from_string
around 'new_document_from_string' => \&fire_plugin_event;
# Hook up to on_save_as
around 'on_save_as' => \&fire_plugin_event;
no Moose::Role;
1;
Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/Util.pm 0000644 0001750 0001750 00000003102 11730315400 021151 0 ustar azawawi azawawi package Padre::Plugin::PDL::Util;
use 5.008;
use strict;
use warnings;
our $VERSION = '0.05';
# Cached items
my $pdl_keywords;
my $pdldoc;
# Adds awesome PDL keywords highlighting
# Not the smartest though at the moment :)
sub add_pdl_keywords_highlighting {
my $document = shift;
my $editor = shift;
my $keywords = Padre::Wx::Scintilla->keywords($document);
if ( Params::Util::_ARRAY($keywords) ) {
foreach my $i ( 0 .. $#$keywords ) {
my $keyword_list = $keywords->[$i];
if ( $i == 0 ) {
$keyword_list .= ' ' . get_pdl_keywords();
}
$editor->Wx::Scintilla::TextCtrl::SetKeyWords( $i, $keyword_list );
}
}
return;
}
# Gets a space-seperated PDL keyword list that is used Scintilla's SetKeyWords
sub get_pdl_keywords {
# Returned cached PDL keywords if it is already defined
return $pdl_keywords if defined $pdl_keywords;
# Find the pdl documentation
my $pdldoc = get_pdldoc();
# Cache the space seperated keyword list
$pdl_keywords = defined $pdldoc ? join ' ', keys %{ $pdldoc->gethash } : '';
# And return it
return $pdl_keywords;
}
# Returns the cached pdldoc is found
# Otherwise tries to create one
sub get_pdldoc {
# Returned cached PDL keywords if it is there
return $pdldoc if defined $pdldoc;
# Find PDL documentation and return the pdl object
require PDL::Doc;
for my $dir (@INC) {
my $file = "$dir/PDL/pdldoc.db";
if ( -f $file ) {
$pdldoc = new PDL::Doc($file);
last;
}
}
# A simple warn. I wish padre had a better logging facility
warn "PDL documentation not found\n" unless defined $pdldoc;
return $pdldoc;
}
1;
Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL/Help.pm 0000644 0001750 0001750 00000005034 11730315400 021132 0 ustar azawawi azawawi package Padre::Plugin::PDL::Help;
use 5.008;
use strict;
use warnings;
# For Perl 6 documentation support
use Padre::Help ();
our $VERSION = '0.05';
our @ISA = 'Padre::Help';
#
# Initialize help
#
sub help_init {
my $self = shift;
# Workaround to get Perl + PDL help. Also, we'll need this so we can clean
# out things from the PDL help list that are already covered by Perl's
# normal help facilities.
require Padre::Document::Perl::Help;
$self->{p5_help} = Padre::Document::Perl::Help->new;
$self->{p5_help}->help_init;
require Padre::Plugin::PDL::Util;
my $pdldoc = Padre::Plugin::PDL::Util::get_pdldoc();
if ( defined $pdldoc ) {
$self->{pdldoc} = $pdldoc;
$self->{pdldoc_hash} = $pdldoc->gethash;
}
}
#
# Renders the help topic content
#
sub help_render {
my $self = shift;
my $topic = shift;
my ( $html, $location );
my $pdldoc_hash = $self->{pdldoc_hash};
if ( defined $pdldoc_hash && exists $pdldoc_hash->{$topic} ) {
require Padre::Pod2HTML;
# We have two possibilities: the $topic can either be a module,
# or it can be a function. If the latter, we extract its pod
# from the database.
# If the former, just pull the pod from the file. We distinguish
# between them by noting that functions have a Module key,
# whereas modules (ironically) don't.
if ( exists $pdldoc_hash->{$topic}->{Module} ) {
# Get the pod docs from the docs database:
my $pod_handler = StrHandle->new; # defined in PDL::Doc
$self->{pdldoc}->funcdocs( $topic, $pod_handler );
# Convert them to HTML
$html = Padre::Pod2HTML->pod2html( $pod_handler->text );
# Replace the filename in the "docs from" section with
# the module name
my $module_name = $pdldoc_hash->{$topic}{Module};
$html =~ s{Docs from .*\.pm}
{Docs from $module_name<\/a>};
} else {
$html = Padre::Pod2HTML->file2html( $pdldoc_hash->{$topic}->{File} );
}
$location = $topic;
} else {
( $html, $location ) = $self->{p5_help}->help_render($topic);
}
return ( $html, $location );
}
#
# Returns the help topic list
#
sub help_list {
my $self = shift;
# Return a unique sorted index
my @index = keys %{ $self->{pdldoc_hash} };
# Add Perl 5 help index to PDL
push @index, @{ $self->{p5_help}->help_list };
# Make sure things are only listed once:
my %seen = ();
my @unique_sorted_index = sort grep { !$seen{$_}++ } @index;
return \@unique_sorted_index;
}
1;
__END__
=head1 NAME
Padre::Plugin::PDL::Help - PDL help provider for Padre
=head1 DESCRIPTION
PDL Help index is built here and rendered.
Padre-Plugin-PDL-0.05/lib/Padre/Plugin/PDL.pm 0000644 0001750 0001750 00000010432 11730315400 020240 0 ustar azawawi azawawi package Padre::Plugin::PDL;
use 5.008;
use strict;
use warnings;
use Padre::Plugin ();
our $VERSION = '0.05';
our @ISA = 'Padre::Plugin';
# Child modules we need to unload when disabled
use constant CHILDREN => qw{
Padre::Plugin::PDL
Padre::Plugin::PDL::Document
Padre::Plugin::PDL::Help
Padre::Plugin::PDL::Util
};
# Called when Padre wants to check what package versions this
# plugin needs
sub padre_interfaces {
return
'Padre::Plugin' => 0.94,
'Padre::Document' => 0.94,
'Padre::Wx::Main' => 0.94,
'Padre::Wx::Role::Main' => 0.94,
'Padre::Help' => 0.94,
;
}
# Called when Padre wants to knows what documents this Plugin supports
sub registered_documents {
return 'application/x-perl' => 'Padre::Plugin::PDL::Document',;
}
# Called when Padre wants a name for the plugin
sub plugin_name {
Wx::gettext('PDL');
}
# Called when the plugin is enabled by Padre
sub plugin_enable {
my $self = shift;
# Read the plugin configuration, and
my $config = $self->config_read;
unless ( defined $config ) {
# No configuration, let us create it
$config = {};
}
#TODO initialize your configuration here
# Write the plugin's configuration
$self->config_write($config);
# Update configuration attribute
$self->{config} = $config;
# Generate missing Padre's events
# TODO remove once Padre 0.96 is released
require Padre::Plugin::PDL::Role::NeedsPluginEvent;
Padre::Plugin::PDL::Role::NeedsPluginEvent->meta->apply( $self->main );
# Highlight the current editor. This is needed when a plugin is enabled
# for the first time
$self->editor_changed;
return 1;
}
# Called when the plugin is disabled by Padre
sub plugin_disable {
my $self = shift;
# TODO: Switch to Padre::Unload once Padre 0.96 is released
for my $package (CHILDREN) {
require Padre::Unload;
Padre::Unload->unload($package);
}
}
# Called when Padre wants to display plugin menu items
#sub menu_plugins {
# my $self = shift;
# my $main = $self->main;
# my $menu_item = Wx::MenuItem->new( undef, -1, Wx::gettext('PDL') );
#
#
# Wx::Event::EVT_MENU(
# $main,
# $menu_item,
# sub {
# },
# );
#
# return $menu_item;
#}
# Called when an editor is opened
sub editor_enable {
my $self = shift;
my $editor = shift;
my $document = shift;
# Only on Perl documents
return unless $document->isa('Padre::Document::Perl');
require Padre::Plugin::PDL::Util;
Padre::Plugin::PDL::Util::add_pdl_keywords_highlighting( $document, $editor );
}
# Called when an editor is changed
sub editor_changed {
my $self = shift;
my $document = $self->current->document or return;
my $editor = $self->current->editor or return;
# Only on Perl documents
return unless $document->isa('Padre::Document::Perl');
require Padre::Plugin::PDL::Util;
Padre::Plugin::PDL::Util::add_pdl_keywords_highlighting( $document, $editor );
}
1;
__END__
=pod
=head1 NAME
Padre::Plugin::PDL - PDL support for Padre
=head1 SYNOPSIS
cpan Padre::Plugin::PDL
Then use it via L, The Perl IDE.
=head1 DESCRIPTION
Once enabled, one will automatically get the following features:
=over
=item Context-sensitive help integration
Press F2 to get the help for the current PDL keyword
=back
=head1 BUGS
Please report any bugs or feature requests to C, or through
the web interface at L. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Padre::Plugin::PDL
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker
L
=item * AnnoCPAN: Annotated CPAN documentation
L
=item * CPAN Ratings
L
=item * Search CPAN
L
=back
=head1 SEE ALSO
L, L
=head1 AUTHORS
Ahmad M. Zawawi
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ahmad M. Zawawi
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Padre-Plugin-PDL-0.05/Makefile.PL 0000644 0001750 0001750 00000000763 11730315451 016212 0 ustar azawawi azawawi use strict;
use warnings;
use inc::Module::Install;
name 'Padre-Plugin-PDL';
all_from 'lib/Padre/Plugin/PDL.pm';
requires 'Padre' => '0.94';
requires 'Moose' => '2.0402';
requires 'PDL' => '2.4.10';
test_requires 'Test::More' => '0.88';
no_index 'directory' => qw{ t xt eg share inc};
homepage 'http://padre.perlide.org/trac/wiki/PadrePluginPDL';
bugtracker 'http://padre.perlide.org/';
repository 'http://svn.perlide.org/padre/trunk/Padre-Plugin-PDL';
install_share_with_mofiles;
WriteAll;
Padre-Plugin-PDL-0.05/t/ 0000755 0001750 0001750 00000000000 11730332335 014475 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/t/01-eol.t 0000644 0001750 0001750 00000001755 11725664347 015706 0 ustar azawawi azawawi use strict;
use warnings;
use Test::More;
BEGIN {
# Don't run tests for installs
unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) {
plan( skip_all => "Author tests not required for installation" );
}
unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
plan skip_all => 'Needs DISPLAY';
exit 0;
}
}
# Checks for UNIX end of lines (aka newlines)
use File::Find::Rule;
use Padre::Util ();
my @files =
File::Find::Rule->file->name( '*.pm', '*.pod', '*.pl', '*.p6', '*.t', '*.yml', '*.txt' )->in( 'lib', 't', 'share' );
@files = ( @files, 'Makefile.PL', 'Changes', 'padre.yml' );
plan( tests => scalar @files );
foreach my $file (@files) {
my $eol = Padre::Util::newline_type( slurp($file) );
ok( ( $eol eq 'UNIX' ) || ( $eol eq 'None' ), "$file has UNIX-EOLs or none" );
}
######################################################################
# Support Functions
sub slurp {
my $file = shift;
open my $fh, '<', $file or die $!;
binmode $fh;
local $/ = undef;
return <$fh>;
}
Padre-Plugin-PDL-0.05/t/00-compile.t 0000644 0001750 0001750 00000002072 11725664347 016547 0 ustar azawawi azawawi #!perl
use strict;
use warnings;
use Test::More;
BEGIN {
if ( not $ENV{DISPLAY} and not $^O eq 'MSWin32' ) {
plan skip_all => 'Needs DISPLAY';
exit 0;
}
}
use File::Find;
use File::Temp qw{ tempdir };
my @modules;
find(
sub {
return if $File::Find::name !~ /\.pm\z/;
my $found = $File::Find::name;
$found =~ s{^lib/}{};
$found =~ s{[/\\]}{::}g;
$found =~ s/\.pm$//;
# nothing to skip
push @modules, $found;
},
'lib',
);
my @scripts = glob "bin/*";
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? ( plan tests => $plan ) : ( plan skip_all => "no tests to run" );
{
# fake home for cpan-testers
# no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 );
like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" ) for sort @modules;
SKIP: {
eval "use Test::Script 1.05; 1;";
skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
foreach my $file (@scripts) {
my $script = $file;
$script =~ s!.*/!!;
script_compiles( $file, "$script script compiles" );
}
}
}
Padre-Plugin-PDL-0.05/share/ 0000755 0001750 0001750 00000000000 11730332335 015334 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/share/locale/ 0000755 0001750 0001750 00000000000 11730332335 016573 5 ustar azawawi azawawi Padre-Plugin-PDL-0.05/share/locale/Padre__Plugin__PDL-ar.mo 0000644 0001750 0001750 00000000634 11730332271 023100 0 ustar azawawi azawawi , <