#!/usr/bin/perl -Ilib/

=head1 NAME

dump - Show recent pastes.

=cut

=head1 SYNOPSIS

  dump

  Options:

     None.

=cut

=head1 ABOUT

This shows recent pastes.
=cut

=head1 LICENSE

Copyright (c) 2016 by Steve Kemp.  All rights reserved.

This module is free software; you can redistribute it and/or modify it
under the terms of either:

a) the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version,
or

b) the Perl "Artistic License".

=cut

=head1 AUTHOR

 Steve
 --
 http://www.steve.org.uk/

=cut

use strict;
use warnings;


#
# Add ~/current/lib to the load-path, if this directory exists.
#
# This is just a cheat for Steve, but should be harmless.
#
BEGIN
{
    push( @INC, $ENV{ 'HOME' } . "/current/lib" )
      if ( -d $ENV{ 'HOME' } . "/current/lib" );
}


#
# Load our library interface
#
use Redis::SQLite;

#
# Open a handle.
#
my $redis = Redis::SQLite->new();

#
# Process each key
#
foreach my $key ( $redis->keys("MARKDOWN:.*:IP") )
{
    my $ip = $redis->get($key);

    $key =~ s/^MARKDOWN://g;
    $key =~ s/:IP$//;

    print "https://markdownshare.com/view/$key    - $ip\n";
}

exit(0);
