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

NAME

ZConf::Weather - A ZConf module for fetching weather information.

VERSION

Version 1.0.0

SYNOPSIS

    use ZConf::Weather;

    my $zcw = ZConf::Weather->new();
    ...

FUNCTIONS

new

This initializes it.

One arguement is taken and that is a hash value.

If this function errors, it will will be set permanently.

hash values

zconf

This is the a ZConf object.

    my $zcw=ZConf::Weather->new();
    if($zcw->{error}){
        print "Error!\n";
    }

getDefaultLocal

This gets what the default local is set to.

    my $local=$zcw->getDefaultLocal;
    if($zcw->{error}){
        print "Error!\n";
    }

getDefaultType

This gets what the default type is set to.

    my $local=$zcw->getDefaultType;
    if($zcw->{error}){
        print "Error!\n";
    }

getSet

This gets what the current set is.

    my $set=$zcw->getSet;
    if($zbm->{error}){
        print "Error!\n";
    }

getTemplate

This returns a template as a string.

    my $template=$zcw->getTemplate('some/template');
    if ($zcw->{error}) {
        print "Error!\n";
    }

getWeather

Returns the arrayref from Weather::Underground->get_weather.

The only arguement required is the name of the local.

    $aref=$zcw->getWeather('someLocal');
    if($zcw->{error}){
        print "Error!\n";
    }

getWeatherObj

This fetches the Weather::Underground object.

The only arguement accepted is the name of the local.

    my $wu=$zcw->getWeatherObj('someLocal');
    if($zcw->{error}){
        print "Error!";
    }

init

This initializes it or a new set.

If the specified set already exists, it will be reset.

One arguement is required and it is the name of the set. If it is not defined, ZConf will use the default one.

    #creates a new set named foo
    $zcw->init('foo');
    if($zcw->{error}){
        print "Error!\n";
    }

    #creates a new set with ZConf choosing it's name
    $zcw->init();
    if($zcw->{error}){
        print "Error!\n";
    }

listLocals

This gets a list of available locals.

    my @locals=$zcw->listLocals;
    if($zcw->{error}){
        print "Error!\n";
    }

listSets

This lists the available sets.

    my @sets=$zcw->listSets;
    if($zcw->{error}){
        print "Error!";
    }

listTemplates

This gets a list of available templates.

    my @templates=$zcw->listTemplates;
    if($zcw->{error}){
        print "Error!\n";
    }

localExists

This makes sure a specified local exists.

    my $returned=$zcw->localExists('somelocal');
    if($zcw->{error}){
        print "Error!\n";
    }else{
        if($returned){
            print "It exists.\n";
        }
    }

readSet

This reads a specific set. If the set specified is undef, the default set is read.

    #read the default set
    $zcw->readSet();
    if($zcr->{error}){
        print "Error!\n";
    }

    #read the set 'someSet'
    $zcw->readSet('someSet');
    if($zcr->{error}){
        print "Error!\n";
    }

run

This acts on a local using it's defined type.

    $zcw->run('someLocal');
    if($zcw->{error}){
        print "Error!\n";
    }

setLocal

This sets a local. If it does not exist, it will be created. An already existing one will be overwriten.

argsHash

local

This is the local it is for.

name

This is name that will be used differentiating between the various locals setup. It needs to be a valid ZConf set name.

type

This is what to do with it after downloading it.

template

The template to use if 'type' is set to 'template'.

setTemplate

This sets a specified template to the given value.

    $zcw->setTemplate($templateName, $template);
    if ($zcw->{error}) {
        print "Error!\n";
    }

templateExists

This makes sure a specified template exists.

    my $returned=$zcw->templateExists('someTemplate');
    if($zcw->{error}){
        print "Error!\n";
    }else{
        if($returned){
            print "It exists.\n";
        }
    }

errorblank

This blanks the error storage and is only meant for internal usage.

It does the following.

    $self->{error}=undef;
    $self->{errorString}="";

ERROR CODES

1

Could not initialize ZConf.

2

ZConf error.

3

No local defined.

4

Invalid set name.

5

No type specified.

6

No template name specified.

7

Non-existant template.

8

Invalid type specified.

9

No template specified.

10

Local does not exist.

11

Failed to init the module Weather::Underground.

12

Failed to fetch the weather.

13

Template does not exist.

14

The type is not valid.

15

No default local specified.

16

getDefaultLocal errors and no local is specified.

17

No default type specified.

ZConf Keys

Misc Keys

defaultLocal

This is the default local to act upon if not specified.

defaultType

This is the default thing to do.

defaultTemplate

This is the default template name to use.

Local Keys

locals/*/local

This is the location it is for. It can be specified as 'City', 'City, State', 'State', 'State, Country', or 'Country'.

locals/*/type

This specifies what should be done when fetching it.

dump

Prints it in 'variable=value' format.

template

This prints it using the specied template name. The template name being 'templates/<name>'.

Template Keys

templates/*

This is a template. For please see the section TEMPLATE for more information on the keys and etc.

'*' can be any zconf compatible var name.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-zconf-weather at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-Weather. 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 ZConf::Weather

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Zane C. Bowers, all rights reserved.

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