Skip to content
Browse files

examples/read_later.pl: add an example to use this module

  • Loading branch information...
1 parent 69a776a commit 618c2812c68d58367d903d1400041ed6f2652941 @edipretoro committed Aug 6, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 examples/read_later.pl
View
29 examples/read_later.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use lib '../lib';
+use WebService::Instapaper;
+
+use Getopt::Long;
+
+my $reader = WebService::Instapaper->new(
+ username => 'something', # required!!!
+ password => 's3cr3t', # optional, cfr http://www.instapaper.com
+);
+
+my $config = {};
+
+GetOptions( $config, 'url=s' );
+
+die "Usage: $0 --url http://www.perl.org\n" unless exists $config->{url};
+
+if ( $reader->add( url => $config->{url} ) ) {
+ print "The url (" . $config->{url} . ") has been added successfully.\n";
+}
+else {
+ print "We received the following error: ("
+ . $reader->code . ") "
+ . $reader->message . ".\n";
+}

0 comments on commit 618c281

Please sign in to comment.
Something went wrong with that request. Please try again.