| 1 | ## XML::Generator::RSS10::lgcl | ||
| 2 | ## An extension to Dave Rolsky's XML::Generator::RSS10 to handle categories in the UK Local Government Category List | ||
| 3 | ## To be used in conjunction with XML::Generator::RSS10::egms | ||
| 4 | ## Written by Andrew Green, Article Seven, http://www.article7.co.uk/ | ||
| 5 | ## Sponsored by Woking Borough Council, http://www.woking.gov.uk/ | ||
| 6 | ## Last updated: Monday, 6 December 2004 | ||
| 7 | |||
| 8 | package XML::Generator::RSS10::lgcl; | ||
| 9 | |||
| 10 | 1 | $VERSION = '0.02'; | |
| 11 | |||
| 12 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 1 | ▶ | use base 'XML::Generator::RSS10::Module'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 1 | 1; | |
| 18 | |||
| 19 | #### | ||
| 20 | |||
| 21 | 0 | ▶ | sub NamespaceURI { |
|
Subroutine
NamespaceURI: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 22 | |||
| 23 | 0 | 'http://www.esd.org.uk/standards/lgcl/1.03/lgcl-schema#' | |
| 24 | |||
| 25 | } | ||
| 26 | |||
| 27 | #### | ||
| 28 | |||
| 29 | 0 | ▶ | sub category { |
|
Subroutine
category: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 30 | |||
| 31 | 0 | my ($self,$rss,$category_value) = @_; | |
| 32 | |||
| 33 | 0 | my $camelcategory = $self->_camelcase($category_value); | |
| 34 | |||
| 35 | 0 | $rss->_start_element('lgcl',$camelcategory); | |
| 36 | 0 | $rss->_newline_if_pretty; | |
| 37 | 0 | $rss->_element_with_data('rdf','value',$category_value); | |
| 38 | 0 | $rss->_newline_if_pretty; | |
| 39 | 0 | $rss->_end_element('lgcl',$camelcategory); | |
| 40 | 0 | $rss->_newline_if_pretty; | |
| 41 | |||
| 42 | } | ||
| 43 | |||
| 44 | #### | ||
| 45 | |||
| 46 | 0 | ▶ | sub _camelcase { |
|
Subroutine
_camelcase: not called CC=1 SCAR=6.9
| |||
| 47 | |||
| 48 | 0 | my ($self,$cat) = @_; | |
| 49 | 0 | $cat =~ s/\s*(\w+)\s*/\u\L$1/g; | |
| 50 | 0 | $cat =~ s/[^A-Za-z]//g; | |
| 51 | 0 | return $cat; | |
| 52 | |||
| 53 | } | ||
| 54 | |||
| 55 | #### | ||
| 56 | |||
| 57 | __END__ | ||