Basset

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

			- pkg_for_type no longer caches
		+ Basset::Template
			- moved the default attribute definitions out of the conf file and into the module.
			  (smaller default conf file, values can still be overridden in conf)
		+ Basset::Machine
			- added
		+ Basset::Machine::State
			- added
1.01	04/20/2005
		+ Basset::DB::Table
			- added attributes_to_create, attributes_not_to_create, create_attributes flags
			- added omit_columns_from_tables flag to multiselect_query
			- qualify_name now accepts an array of colum names
		+ Basset::Object::Persistent
			- removed options and methods to cache objects (cache_object flag, etc.)
			- removed perl_read_translation/perl_write_translation & import_from_db/export_to_db
			  they are replaced with wrappers.
			- added the on_load_* and on_commit_* methods
			- Now expects attributes to be populated from Basset::DB::Table objects
			- cleaned up the relationship and instantiation code
			- load now uses load_where

lib/Basset/DB/Table.pm  view on Meta::CPAN


	my %init = (
		'definition'				=> {},
		'extra_select'				=> {},
		'db_write_translation'		=> {},
		'db_read_translation'		=> {},
		'column_aliases'			=> {},
		'references'				=> {},
		'_cached_queries'			=> {},
		'_cached_bindables'			=> {},
		'attributes_not_to_create'	=> [],
		'create_attributes'			=> 0,
		'last_insert_query'			=> 'SELECT LAST_INSERT_ID()',
		@_
	);

	if ($init{'discover'}) {
		$init{'definition'} = $self->discover_columns($init{'name'}) or return;
	} elsif ($init{'non_primary_columns'}) {
		my @primary = ref $init{'primary_column'} ? @{$init{'primary_column'}} : ($init{'primary_column'});
		$init{'definition'} = $self->discover_columns($init{'name'}, (@primary, @{$init{'non_primary_columns'}})) or return;

lib/Basset/DB/Table.pm  view on Meta::CPAN


	#$self->definition($init{'definition'});

	return $self->SUPER::init(
		'definition' => $init{'definition'},
		%init
	);
};

__PACKAGE__->add_attr('_attributes_to_create');
__PACKAGE__->add_attr('attributes_not_to_create');

__PACKAGE__->add_attr('create_attributes');

sub attributes_to_create {
	my $self = shift;
	if (@_) {
		$self->_attributes_to_create($_[0]);
	};
	
	my %not = map {$_, 1} @{$self->attributes_not_to_create};
	
	return grep {! $not{$_} } $self->alias_column($self->_attributes_to_create ? @{$self->_attributes_to_create} : $self->cols);
}

=pod

=back

=head1 METHODS

lib/Basset/Object.pm  view on Meta::CPAN


 	#now we make our closure:
 	return sub {
 		my $self = shift;
 		if (@_) {
 			my $val = shift;
 			if ($val == 7) {
 				return $self->$prop($val);
 			}
 			else {
 				return $self->error("Cannot store value...must be 7!", "not_7");
 			}
 		}
 		else {
 			return $self->$prop();
 		}
 	}
 }

And, finally, you can also pass in additional arguments as static args if desired.

t/boilerplate.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;
use Test::More tests => 17;

sub not_in_file_ok {
    my ($filename, %regex) = @_;
    open my $fh, "<", $filename
        or die "couldn't open $filename for reading: $!";

    my %violated;

    while (my $line = <$fh>) {
        while (my ($desc, $regex) = each %regex) {
            if ($line =~ $regex) {
                push @{$violated{$desc}||=[]}, $.;

t/boilerplate.t  view on Meta::CPAN

    }

    if (%violated) {
        fail("$filename contains boilerplate text");
        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
    } else {
        pass("$filename contains no boilerplate text");
    }
}

not_in_file_ok(README =>
    "The README is used..."       => qr/The README is used/,
    "'version information here'"  => qr/to provide version information/,
);

not_in_file_ok(Changes =>
    "placeholder date/time"       => qr(Date/time)
);

sub module_boilerplate_ok {
    my ($module) = @_;
    not_in_file_ok($module =>
        'the great new $MODULENAME'   => qr/ - The great new /,
        'boilerplate description'     => qr/Quick summary of what the module/,
        'stub function definition'    => qr/function[12]/,
    );
}

module_boilerplate_ok('lib/Basset/Container/Hash.pm');
module_boilerplate_ok('lib/Basset/DB/Nontransactional.pm');
module_boilerplate_ok('lib/Basset/DB/Table/View.pm');
module_boilerplate_ok('lib/Basset/DB/Table.pm');



( run in 0.653 second using v1.01-cache-2.11-cpan-cc502c75498 )