---
name: "prt"
section: "1p"
platform: "linux"
package: "prt"
version: "0.22-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/prt"
---

# prt(1p)

Command line frontend of App::PRT

## NAME

prt - Command line frontend of App::PRT

## SYNOPSIS

```
    $ prt <command> <args>
    $ prt <command> <args> <files>
```

## DESCRIPTION

prt is the command line frontend of App::PRT.

## SUBCOMMANDS

- •

  replace\_token

  Replace `"foo"` token with `"bar"`.

  ```
      prt replace_token foo bar
  ```

  Replace `"foo"` token with `"bar"` but target statements must have `"bazz"` token.

  ```
      prt replace_token foo bar --in-statement bazz
  ```

- •

  rename\_class

  Rename `"Foo"` class to `"Bar"` class.

  ```
      prt rename_class Foo Bar
  ```

- •

  rename\_namespace

  Rename `"Foo"` and `"Foo::*"` classes to `"Bar"` and `"Bar::*"` classes.

  ```
      prt rename_namespace Foo Bar
  ```

- •

  delete\_method

  Delete `"eat"` method from `"Food"` class.

  ```
      prt delete_method Food eat
  ```

- •

  move\_class\_method

  Move `"method"` method in `"Class"` class to `"another_method"` method in `"AnotherClass"`. `"Class"`'s including packages are copied to `"AnotherClass"`.

  ```
      prt move_class_method 'Class#method' 'AnotherClass#another_method'
  ```

- •

  introduce\_variables

  Print the variables in the source code. This command accepts input from `"STDIN"`.

  ```
      prt introduce_variables a.pl
      cat a.pl | prt introduce_variables
      pbpaste | prt introduce_variables
  ```

- •

  list\_files

  List the files that `"App::PRT"` would process.  This can be used, for example, to search the contents of the Perl sources in a project:

  ```
      grep "some_regex" `prt list_files`
  ```

  The `"-0"` argument causes outputs to be separated by `"\0"` instead of the default `"\n"`.  For example:

  ```
      prt list_files -0 | xargs -0 grep "some_regex"
  ```

## TARGET FILES

You can specify the target files to refactor.  For example:

```
    prt replace_token foo bar lib/**/*.pm t/*.t # Refactor Perl modules in lib/ and test files in t/
```

NOTE: `"App::PRT"` does not glob (expand wildcards).  In the above command, the shell must expand the `"**/*.pm"` and `"*.t"`.

Without target files, `"App::PRT"` detects source files in your project automatically. `"App::PRT"` looks for a `"cpanfile"` to detect the project's root directory. When executed in a git repository, all files in the repository are used.

```
    prt replace_token foo bar   # Refactor the project in current working directory
```

## LICENSE

Copyright (C) 2014-2019 hitode909 and contributors.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

## AUTHOR

hitode909 \<hitode909@gmail.com\>
