Created
September 21, 2011 08:16
-
-
Save robinsmidsrod/1231541 to your computer and use it in GitHub Desktop.
Proposed sugar functions for XML::Rabbit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# signature: $attr_name, $xpath_query, @moose_params | |
# isa automatically set to 'Str' | |
# native trait automatically set to 'String' | |
has_xpath_value 'name' => './name', | |
... | |
; | |
# signature: $attr_name, $xpath_query, @moose_params | |
# isa automatically set to 'ArrayRef[Str]' | |
# native trait automatically set to 'Array' | |
has_xpath_value_list 'streets' => './street', | |
... | |
; | |
# signature: $attr_name, $xpath_query, $xpath_key, $xpath_value, @moose_params | |
# isa automatically set to 'HashRef[Str]' | |
# native trait automatically set to 'Hash' | |
has_xpath_value_map 'employee_map' => './employees/*', | |
'./@ssn' => './name', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, @moose_params | |
# isa automatically set to 'My::Department' | |
has_xpath_object 'department', | |
'My::Department' => './department', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, @moose_params | |
# isa automatically set to 'My::Department|My::Team' | |
has_xpath_object 'department', | |
{ | |
'department' => 'My::Department', | |
'team' => 'My::Team', | |
} | |
'./department|./team', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, @moose_params | |
# isa automatically set to 'ArrayRef[My::Customer]' | |
# native trait automatically set to 'Array' | |
has_xpath_object_list 'customers', | |
'My::Customer' => './customer', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, @moose_params | |
# isa automatically set to 'ArrayRef[My::Customer|My::Partner]' | |
# native trait automatically set to 'Array' | |
has_xpath_object_list 'externals', | |
{ | |
'customer' => 'My::Customer', | |
'partner' => 'My::Partner', | |
}, | |
'./customer|./partner', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, $xpath_key, @moose_params | |
# isa automatically set to 'HashRef[My::Product]' | |
# native trait automatically set to 'Hash' | |
has_xpath_object_map 'product_map' => 'My::Product', | |
'./products/*' => './@code', | |
... | |
; | |
# signature: $attr_name, $isa(map), $xpath_query, $xpath_key, @moose_params | |
# isa automatically set to 'HashRef[My::Product|My::My::Service]' | |
# native trait automatically set to 'Hash' | |
has_xpath_object_map 'merchandise_map', | |
{ | |
'service' => 'My::Service', | |
'product' => 'My::Product', | |
} | |
'./products/*|./services/*' => './@code', | |
... | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment