Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

CPAN shell command formatting

by hda (Chaplain)
on May 29, 2022 at 16:01 UTC ( [id://11144264]=perlquestion: print w/replies, xml ) Need Help??

hda has asked for the wisdom of the Perl Monks concerning the following question:

I have been using Perl for so long that this question may seem right out silly. Perhaps it is. Please, excuse my ignorance, fellow monks.

I have Perl now in at least two computers. Both recent installations. In one of them, the CPAN shell commands are displayed as bold (fat) white, which I find visually pleasing. In another machine commands are displayed in plain style. I wish to be able to set it to bold as well. How do I do that?

Believe me I cannot find anywhere which module or setting applies to change this. Any hint is appreciated.

Replies are listed 'Best First'.
Re: CPAN shell command formatting
by Discipulus (Canon) on May 30, 2022 at 06:48 UTC
    Hello hda,

    evidently I dint followed links provided in this reply before posting :)

    I dont really know but perhaps CPAN defaults are changed over years

    cpan> o conf ... colorize_debug undef colorize_output [0] colorize_print [bold green] colorize_warn [bold red] ...

    If it is not this, check also cpan -v and cpan -V output to spot eventual differences.



    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Thank you, Discipulus

      That part looks like this in both cases:
      colorize_debug undef colorize_output [0] colorize_print undef colorize_warn undef
Re: CPAN shell command formatting
by LanX (Saint) on May 29, 2022 at 16:04 UTC
    I'm also ignorant of the CPAN shell, but

    • you should tell us the OS and the terminal used.
    • probably also check $ENV{TERM} at least the debugger depends on that.

    HTH! :)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Thanks for your response, Rolf. I use openSUSE (Tumbleweed) Linux, with XFCE desktop environment. $TERM is xterm-256color.
Re: CPAN shell command formatting
by tybalt89 (Monsignor) on May 30, 2022 at 10:15 UTC

    It may be whether, or which, Term::ReadLine is installed.

      Thank you for this. In both I have Term::ReadLine (1.14) and Term::ReadLine::Perl (1.0303).
      A difference is that I have Term::ReadLine::Gnu installed where I have plain characters but NOT in the machine where I see bold command characters. I will explore what may be behind this and eventually report back.
      Thank you monks!

      This was also pointed out yesterday by Rolf, see above.
        Well, I may have found the answer. Obviously reading the documentation :-)

        As pointed out by Rolf above (Re^3: CPAN shell command formatting), Term::ReadLine::Gnu and Term::ReadLine::Perl are possibly not entirely compatible. After exporting the variable:
        export "PERL_RL=Perl o=1"
        Where "o=1" stands for ornaments are activated, which was also the setting in o conf. Things look as I desired now.

        Thank you everyone for the kind help!
Re: CPAN shell command formatting
by Anonymous Monk on May 30, 2022 at 04:03 UTC
    Well, in principle it's
    my $bold = "\e[1m"; my $plain = "\e[m"; print "${bold}Bold text${plain} Plain text\n";
    Don't know about the CPAN shell specifically, but if it's to produce "fancy" looking output, it needs to send escape sequences to the terminal, like the ones above...
      So I checked the xfce4-terminal (version and it does have a setting "Allow bold text". When I disable it all bolded text is displayed as plain. It's in Edit -> Preferences -> Appearance. So maybe it's just your terminal.
        Yes, I have xfce4-terminal 1.0.3 and that options is available and enabled.
Re: CPAN shell command formatting
by harangzsolt33 (Chaplain) on May 30, 2022 at 13:55 UTC
    You do not say what operating system is installed on those two computers. If you use Windows, you can go to the window's header and right-click on it and select Properties. It should be under the Font tab. Finally, when you click on OK, it will ask you if you want to make these changes for this window only or if you want these settings to apply every time for all shell windows.

    I like to use the bold large text too, so I changed the font size so that the shell window fills up the whole screen.

    If your question is about configuring the syntax highlighting within your text editor so that shell commands (the text within ``) would display in bold, then again, we would need to know which text editor you're using. You didn't mention it. I use Notepad2 in which I Just go to View menu >> Custom Schemes >> Perl Script >> Backticks. And then I enter this: "fore:#FFFFFF; bold;" without the quotes which makes the text appear in bold white letters.

    Edit: I just read the comments, and I noticed that you're asking about a Linux system. Sorry. Just ignore my comment. How do I delete what I wrote here? There's an Edit option, but there's no Delete.

        > BTW, this is now solved.

        Next time better reply to the sub-thread which solved it, because it's the first and top-voted reply you got.

        So either way people sort they will read that one first, instead of needing to scroll halfway thru. :)

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

      hello harangzsolt33

      The op did not supply enough info for you to help them resolve their query...

      No need to spend time answering a question the info you reckon they may be relating their question to. I also reccomend avoiding further reflective anguish by previewing your response in your personal scratchpad before posting. It does take a lot of experience to really distingiush the probable info they refer to, and even then its usually a waste of time as users will inevitably have some unique variation that overode their laziness directive into asking the question in the first place.

      Also on *Nix type systems you can get a full screen shell window with the Alt+F7 key combo, something akin to Alt+Tabbing on Dos type implementations.

      I do not know if it is possible to delete posts here. Moderators surely know. Otherwise do not worry.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11144264]
Approved by LanX
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-05-18 03:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found