Business::AU::Data::ANZIC - Australian New Zealand Standard Industrial Classification (ANZSIC) Codes


Business-AU-Data-ANZIC documentation Contained in the Business-AU-Data-ANZIC distribution.

Index


Code Index:

NAME

Top

Business::AU::Data::ANZIC - Australian New Zealand Standard Industrial Classification (ANZSIC) Codes

SYNOPSIS

Top

  use Business::AU::Data::ANZIC;

  my $parser = Business::AU::Data::ANZIC->get('Parse::CSV');

DESCRIPTION

Top

Business::AU::Data::ANZIC is a module which ties the Australian New Zealand Standard Industrial Classification (ANZSIC) Codes to a cpan namespace.

For applications that need to capture and store information on the sector of the economy that a business or person operates in, this module provides data that can be used to specify an industry sector.

The data is provided internally as a CSV heirachal serialization of the official Australian Bureau of Statistics data cube from product 1292.0.

http://www.abs.gov.au/AUSSTATS/abs@.nsf/DetailsPage/1292.02006?OpenDocument

Using this module

This module provides the raw data access using the Data::Package API.

The modules will provide the data as either a raw IO::File handle, or as a Parse::CSV object with numeric columns, from which you can fetch rows that can be used to compile your task-specific list.

METHODS

Top

See Data::Package for API details.

SUPPORT

Top

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Business-AU-Data-ANZIC

For other issues, or commercial enhancement or support, contact the author.

AUTHORS

Top

Adam Kennedy <adamk@cpan.org>

COPYRIGHT

Top


Business-AU-Data-ANZIC documentation Contained in the Business-AU-Data-ANZIC distribution.

package Business::AU::Data::ANZIC;

use 5.005;
use strict;
use IO::File       ();
use Parse::CSV     ();
use File::ShareDir ();
use Params::Util   '_CLASS';

use vars qw{$VERSION};
BEGIN {
	$VERSION = '0.01';
}

# Locate the file
my $csv_file = File::ShareDir::module_file('Business::AU::Data::ANZIC', 'anzic.csv');






#####################################################################

sub new {
	my $class = shift;
	my $self  = bless { }, $class;
	return $self;
}

sub provides {
	my @provides = qw{ IO::File Parse::CSV };
	my $want     = _CLASS($_[1]);
	if ( $want ) {
		return grep { $_->isa($want) } @provides;
	} else {
		return @provides;
	}
}

sub get {
	my $either = shift;
	my $want  = _CLASS($_[0]) || 'Parse::CSV';
	if ( $want eq 'IO::File' ) {
		return $either->_io_file;
	}
	if ( $want eq 'Parse::CSV' ) {
		return $either->_parse_csv;
	}
	Carp::croak("Unknown or unsupported data class '$_[0]'");
}

sub _io_file {
	IO::File->new( $csv_file );
}

sub _parse_csv {
	Parse::CSV->new(
		file => $csv_file,
		);
}

1;

__END__