Test::AutoBuild::Publisher - Simple publishering of modules


Test-AutoBuild documentation Contained in the Test-AutoBuild distribution.

Index


Code Index:

NAME

Top

Test::AutoBuild::Publisher - Simple publishering of modules

SYNOPSIS

Top

  use Test::AutoBuild::Publisher

  my $publisher = Test::AutoBuild::Publisher->new(name => $name,
						  label => $label,
						  options => \%options);

  my $name = $publisher->name([$newname]);
  my $label = $publisher->label([$newlabel]);
  my $value = $publisher->option($name[, $newvalue]);

DESCRIPTION

Top

The Test::AutoBuild::Publisher module provides an API for copying artifacts from the module build root to a destination directory.

CONFIGURATION

Top

The valid configuration options for the publishers block are

METHODS

Top

my $publisher = Test::AutoBuild::Publisher->new(name => $name, label => $label, [options => \%options]);

Creates a new publisher object. modules is an array ref of Test::AutoBUild::Module objects representing the members of the publisher. name is a short alphanumeric token for the name of the publisher. label is a free text title for the publisher. admin is the name/contact details of the publisher administrator. options is a hash ref of arbitrary options for the publisher.

my $name = $publisher->name([$newname]);

Gets the name of the publisher. The name is a short alphanumeric token. If the newname parameter is supplied then the name is updated.

my $label = $publisher->label([$newlabel]);

Gets the label of the publisher. The label is a free text title for the publisher. If the newlabel parameter is supplied then the label is updated.

my $value = $publisher->option($name, [$newvalue]);

Gets the value corresponding to the option name. If the second newvalue parameter is specified then the value for the option is updated.

AUTHORS

Top

Daniel Berrange <dan@berrange.com>

COPYRIGHT

Top

SEE ALSO

Top

perl(1), Test::AutoBuild::Publisher::Copy, Test::AutoBuild::Publisher::XSLTransform


Test-AutoBuild documentation Contained in the Test-AutoBuild distribution.
# -*- perl -*-
#
# Test::AutoBuild::Publisher by Daniel Berrange <dan@berrange.com>
#
# Copyright (C) 2002-2004 Daniel Berrange <dan@berrange.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: Publisher.pm,v 1.5 2007/12/08 21:03:02 danpb Exp $

package Test::AutoBuild::Publisher;

use strict;
use warnings;
use Carp qw(confess);

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $self = {};
    my %params = @_;

    $self->{name} = exists $params{name} ? $params{name} : confess "name parameter is required";
    $self->{label} = exists $params{label} ? $params{label} : confess "label parameter is required";
    $self->{options} = exists $params{options} ? $params{options} : {};

    bless $self, $class;

    return $self;
}

sub name {
    my $self = shift;
    $self->{name} = shift if @_;
    return $self->{name};
}

sub label {
    my $self = shift;
    $self->{label} = shift if @_;
    return $self->{label};
}

sub option {
   my $self = shift;
   my $name = shift;

   $self->{options}->{$name} = shift if @_;

   return $self->{options}->{$name};
}


sub publish {
    my $self = shift;
    my $src = shift;
    my $dst = shift;

    confess "module " . ref($self) . " forgot to implement the publish method";
}

1 # So that the require or use succeeds.

__END__