Changeset 24 in bookmarks


Ignore:
Timestamp:
05/22/13 21:24:00 (12 years ago)
Author:
peter
Message:

Bookmarks takjes an actual URI object as its base_uri attribute

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r22 r24  
    2121my $bookmarks = Bookmarks->new({ 
    2222    dbname   => $dbname, 
    23     base_uri => $base_uri->canonical, 
     23    base_uri => $base_uri, 
    2424}); 
    2525 
  • trunk/Bookmarks.pm

    r20 r24  
    33use Moose; 
    44use SQL::Interp qw{:all}; 
     5use URI; 
    56use Bookmark; 
    67 
    78has dbh      => ( is => 'rw' ); 
    8 has base_uri => ( is => 'ro' ); 
     9has base_uri => ( is => 'ro', isa => 'URI' ); 
    910 
    1011sub BUILD { 
     
    4445        $bookmark->{tags} = [ map { $$_[0] } @{ $sth_tag->fetchall_arrayref } ]; 
    4546        if ($self->base_uri) { 
    46             $bookmark->{bookmark_uri} = $self->base_uri . $bookmark->{id}; 
     47            $bookmark->{bookmark_uri} = URI->new_abs($bookmark->{id}, $self->base_uri); 
    4748        } 
    4849    } 
     
    9091        $resource->{tags} = [ map { $$_[0] } @{ $sth_tag->fetchall_arrayref } ]; 
    9192        if ($self->base_uri) { 
    92             $resource->{bookmark_uri} = $self->base_uri . $resource->{id}; 
     93            $resource->{bookmark_uri} = URI->new_abs($resource->{id}, $self->base_uri); 
    9394        } 
    9495        push @resources, $resource; 
Note: See TracChangeset for help on using the changeset viewer.