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

NAME

Gas::Prices - Perl Module to get the gas prices around a particular zip code

VERSION

This document describes Gas::Prices version 0.0.1

SYNOPSIS

    use Gas::Prices;
    my $gp = new Gas::Prices("75023"); #or any other 

  

DESCRIPTION

Please use module WWW::Fuel::US::Prices instead. This module will no longer be supported.

The module gets gas prices for a given zip code. It gets its data by scraping msn autos webpage.

It retrieves a bunch of gas stations around the particular zip code, and for each gas station, it retrives the following data

EXAMPLE

The usage is as follows

    use Gas::Prices;
    my $gp = new Gas::Prices("75023"); #or any other zip code
    my @gas_stations = @{$gp->get_stations};
    
    foreach(@gas_stations)
    {
        print   "Station name:" . $_->{station_name} . "\n" .
                "Station address:" . $_->{station_address} . "\n" .
                "Unleaded price:" . $_>{unleaded_price} . "\n" .
                "Unleaded date:" . $_->{unleaded_date} . "\n" .
                "Plus price:" . $_->{plus_price} . "\n" .
                "Plus date:" . $_->{plus_date} . "\n" .
                "Premium price:" . $_->{premium_price} . "\n" .
                "Premium_date:" . $_->{premium_date} . "\n" .
                "Diesel price:" . $_->{diesel_price} . "\n" .
                "Diesel date:" . $_->{diesel_date} . "\n";
    }
    
    my $cheapest_unleaded = $gp->get_cheapest_station("unleaded");
    print "The cheapest unleaded grade gas near 75023 is " . $cheapest_unleaded->{station_name} . " at " . $cheapest_unleaded->{station_address} . ' for $' . $cheapest_unleaded->{unleaded_price} . "/gallon.";

INTERFACE

new

Creates a new Gas::Prices object, and fetches data. my $gp = new Gas::Prices("75023");

get_cheapest_station

Gets the gas stations with the cheapest price for a give type of gas my $unleaded_station = $gp->get_cheapest_station("unleaded"); my $diesel_station = $gp->get_cheapest_station("diesel");

The only valid values for the parameter are - unleaded - plus - premium - diesel

get_most_expensive_station

Works the same way as get_cheapest_station, but returns the station with the most expensive fuel for the given type.

get_stations

Gets all gas station info around the zip code

is_less

Used internally. Need a better way to do this.

is_greater

Same as is_less

CONFIGURATION AND ENVIRONMENT

Gas::Prices requires no configuration files or environment variables.

DEPENDENCIES

Gas::Prices uses HTTP::Lite.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-gas-prices@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Ashish Kasturia <ashoooo@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Ashish Kasturia <ashoooo@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.