text stringlengths 0 834k |
|---|
if ($arg =~ s/^\s*,?\s*(\d+)\s*-\s*(\d+)//) { |
push @numbers, ($1 .. $2); |
} |
elsif ($arg =~ s/^\s*,?\s*(\d+)//) { |
push @numbers, $1; |
} |
else { |
last; |
} |
} |
} |
@numbers; |
} |
sub raw_args { |
my $o = shift; |
strip($o->line_args); |
} |
sub strip { |
my $f = shift; |
$f =~ s/^\s*//; |
$f =~ s/\s*$//; |
$f; |
} |
# matches(""neil"", ""ne|il"") => 1 |
# matches(""ne"", ""ne|il"") => 1 |
# matches(""n"", ""ne|il"") => 0 |
sub matches { |
my $cmd = shift; |
my $pat = shift || """"; |
my ($required, $extra) = split '\|', $pat; |
$extra ||= """"; |
my $regex = ""$required(?:""; |
for (my $i=1; $i<=length($extra); $i++) { |
$regex .= '|' . substr($extra, 0, $i); |
} |
$regex .= "")""; |
return $cmd =~ /^$regex$/i; |
} |
sub pause_exit { |
my $o = shift; |
my $exit_code = shift || 0; |
my $pause = shift || 0; |
if ($pause) { |
if ($o->have_readkey) { |
$o->inform(""Hit any key to exit...""); |
} |
else { |
$o->inform(""Hit <ENTER> to exit...""); |
} |
$o->readkey; |
} |
exit $exit_code; |
} |
#============================================================================ |
# Check if this is the first time we've ever used profiles. This can be |
# guessed: if the 'profile' entry is not set, but the 'profile-track' flag |
# is, then it's the first time profile-track has been set to '1'. |
#============================================================================ |
sub setup_profile { |
my $o = shift; |
$o->inform(<<END); |
$SEP |
You have profile tracking turned on: now it's time to choose a profile name. |
ActiveState's PPM 3 Server will track which packages you have installed on |
your machine. This information is stored in a ""profile"", located on the |
server. |
Here are some features of profiles: |
o You can have as many profiles as you want; |
o Each profile can track an unlimited number of packages; |
o PPM defaults to ""tracking"" your profile (it updates your profile every time |
you add or remove a package; |
o You can disable profile tracking by modifying the 'profile-track' option; |
o You can manually select, save, and restore profiles; |
o You can view your profile from ASPN as well as inside PPM 3. |
$SEP |
END |
my $response = PPM::UI::profile_list(); |
my @l; |
unless ($response->ok) { |
$o->warn(""Failed to enable profile tracking: "".$response->msg); |
$o->warn(<<END); |
You can still use PPM3, but profiles are not enabled. To try setting up |
profiles again, enter 'set profile-track=1'. Or, you can set up profiles |
by hand, using the 'profile add' command. |
END |
$o->run('unset', 'profile-track'); |
return; |
} |
else { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.