| Padre documentation | Contained in the Padre distribution. |
Padre::Util - Padre utility functions for new-file-templates
The Padre::Util::Template package contains helper functions for templates
used to create new files. They should be backward-compatible all the time as
they might be used by user-created templates not living on the Padre storage.
We're using Template::Tiny which is unable to pass arguments to method calls, so we need to have one method per case.
new_modulenameAsks for the name of a new module which is returned.
Return the user replied value on subsequent calls.
Copyright 2008-2011 The Padre development team as listed in Padre.pm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| Padre documentation | Contained in the Padre distribution. |
package Padre::Util::Template;
use 5.008; use strict; use warnings; our $VERSION = '0.86'; # This is a Padre::Util module where the subs should be called as functions, # but Template::Tiny requires us to use a blessed package and we could use # the object as a cache. sub new { my $class = shift; my $self = bless {}, $class; return $self; }
sub new_modulename { my $self = shift; $self->{_modulename} ||= Padre->ide->wx->main->prompt( Wx::gettext('Module name:'), Wx::gettext('New Module') ) || 'New::Module'; return $self->{_modulename}; } 1; __END__
# Copyright 2008-2011 The Padre development team as listed in Padre.pm. # LICENSE # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl 5 itself.