1Graph::Easy::Base(3) User Contributed Perl Documentation Graph::Easy::Base(3)
2
3
4
6 Graph::Easy::Base - base class for Graph::Easy objects like nodes,
7 edges etc
8
10 package Graph::Easy::My::Node;
11 use Graph::Easy::Base;
12 @ISA = qw/Graph::Easy::Base/;
13
15 Used automatically and internally by Graph::Easy - should not be used
16 directly.
17
19 new()
20 my $object = Graph::Easy::Base->new();
21
22 Create a new object, and call "_init()" on it.
23
24 error()
25 $last_error = $object->error();
26
27 $object->error($error); # set new messages
28 $object->error(''); # clear the error
29
30 Returns the last error message, or '' for no error.
31
32 When setting a new error message, "$self->_croak($error)" will be
33 called unless "$object->no_fatal_errors()" is true.
34
35 error_as_html()
36 my $error = $object->error_as_html();
37
38 Returns the same error message as error(), but properly escaped as HTML
39 so it is safe to output to the client.
40
41 warn()
42 $object->warn('Warning!');
43
44 Warn on STDERR with the given message.
45
46 no_fatal_errors()
47 $object->no_fatal_errors(1);
48
49 Set the flag that determines whether setting an error message via
50 "error()" is fatal, e.g. results in a call to "_croak()".
51
52 A true value will make errors non-fatal. See also fatal_errors.
53
54 fatal_errors()
55 $fatal = $object->fatal_errors();
56 $object->fatal_errors(0); # turn off
57 $object->fatal_errors(1); # turn on
58
59 Set/get the flag that determines whether setting an error message via
60 "error()" is fatal, e.g. results in a call to "_croak()".
61
62 A true value makes errors fatal.
63
64 catch_errors()
65 my $catch_errors = $object->catch_errors(); # query
66 $object->catch_errors(1); # enable
67
68 $object->...(); # some error
69 if ($object->error())
70 {
71 my @errors = $object->errors(); # retrieve
72 }
73
74 Enable/disable catching of all error messages. When enabled, all
75 previously caught error messages are thrown away, and from this poin on
76 new errors are non-fatal and stored internally. You can retrieve these
77 errors later with the errors() method.
78
79 catch_warnings()
80 my $catch_warns = $object->catch_warnings(); # query
81 $object->catch_warnings(1); # enable
82
83 $object->...(); # some error
84 if ($object->warning())
85 {
86 my @warnings = $object->warnings(); # retrieve
87 }
88
89 Enable/disable catching of all warnings. When enabled, all previously
90 caught warning messages are thrown away, and from this poin on new
91 warnings are stored internally. You can retrieve these errors later
92 with the errors() method.
93
94 catch_messages()
95 # catch errors and warnings
96 $object->catch_messages(1);
97 # stop catching errors and warnings
98 $object->catch_messages(0);
99
100 A true parameter is equivalent to:
101
102 $object->catch_warnings(1);
103 $object->catch_errors(1);
104
105 See also: catch_warnings() and catch_errors() as well as errors() and
106 warnings().
107
108 errors()
109 my @errors = $object->errors();
110
111 Return all error messages that occurred after catch_messages() was
112 called.
113
114 warnings()
115 my @warnings = $object->warnings();
116
117 Return all warning messages that occurred after catch_messages() or
118 catch_errors() was called.
119
120 self()
121 my $self = $object->self();
122
123 Returns the object itself.
124
125 class()
126 my $class = $object->class();
127
128 Returns the full class name like "node.cities". See also "sub_class".
129
130 sub_class()
131 my $sub_class = $object->sub_class();
132
133 Returns the sub class name like "cities". See also "class".
134
135 main_class()
136 my $main_class = $object->main_class();
137
138 Returns the main class name like "node". See also "sub_class".
139
141 None by default.
142
144 Graph::Easy.
145
147 Copyright (C) 2004 - 2008 by Tels <http://bloodgate.com>.
148
149 See the LICENSE file for more details.
150
151perl v5.28.0 2016-06-06 Graph::Easy::Base(3)