Padre::Plugin::ViewInBrowser - view selected doc in browser for L<Padre>


Padre-Plugin-ViewInBrowser documentation Contained in the Padre-Plugin-ViewInBrowser distribution.

Index


Code Index:

NAME

Top

Padre::Plugin::ViewInBrowser - view selected doc in browser for Padre

SYNOPSIS

Top

    $>padre
    Plugins -> ViewInBrowser -> View in Browser

DESCRIPTION

Top

basically it's a shortcut for Wx::LaunchDefaultBrowser( $main->current->filename );

AUTHOR

Top

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Top


Padre-Plugin-ViewInBrowser documentation Contained in the Padre-Plugin-ViewInBrowser distribution.

package Padre::Plugin::ViewInBrowser;

use warnings;
use strict;

our $VERSION = '0.07';

use base 'Padre::Plugin';
use Padre::Wx ();

sub padre_interfaces {
	'Padre::Plugin' => '0.26',
}

sub menu_plugins_simple {
	my $self = shift;
	return ('ViewInBrowser' => [
		'View in Browser', sub { $self->view_in_browser },
	]);
}

sub view_in_browser {
	my ( $self ) = @_;
	my $main = $self->main;
	
	my $filename = $main->current->filename;
	unless ( $filename ) {
		Wx::MessageBox( 'What to open? God KNOWS!',
		'Error', Wx::wxOK | Wx::wxCENTRE, $main );
		return;
	}
	Wx::LaunchDefaultBrowser($filename);
}

1;
__END__