| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::EditorTools::Command::RenamePackage; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # ABSTRACT: Rename the package | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 7 |  |  | 7 |  | 6346 | use strict; | 
|  | 7 |  |  |  |  | 16 |  | 
|  | 7 |  |  |  |  | 292 |  | 
| 6 | 7 |  |  | 7 |  | 38 | use warnings; | 
|  | 7 |  |  |  |  | 13 |  | 
|  | 7 |  |  |  |  | 185 |  | 
| 7 | 7 |  |  | 7 |  | 5102 | use Path::Class; | 
|  | 7 |  |  |  |  | 303228 |  | 
|  | 7 |  |  |  |  | 536 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 7 |  |  | 7 |  | 56 | use App::EditorTools -command; | 
|  | 7 |  |  |  |  | 15 |  | 
|  | 7 |  |  |  |  | 84 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $VERSION = '1.00'; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub opt_spec { | 
| 14 | 1 |  |  | 1 | 1 | 36924 | return ( [ "name|n=s", "The new name of the package", ] ); | 
| 15 |  |  |  |  |  |  | } | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub validate_args { | 
| 18 | 1 |  |  | 1 | 1 | 799 | my ( $self, $opt, $args ) = @_; | 
| 19 | 1 | 50 |  |  |  | 11 | $self->usage_error("Name is required") unless $opt->{name}; | 
| 20 | 1 |  |  |  |  | 3 | return 1; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub execute { | 
| 24 | 1 |  |  | 1 | 1 | 7 | my ( $self, $opt, $arg ) = @_; | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 1 |  |  |  |  | 2 | my $doc_as_str = eval { local $/ = undef;  }; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 13 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 1 |  |  |  |  | 918 | require PPIx::EditorTools::RenamePackage; | 
| 29 | 1 |  |  |  |  | 146937 | print PPIx::EditorTools::RenamePackage->new->rename( | 
| 30 |  |  |  |  |  |  | code        => $doc_as_str, | 
| 31 |  |  |  |  |  |  | replacement => $opt->{name} )->code; | 
| 32 | 1 |  |  |  |  | 9271 | return; | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | 1; | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | __END__ |