Skip to content

Instantly share code, notes, and snippets.

@jashank
Created June 24, 2012 03:50
Show Gist options
  • Save jashank/2981483 to your computer and use it in GitHub Desktop.
Save jashank/2981483 to your computer and use it in GitHub Desktop.
Converting collection to individual
has 'Title' => (
isa => 'Scrivener::Title',
is => 'ro',
traits => [qw(XML)],
lazy => 1,
description => {
LocalName => "Title",
Prefix => "",
node_type => "child",
Name => "Title",
NamespaceURI => "",
sort_order => 7,
},
);
has 'Title_collection' => (
isa => 'ArrayRef[Scrivener::Title]',
is => 'ro', init_arg => 'Titles',
traits => [qw(XML Array)],
lazy => 1,
auto_deref => 1,
default => sub { [] },
handles => { add_Title => ['push'] }, description => {
LocalName => "Title",
Prefix => "",
node_type => "child",
Name => "Title",
NamespaceURI => "",
sort_order => 7,
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment