PRT(1p)

πŸ“¦
version 0.22 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’… prt β€” the manual page, but make it cute (PRT(1p), bestie)

okay so you found the PRT(1p) page, that's the User Contributed Perl Documentation section, and we're about to make it make sense. this is prt, the command line frontend of App::PRT, and honestly? she's iconic. let's go 🫢


✨ NAME ✨

prt β€” the command line frontend of App::PRT. that's it, that's the name, short and slay.


🌸 SYNOPSIS 🌸

bestie, the vibe is literally just this:

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

you give her a <command>, you give her <args>, and optionally you hand over some <files> too. done. periodt. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so, prt is the command line frontend of App::PRT. that's the whole description, no notes, no lore, just a little doorway into the library. iykyk. ✨


πŸ‘‘ SUBCOMMANDS πŸ‘‘

this is the main character section, ngl. here's every single subcommand she has:

  • replace_token β€” swaps a token out. wanna replace "foo" token with "bar"? like this:
prt replace_token foo bar

and if you're picky (valid) and you want to replace "foo" token with "bar" but only when the target statements also have the "bazz" token, you add the filter:

prt replace_token foo bar --in-statement bazz

obsessed with the precision honestly. πŸŽ€

  • rename_class β€” renaming a class, but make it one line. this renames the "Foo" class to the "Bar" class:
prt rename_class Foo Bar
  • rename_namespace β€” bigger energy than rename_class: this one renames "Foo" and "Foo::*" classes over to "Bar" and "Bar::*" classes. so the whole namespace comes with you:
prt rename_namespace Foo Bar
  • delete_method β€” be so fr, sometimes a method has to go. this deletes the "eat" method from the "Food" class:
prt delete_method Food eat

(rip eat, you served cunt. πŸ’€)

  • move_class_method β€” this one relocates things. it moves the method method in the Class class to become the another_method method in the AnotherClass class. and heads up: "Class"'s including packages get copied over to "AnotherClass" too, so nothing gets left behind:
prt move_class_method 'Class#method' 'AnotherClass#another_method'

note those single quotes, bestie, keep them exactly like that.

  • introduce_variables β€” this one prints the variables in the source code. and the slay part? this command accepts input from STDIN. so all of these work:
prt introduce_variables a.pl
cat a.pl | prt introduce_variables
pbpaste | prt introduce_variables

pipe it, paste it, file it, whatever. she eats. πŸ”₯

  • list_files β€” lists the files that "App::PRT" would process. super useful, like, for example if you want to search the contents of the Perl sources in a project:
grep "some_regex" `prt list_files`

and the -0 argument makes outputs get separated by "\0" instead of the default "\n". which is giving safe-for-weird-filenames energy. for example:

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

🧚 TARGET FILES 🧚

you can specify the target files you want 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). so in that command up there, the shell has to expand the "**/*.pm" and "*.t" for you. don't expect App::PRT to do it, she will not. πŸ™ˆ

without target files, "App::PRT" detects source files in your project automatically. she looks for a "cpanfile" to detect the project's root directory. and when she's executed in a git repository, all files in the repository are used. like:

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

so if you just want the whole current working directory project refactored, no file list needed, she's got you. πŸ’œ


🌈 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. open source royalty, as she should be. πŸ‘‘


πŸ’– AUTHOR πŸ’–

hitode909 <hitode909@gmail.com>


and that's the whole page, bestie!! ✨ this was PRT(1p) from perl v5.36.0, dated 2023-10-03, brought to you by User Contributed Perl Documentation. now go refactor something cute. mwah. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from