GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::CLASS::HELPERS::UTIL (3)

.ds Aq ’

NAME

DBIx::Class::Helpers::Util - Helper utilities for DBIx::Class components

CONTENTS

SYNOPSIS



 use DBIx::Class::Helpers::Util :all;

 my ($namespace, $class) = get_namespace_parts(MyApp:Schema::Person);
 is $namespace, MyApp::Schema;
 is $class, Person;

 if (is_load_namespaces(MyApp::Schema::Result::Person)) {
   print correctly structured project;
 }

 if (is_not_load_namespaces(MyApp::Schema::Person)) {
   print incorrectly structured project;
 }

 if (assert_similar_namespaces(MyApp::Schema::Person, FooApp::Schema::People)) {
   print both projects are structured similarly;
 }

 if (assert_similar_namespaces(MyApp::Schema::Result::Person, FooApp::Schema::Result::People)) {
   print both projects are structured similarly;
 }

 # in a resultset

 sub search {
    my ($self, $search, $attrs) = @_;

    $attrs->{order_by} = order_by_visitor($attrs->{order_by}, sub {
       my $field = shift;

       return foo_bar if $field eq foo.bar;
       return $field;
    }) if $attrs && $attrs->{order_by};

    $self->next::method($search, $attrs);
 }

 # in schema

 sub connection {
    my $self = shift;

    my $args = normalize_connect_info(@_);
    $args->{quote_names} = 1;

    $self->next::method($args)
 }



DESCRIPTION

A collection of various helper utilities for DBIx::Class stuff. Probably only useful for components.

EXPORTS

    order_by_visitor

This function allows you to easily transform order_by clauses. See SYNOPSIS for example.

    get_namespace_parts

Returns the namespace and class name of a package. See SYNOPSIS for example.

    is_load_namespaces

Returns true if a package is structured in a way that would work for load_namespaces. See SYNOPSIS for example.

    is_not_load_namespaces

Returns true if a package is structured in a way that would not work for load_namespaces. See SYNOPSIS for example.

    assert_similar_namespaces

Dies if both packages are structured in the same way. The same means both are load_namespaces or both are not. See SYNOPSIS for example.

    normalize_connect_info

Takes all of the various and interesting forms that can be passed to connect and normalizes them into the final and simplest form, a single hashref.

AUTHOR

Arthur Axel fREW Schmidt <frioux+cpan@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Arthur Axel fREW Schmidt.

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::CLASS::HELPERS::UTIL (3) 2015-11-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.