use Text::ANSI::Printf; Text::ANSI::Printf::printf FORMAT, LIST Text::ANSI::Printf::sprintf FORMAT, LIST use Text::ANSI::Printf qw(ansi_printf ansi_sprintf); ansi_printf FORMAT, LIST ansi_sprintf FORMAT, LIST
Text::ANSI::Printf is a almost-printf-compatible library with a capability of handling string with ANSI terminal sequences, as well as multi-byte wide characters.
This is just a quick hack using existing modules, Text::VisualPrintf and Text::ANSI::Fold::Util. Not tuned for performance. Most of complicated work is done in Text::ANSI::Fold module.
INSTALL: cpanm https://github.com/kaz-utashiro/Text-ANSI-Printf.git