Changeset 1041 for trunk/core/lib/Foswiki/Attrs.pm
- Timestamp:
- 11/28/08 13:33:03 (3 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki/Attrs.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki/Attrs.pm
r830 r1041 1 1 # See bottom of file for license and copyright information 2 2 3 = pod3 =begin TML 4 4 5 5 ---+ package Foswiki::Attrs … … 21 21 to =new=. 22 22 23 =cut 23 API version $Date$ (revision $Rev$) 24 25 *Since* _date_ indicates where functions or parameters have been added since 26 the baseline of the API (TWiki release 4.2.3). The _date_ indicates the 27 earliest date of a Foswiki release that will support that function or 28 parameter. 29 30 *Deprecated* _date_ indicates where a function or parameters has been 31 [[http://en.wikipedia.org/wiki/Deprecation][deprecated]]. Deprecated 32 functions will still work, though they should 33 _not_ be called in new plugins and should be replaced in older plugins 34 as soon as possible. Deprecated parameters are simply ignored in Foswiki 35 releases after _date_. 36 37 *Until* _date_ indicates where a function or parameter has been removed. 38 The _date_ indicates the latest date at which Foswiki releases still supported 39 the function or parameter. 40 41 =cut 42 43 # THIS PACKAGE IS PART OF THE PUBLISHED API USED BY EXTENSION AUTHORS. 44 # DO NOT CHANGE THE EXISTING APIS (well thought out extensions are OK) 45 # AND ENSURE ALL POD DOCUMENTATION IS COMPLETE AND ACCURATE. 24 46 25 47 package Foswiki::Attrs; … … 28 50 use Assert; 29 51 30 use vars qw( $ERRORKEY $DEFAULTKEY $RAWKEY );31 32 $ERRORKEY = '_ERROR';33 $DEFAULTKEY = '_DEFAULT';34 $RAWKEY = '_RAW';35 36 = pod37 38 ---++ ClassMethod new ($string , $friendly) => \%attrsObjectRef52 our $VERSION = '$Rev$'; 53 54 our $ERRORKEY = '_ERROR'; 55 our $DEFAULTKEY = '_DEFAULT'; 56 our $RAWKEY = '_RAW'; 57 58 =begin TML 59 60 ---++ ClassMethod new ($string) => \%attrsObjectRef 39 61 40 62 * =$string= - String containing attribute specification 41 * =$friendly= - if true, the parse will be according to the extended syntax pioneered by the original Contrib::Attrs. Otherwise it will be strict as per traditional syntax.42 63 43 64 Parse a standard attribute string containing name=value pairs and create a new … … 46 67 set in the new object. $attrs->{_RAW} will always contain the full unprocessed 47 68 $string. 48 49 Extended syntax example:50 <verbatim>51 my $attrs = new Foswiki::Attrs('the="time \\"has come", "the walrus" said to=speak of=\'many \\'things\', 1);52 </verbatim>53 In this example:54 * =the= will be =time "has come=55 * <code>_<nop>_<nop>default__</code> will be =the walrus=56 * =said= will be =on=57 * =to= will be =speak=58 * =of= will be =many 'things=59 60 Only " and ' are escaped.61 62 Traditional syntax is as old TWiki, except that the whole string is parsed63 (the old parser would only recognise default values in position 1, nowhere64 else)65 69 66 70 =cut … … 142 146 } 143 147 144 = pod148 =begin TML 145 149 146 150 ---++ ObjectMethod isEmpty() -> boolean … … 159 163 } 160 164 161 = pod165 =begin TML 162 166 163 167 ---++ ObjectMethod remove($key) -> $value … … 176 180 } 177 181 178 = pod182 =begin TML 179 183 180 184 ---++ ObjectMethod stringify() -> $string
Note: See TracChangeset
for help on using the changeset viewer.
