Gas::Prices - Perl Module to get the gas prices around a particular zip code
This document describes Gas::Prices version 0.0.1
use Gas::Prices; my $gp = new Gas::Prices("75023"); #or any other
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
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.";
Creates a new Gas::Prices object, and fetches data. my $gp = new Gas::Prices("75023");
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
Works the same way as get_cheapest_station, but returns the station with the most expensive fuel for the given type.
Gets all gas station info around the zip code
Used internally. Need a better way to do this.
Same as is_less
Gas::Prices requires no configuration files or environment variables.
Gas::Prices uses HTTP::Lite.
None reported.
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.
bug-gas-prices@rt.cpan.org
Ashish Kasturia <ashoooo@cpan.org>
<ashoooo@cpan.org>
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.
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.
To install Gas::Prices, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gas::Prices
CPAN shell
perl -MCPAN -e shell install Gas::Prices
For more information on module installation, please visit the detailed CPAN module installation guide.