1Sprog::GearMetadata(3)User Contributed Perl DocumentationSprog::GearMetadata(3)
2
3
4
6 Sprog::GearMetaData - Information about installed Sprog::Gear classes
7
9 This class is responsible for auto-discovering installed gear classes
10 and determining their attributes.
11
12 Querying the attributes of a class does not cause the class file to be
13 compiled. Instead, each gear class is expected to start with a special
14 metadata POD section, like this:
15
16 package Sprog::Gear::Grep;
17
18 =begin sprog-gear-metadata
19
20 title: Pattern Match
21 type_in: P
22 type_out: P
23 keywords: grep regex regular expression search
24
25 =end sprog-gear-metadata
26
27 =cut
28
29 A cache of metadata is maintained so that each gear class file only
30 needs to be parsed once.
31
33 The following attributes can be defined in the metadata section:
34
35 title
36 Mandatory - defines the text which will appear on the gear.
37
38 type_in
39 Mandatory - the input connector type. One of:
40
41 _ - no connector
42 P - a 'Pipe' connector
43 A - a 'List' connector
44 H - a 'Record' connector
45
46 type_out
47 Mandatory - the output connector type. (Same values as above).
48
49 keywords
50 An optional list of keywords that describe the gears function.
51 Used by the palette search function.
52
53 no_properties
54 An optional boolean which should be set to true (1) if the gear has
55 no properties dialog. This will cause the properties option to be
56 greyed out on the gear's right-click menu.
57
58 view_subclass
59 An optional attribute for defining a view (user interface) class
60 for the gear. Rather than defining the whole class name, only the
61 final component is required. For example, the
62 Sprog::Gear::TextWindow gear sets this value to 'TextWindow' which
63 gets translated to Sprog::GtkGearView::TextWindow.
64
65 custom_command_gear
66 This flag should be true for a gear created via the 'Make Command
67 Gear' dialog and false otherwise.
68
70 gear_class_info( class_name )
71 Given a full class name (eg: "Sprog::Gear::ReadFile"), this method
72 returns a metadata object describing the class. Returns undef if the
73 class does not exist or does not define the required metadata POD
74 section.
75
76 search( input_connector_type, output_connector_type, keywords )
77 Returns a list of all classes matching the supplied arguments (all of
78 which are optional). If no arguments are supplied, a list of all known
79 gear classes will be returned.
80
81 The input and output connector type arguments should each be a single
82 character as follows:
83
84 * - accept any connector type (this is the default)
85 _ - no connector at all (ie: input or output gears)
86 P - a 'Pipe' connector
87 A - a 'List' connector
88 H - a 'Record' connector
89
90 The 'keywords' argument (if supplied) should be a string which will be
91 used for a case-insensitive match against each gear's title and
92 keywords attributes.
93
94 The list of gears returned will be those that match all three arguments
95 (or as many as were supplied).
96
97 connector_types
98 This method returns a list of connector type names and the
99 corresponding codes. It is intended to be used to build GUI widgets
100 for selecting input and output connector types.
101
103 Each metadata object returned from "gear_class_info()" or "search()"
104 will have the following (read-only) properties:
105
106 class
107 The class name for the gear (eg: "Sprog::Gear::ReadFile").
108
109 file
110 The pathname of the file which defines the class.
111
112 title
113 The human-readable name of the gear.
114
115 type_in
116 The type of the input connector ('_', 'P', 'A' or 'H').
117
118 type_out
119 The type of the output connector (same values as for "type_in").
120
121 keywords
122 A space separated string of keywords describing the gear.
123
124 view_subclass
125 The gear view subclass which implements the gear's user interface.
126
128 Copyright 2004-2005 Grant McLean <grantm@cpan.org>
129
130 This library is free software; you can redistribute it and/or modify it
131 under the same terms as Perl itself.
132
133
134
135perl v5.12.0 2005-07-02 Sprog::GearMetadata(3)