line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::Shell; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Goo::Shell.pm |
11
|
|
|
|
|
|
|
# Description: Create a GooShell The Goo> |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 23/08/2005 Auto generated file |
16
|
|
|
|
|
|
|
# 23/08/2005 Wanted to do filename completion for "Things" |
17
|
|
|
|
|
|
|
# 23/08/2005 Added method: X |
18
|
|
|
|
|
|
|
# 23/08/2005 Deleted method: X |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
############################################################################### |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
12195
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
54
|
use Goo; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Goo::Loader; |
26
|
|
|
|
|
|
|
use Goo::Prompter; |
27
|
|
|
|
|
|
|
use Goo::TypeManager; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
############################################################################### |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# do - run the shell in an interactive loop |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
############################################################################### |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub do { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# say hello! |
39
|
|
|
|
|
|
|
Goo::Prompter::say(); |
40
|
|
|
|
|
|
|
Goo::Prompter::yell("Welcome to The Goo"); |
41
|
|
|
|
|
|
|
Goo::Prompter::say(); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
while (1) { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $command = Goo::Prompter::prompt("The Goo"); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my ($arg1, $arg2) = split(/\s+/, $command); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
next unless ($arg1); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
exit if ($arg1 =~ /exit|bye|quit/i); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if ($arg1 =~ /(z|zone)/i) { |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $zone_thing = Goo::Loader::load("tail.trail"); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# show a profile of the tail of the trail |
58
|
|
|
|
|
|
|
$zone_thing->do_action("P"); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} elsif (Goo::TypeManager::is_valid_thing($arg2)) { |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $thing = Goo::Loader::load($arg2); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
if ($thing->isa("Goo::Thing")) { |
65
|
|
|
|
|
|
|
$thing->do_action($arg1); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} else { |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# shell command - do it! |
71
|
|
|
|
|
|
|
system("$command"); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Goo::Shell - Create a GooShell The Goo> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use Goo::Shell; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=over |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item do |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
run the shell in an interactive loop |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SEE ALSO |
113
|
|
|
|
|
|
|
|