The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::OReillyMedia::Store - Interface to the OReilly Media Store.

VERSION

Version 0.06

DESCRIPTION

Objective of this module is to provide an interface to the OReilly online media store.

METHODS

fetch_books()

Fetches books details from OReilly online store realtime. It does so as part of constructor functionality. You DONT really need to do call this explicitly. However it is still there for you to play with it.

search_book()

Search for a book in the book store. Search can be done by it's id, description, released year,price,ebook and online availability. Each of this can be provided as key to the anonymous hash.

    use strict; use warnings;
    use WWW::OReillyMedia::Store;

    my ($store, $books);
    $store = WWW::OReillyMedia::Store->new();

    # Search by ID.
    $books = $store->search_book({id => 9780596005054});
    print $books->[0]->as_string();
    
    # Search by Description.
    $books = $store->search_book({description => '.NET Framework Essentials'});
    print $books->[0]->as_string();    
    
    # Search by Released year.
    $books = $store->search_book({released => 'Mar 2003'});
    print $books->[0]->as_string();
    
    # Search by price i.e. less than or equal to $10.
    $books = $store->search_book({price => 10});
    print $books->[0]->as_string();
    
    # Search by ebook i.e. return all ebooks.
    $books = $store->search_book({ebook => 1});
    print $books->[0]->as_string();

    # Search by online i.e. return all online books.
    $books = $store->search_book({online => 1});
    print $books->[0]->as_string();
    

book_count()

Returns the total books count in the OReilly online store.

    use strict; use warnings;
    use WWW::OReillyMedia::Store;

    my $store = WWW::OReillyMedia::Store->new();
    print "Count: [" . $store->book_count() . "]\n"

get_all_books()

Returns all the books that have been fetched from the OReilly online store. Data would be in the form of list of objects of class WWW::OReillyMedia::Store::Book.

    use strict; use warnings;
    use WWW::OReillyMedia::Store;

    my $store = WWW::OReillyMedia::Store->new();
    my $books = $store->get_all_books();
    print $books->[0]->as_string();

as_string()

Return all books in human readable format.

    use strict; use warnings;
    use WWW::OReillyMedia::Store;

    my $store = WWW::OReillyMedia::Store->new();
    # Be warned, it is a bit slow and most likely to bring back quite a lot of output.
    print $store;

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-www-oreillymedia-store at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-OReillyMedia-Store. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::OReillyMedia::Store

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.