Jonas B. Nielsen > WWW-DanDomain-0.01 > WWW::DanDomain

Download:
WWW-DanDomain-0.01.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs

Module Version: 0.01   Source   Latest Release: WWW-DanDomain-0.02

NAME ^

WWW::DanDomain - class to assist in interacting with DanDomain admin interface

VERSION ^

This documentation describes version 0.01

SYNOPSIS ^

The module lets the user interact with DanDomains administrative web interface. This can be used for automating tasks of processing data exports etc.

    use WWW::DanDomain;

    #All mandatory parameters
    my $wd = WWW::DanDomain->new({
        username => 'topshop',
        password => 'topsecret',
        url      => 'http://www.billigespil.dk/admin/edbpriser-export.asp',
    });


    #with verbosity enabled
    my $wd = WWW::DanDomain->new({
        username => 'topshop',
        password => 'topsecret',
        url      => 'http://www.billigespil.dk/admin/edbpriser-export.asp',
        verbose  => 1,
    });


    #With custom WWW::Mechanize object
    use WWW::Mechanize;

    my $mech = WWW::Mechanize->new(agent => 'MEGAnice bot');

    my $wd = WWW::DanDomain->new({
        username => 'topshop',
        password => 'topsecret',
        url      => 'http://www.billigespil.dk/admin/edbpriser-export.asp',
        mech     => $mech,
    });
    
    
    #The intended use
    package My::WWW::DanDomain::Subclass;
    
    sub processor {
        my ( $self, $content ) = @_;
        
        #Note the lines terminations are Windows CRLF
        my @lines = split /\r\n/, $$content;
        
        ...
        
        }
    }
    
    
    #Using your new class
    my $my = My::WWW::DanDomain::Subclass->new({
        username => 'topshop',
        password => 'topsecret',
        url      => 'http://www.billigespil.dk/admin/edbpriser-export.asp',
    });
    
    my $content = $my->retrieve();
    
    print $$content;

DESCRIPTION ^

This module is a simple wrapper around WWW::Mechnize it assists the user in getting going with automating tasks related to the DanDomain administrative web interface.

Such as:

METHODS ^

new

This is the constructor.

The constructor takes a hash reference as input. The hash reference should contain keys according to the following conventions:

retrieve

Parameters:

The method returns a scalar reference to a string containing the content retrieved from the URL provided to the contructor ("new"). If the "processor" method is overwritten you can manipulate the content prior to being returned.

processor

This is a stub and it might go away in the future. It does takes the content retrieved (see: "retrieve") from the URL parameter provided to the constructor (see: "new").

Parameters:

The stub does however not do anything, but it returns the scalar reference untouched.

DIAGNOSTICS ^

CONFIGURATION AND ENVIRONMENT ^

The module requires Internet access to make sense and an account with DanDomain with username and password is required.

DEPENDENCIES ^

TEST AND QUALITY ^

The tests are based on Test::MockObject::Extends and example data are mocked dummy data. Please see the TODO section.

TEST COVERAGE

---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ blib/lib/WWW/DanDomain.pm 100.0 100.0 100.0 100.0 100.0 100.0 100.0 Total 100.0 100.0 100.0 100.0 100.0 100.0 100.0 ---------------------------- ------ ------ ------ ------ ------ ------ ------

QUALITY AND CODING STANDARD ^

The code passes Perl::Critic tests a severity: 1 (brutal)

Perl::Tidy resource file, can be obtained from the original author

BUGS AND LIMITATIONS ^

No known bugs at this time.

BUG REPORTING ^

Please report any bugs or feature requests via:

DEVELOPMENT ^

TODO ^

SEE ALSO ^

SUPPORT ^

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

    perldoc WWW::DanDomain

You can also look for information at:

AUTHOR ^

MOTIVATION ^

This module grew out of a small script using WWW::Mechanize to fetch some data from a website and changing it to satisfy the client utilizing the data.

More a more scripts where based on the original script giving a lot of redundant code. Finally I refactored the lot to use some common code base.

After some time I refactored to an object oriented structure making it even easier to maintain and adding more clients. This made the actual connectivity into a package (this package) letting it loose as open source.

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2009 jonasbn, all rights reserved.

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