Rose::HTMLx::Form::Related::RelInfo - relationship summary


Rose-HTMLx-Form-Related documentation Contained in the Rose-HTMLx-Form-Related distribution.

Index


Code Index:

NAME

Top

Rose::HTMLx::Form::Related::RelInfo - relationship summary

DESCRIPTION

Top

Objects of this class are get/set from the various relationship methods in Metadata. See Rose::HTMLx::Form::Related::Metadata init_relationships().

METHODS

Top

These are all get/set methods.

app

name

type

method

label

object_class

foreign_class

foreign_column

map_from

map_to

map_class

map_to_column

map_from_column

map_class_controller_class

cmap

controller

controller_class

get_controller

Returns controller() or fetches and caches a controller instance based on app().

foreign_column_for( field_name )

Returns the name of the foreign column related to field_name. Shortcut for looking up items in cmap().

as_hash

Returns all non-blessed values in a single hashref. Suitable for debugging.

AUTHOR

Top

Peter Karman, <karman at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-rose-htmlx-form-related at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-HTMLx-Form-Related. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

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

    perldoc Rose::HTMLx::Form::Related

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Rose-HTMLx-Form-Related

* CPAN Ratings

http://cpanratings.perl.org/d/Rose-HTMLx-Form-Related

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-HTMLx-Form-Related

* Search CPAN

http://search.cpan.org/dist/Rose-HTMLx-Form-Related

ACKNOWLEDGEMENTS

Top

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE

Top


Rose-HTMLx-Form-Related documentation Contained in the Rose-HTMLx-Form-Related distribution.
package Rose::HTMLx::Form::Related::RelInfo;
use strict;
use warnings;
use base qw( Rose::Object );
use Rose::Object::MakeMethods::Generic (
    'scalar --get_set' => [
        qw( name type method label
            object_class foreign_class foreign_column
            map_from map_to map_class map_to_column map_from_column
            cmap controller controller_class app
            map_class_controller_class
            )
    ],
);
use Carp;
use Scalar::Util;

our $VERSION = '0.22';

sub get_controller {
    my $self = shift;
    return $self->controller if defined $self->controller;
    my $c = $self->app->controller( $self->controller_class );
    $self->controller($c);
    return $c;
}

sub foreign_column_for {
    my $self = shift;
    my $name = shift;
    if ( ref( $self->foreign_column ) ) {
        return $self->foreign_column->{$name};
    }
    else {
        return $self->foreign_column;
    }
}

sub as_hash {
    my $self = shift;
    my %hash;
    for my $key ( keys %$self ) {
        my $value = $self->$key;
        if ( !Scalar::Util::blessed($value) ) {
            $hash{$key} = $value;
        }
    }
    return \%hash;
}

1;

__END__