| 1 | |||
| 2 | package Text::Editor::Vip::Buffer::Plugins::Case; | ||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | BEGIN | ||
| 7 | 2 | ▶ | { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use Exporter (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 2 | ▶ | use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | $VERSION = 0.01; | |
| 12 | 2 | @ISA = qw (Exporter); | |
| 13 | 2 | @EXPORT = qw (); | |
| 14 | 2 | @EXPORT_OK = qw (); | |
| 15 | 2 | %EXPORT_TAGS = (); | |
| 16 | } | ||
| 17 | |||
| 18 | #------------------------------------------------------------------------------- | ||
| 19 | |||
| 20 | sub MakeSelectionUpperCase | ||
| 21 | 2 | ▶ | { |
|
Subroutine
MakeSelectionUpperCase: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | |||
| 23 | =head2 MakeSelectionUpperCase | ||
| 24 | |||
| 25 | Makes the current selection upper case. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | 2 | my $buffer = shift ; | |
| 30 | |||
| 31 | $buffer->RunSubOnSelection | ||
| 32 | ( | ||
| 33 | sub | ||
| 34 | 1 | ▶ | { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 35 | #my ($text, $selection_line_index, $modification_character, $original_selection, $buffer) = @_; | ||
| 36 | 1 | return(uc(shift)) ; | |
| 37 | } | ||
| 38 | , sub | ||
| 39 | 1 | ▶ | { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 40 | 1 | $buffer->PrintError("Please select text for upper case operation.\n") | |
| 41 | } | ||
| 42 | 2 | ) ; | |
| 43 | } | ||
| 44 | |||
| 45 | #------------------------------------------------------------------------------- | ||
| 46 | |||
| 47 | sub MakeSelectionLowerCase | ||
| 48 | 2 | ▶ | { |
|
Subroutine
MakeSelectionLowerCase: called CC=1 SCAR=0.2
Pod
documented
| |||
| 49 | |||
| 50 | =head2 MakeSelectionLowerCase | ||
| 51 | |||
| 52 | Makes the current selection lower case. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | 2 | my $buffer = shift ; | |
| 57 | |||
| 58 | $buffer->RunSubOnSelection | ||
| 59 | ( | ||
| 60 | sub | ||
| 61 | 4 | ▶ | { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 62 | #my ($text, $selection_line_index, $modification_character, $original_selection, $buffer) = @_; | ||
| 63 | 4 | return(lc(shift)) ; | |
| 64 | } | ||
| 65 | , sub | ||
| 66 | 0 | ▶ | { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 67 | 0 | $buffer->PrintError("Please select text for lower case operation.\n") | |
| 68 | } | ||
| 69 | 2 | ) ; | |
| 70 | } | ||
| 71 | |||
| 72 | #------------------------------------------------------------------------------- | ||
| 73 | |||
| 74 | 2 | 1 ; | |
| 75 | |||
| 76 | =head1 NAME | ||
| 77 | |||
| 78 | Text::Editor::Vip::Buffer::Plugins::Case - Plugin to make selection upper or lower case. | ||
| 79 | |||
| 80 | =head1 SYNOPSIS | ||
| 81 | |||
| 82 | use Text::Editor::Vip::Buffer ; | ||
| 83 | |||
| 84 | my $buffer = new Text::Editor::Vip::Buffer() ; | ||
| 85 | $buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Plugins::Case') ; | ||
| 86 | |||
| 87 | $buffer->Insert("this is upper case") ; | ||
| 88 | $buffer->GetSelection()->Set(0, 8, 0, 13) ; | ||
| 89 | $buffer->MakeSelectionUpperCase() ; | ||
| 90 | |||
| 91 | is($buffer->GetText(), 'this is UPPER case', 'Upper casing selection') ; | ||
| 92 | |||
| 93 | =head1 DESCRIPTION | ||
| 94 | |||
| 95 | Plugin to make selection upper or lower case | ||
| 96 | |||
| 97 | =head1 AUTHOR | ||
| 98 | |||
| 99 | Khemir Nadim ibn Hamouda | ||
| 100 | CPAN ID: NKH | ||
| 101 | mailto:nadim@khemir.net | ||
| 102 | http:// no web site | ||
| 103 | |||
| 104 | =head1 COPYRIGHT | ||
| 105 | |||
| 106 | This program is free software; you can redistribute | ||
| 107 | it and/or modify it under the same terms as Perl itself. | ||
| 108 | |||
| 109 | The full text of the license can be found in the | ||
| 110 | LICENSE file included with this module. | ||
| 111 | |||
| 112 | =cut | ||