| 1 | package SWISH::Prog::Native::Result; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Carp; | ||
| 5 | use Data::Dump qw( dump ); | ||
| 6 | use base qw( SWISH::Prog::Class ); | ||
| 7 | |||
| 8 | __PACKAGE__->mk_accessors( | ||
| 9 | qw( | ||
| 10 | swishdocpath | ||
| 11 | swishlastmodified | ||
| 12 | swishtitle | ||
| 13 | swishdescription | ||
| 14 | swishrank | ||
| 15 | swishdbfile | ||
| 16 | swishdocsize | ||
| 17 | swishreccount | ||
| 18 | swishfilenum | ||
| 19 | swish_result | ||
| 20 | ) | ||
| 21 | ); | ||
| 22 | |||
| 23 | our $VERSION = '0.75'; | ||
| 24 | |||
| 25 | =head1 NAME | ||
| 26 | |||
| 27 | SWISH::Prog::Native::Result - result class for SWISH::API::Object | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | # see SWISH::Prog::Result | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | The Native Result implements the SWISH::Prog::Result API for | ||
| 36 | SWISH::API::Object results. | ||
| 37 | |||
| 38 | =head1 METHODS | ||
| 39 | |||
| 40 | =head2 swish_result | ||
| 41 | |||
| 42 | Returns the internal SWISH::API::More::Result object. | ||
| 43 | |||
| 44 | =head2 uri | ||
| 45 | |||
| 46 | Alias for swishdocpath(). | ||
| 47 | |||
| 48 | =head2 mtime | ||
| 49 | |||
| 50 | Alias for swishlastmodified(). | ||
| 51 | |||
| 52 | =head2 title | ||
| 53 | |||
| 54 | Alias for swishtitle(). | ||
| 55 | |||
| 56 | =head2 summary | ||
| 57 | |||
| 58 | Alias for swishdescription(). | ||
| 59 | |||
| 60 | =head2 score | ||
| 61 | |||
| 62 | Alias for swishrank(). | ||
| 63 | |||
| 64 | =head2 swishdocpath | ||
| 65 | |||
| 66 | =head2 swishlastmodified | ||
| 67 | |||
| 68 | =head2 swishtitle | ||
| 69 | |||
| 70 | =head2 swishdescription | ||
| 71 | |||
| 72 | =head2 swishrank | ||
| 73 | |||
| 74 | =head2 swishdbfile | ||
| 75 | |||
| 76 | =head2 swishdocsize | ||
| 77 | |||
| 78 | =head2 swishreccount | ||
| 79 | |||
| 80 | =head2 swishfilenum | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub uri { shift->swishdocpath } | ||
| 85 | sub mtime { shift->swishlastmodified } | ||
| 86 | sub title { shift->swishtitle } | ||
| 87 | sub summary { shift->swishdescription } | ||
| 88 | sub score { shift->swishrank } | ||
| 89 | |||
| 90 | =head2 get_property( I<property> ) | ||
| 91 | |||
| 92 | Returns the stored value for I<property> for this Result. | ||
| 93 | |||
| 94 | Same as calling property(). | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | sub get_property { | ||
| 99 | my $self = shift; | ||
| 100 | my $propname = shift or croak "propname required"; | ||
| 101 | if ( $self->can($propname) ) { | ||
| 102 | return $self->$propname; | ||
| 103 | } | ||
| 104 | return $self->swish_result->property($propname); | ||
| 105 | } | ||
| 106 | |||
| 107 | 1; | ||
| 108 | |||
| 109 | __END__ |