sub form_parse {
my $state = 0;
my @forms = ();
my @lines = split /\n/, $_[0];
####
sub get_attachment {
my $self = shift;
$self->_assert_even(@_);
my %opts = @_;
my $type = $self->_valid_type(delete($opts{type}) || 'ticket');
my $parent_id = $self->_valid_numeric_object_id(delete($opts{parent_id}));
my $id = $self->_valid_numeric_object_id(delete($opts{id}));
my $res = $self->_submit("$type/$parent_id/attachments/$id");
my $content;
if ($opts{undecoded}) {
$content = $res->content;
}
else {
$content = $res->decoded_content;
}
my $form = form_parse($content);
my ($c, $o, $k, $e) = @{$$form[0]};
####
get_attachment (parent_id => $id, id => $_)
####
get_attachment (parent_id => $parent_id, id => $id, undecoded => $bool)