File: storable-test.pl

package info (click to toggle)
liburi-perl 1.35.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 540 kB
  • ctags: 258
  • sloc: perl: 4,293; makefile: 51
file content (28 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!perl -w

use strict;
use Storable;

if (@ARGV && $ARGV[0] eq "store") {
    require URI;
    require URI::URL;
    my $a = {
        u => new URI('http://search.cpan.org/'),
    };
    print "# store\n";
    store [URI->new("http://search.cpan.org")], 'urls.sto';
} else {
    print "# retrieve\n";
    my $a = retrieve 'urls.sto';
    my $u = $a->[0];
    #use Data::Dumper; print Dumper($a);

    print "not " unless $u eq "http://search.cpan.org";
    print "ok 1\n";

    print "not " unless $u->scheme eq "http";
    print "ok 2\n";

    print "not " unless ref($u) eq "URI::http";
    print "ok 3\n";
}