This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Be sure to find the vmsish pragma for one-liners in exit.t.
[perl5.git] / lib / CPAN / Prompt.pm
CommitLineData
f9916dde
A
1# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2# vim: ts=4 sts=4 sw=4:
3package CPAN::Prompt;
4use overload '""' => "as_string";
5use vars qw($prompt);
6use vars qw(
7 $VERSION
8);
9$VERSION = "5.5";
10
11
12$prompt = "cpan> ";
13$CPAN::CurrentCommandId ||= 0;
14sub new {
15 bless {}, shift;
16}
17sub as_string {
18 my $word = "cpan";
19 unless ($CPAN::META->{LOCK}) {
20 $word = "nolock_cpan";
21 }
22 if ($CPAN::Config->{commandnumber_in_prompt}) {
23 sprintf "$word\[%d]> ", $CPAN::CurrentCommandId;
24 } else {
25 "$word> ";
26 }
27}
28
291;