| Jifty-DBI documentation | Contained in the Jifty-DBI distribution. |
Jifty::DBI::Filter::URI - Encodes uniform resource identifiers
If the value is a URI, encode it to its string form. Otherwise, do nothing.
If value is defined, then decode it using as_string in URI, otherwise do nothing.
| Jifty-DBI documentation | Contained in the Jifty-DBI distribution. |
#!/usr/bin/env perl package Jifty::DBI::Filter::URI; use strict; use warnings; use base 'Jifty::DBI::Filter'; use URI;
sub encode { my $self = shift; my $value_ref = $self->value_ref; return unless ref $$value_ref and $$value_ref->isa('URI'); $$value_ref = $$value_ref->as_string; return 1; }
sub decode { my $self = shift; my $value_ref = $self->value_ref; return unless defined $$value_ref and length $$value_ref; $$value_ref = URI->new($$value_ref); }
1;