NAME
DBIO::Generate::Util - Safe Perl-literal emission helpers for DBIO::Generate styles
VERSION
version 0.900004
METHODS
pl_str
my $literal = pl_str($s);
Renders an arbitrary string as a safe, single-token Perl string literal via B::perlstring, which escapes quotes, backslashes, newlines and all other special characters. The result can be spliced into emitted source wherever a string is wanted (hash key, call argument, ...). undef becomes the bareword undef.
pl_val
my $source = pl_val($v);
Renders a column-info value as Perl source. An integer stays a bare number, a reference (a [precision, scale] size, a \'CURRENT TIMESTAMP' default) is dumped as a single-line Perl expression through Data::Dumper, and any other string goes through "pl_str".
abstract_comment
my $text = abstract_comment($s);
Renders a value safe for emission on a # ABSTRACT: ... comment line: all vertical whitespace is collapsed to single spaces and the result trimmed, so a newline in the source string cannot break out of the comment and inject a fresh line of executable code. undef becomes the empty string.
assert_pkg
my $name = assert_pkg($name);
Validates a string that is about to be emitted as a bareword package/class name (e.g. package $name;), where a string literal is not an option. croaks naming the offending value unless $name is a strict, well-formed Perl package name; otherwise returns $name unchanged.
assert_method_name
my $method = assert_method_name($method, 'extra_statements method');
Validates a method name that is about to be emitted as a bareword (__PACKAGE__->$method(...), a DSL statement). A method name is a Perl identifier: a letter or underscore followed by word characters. Throws naming $what, the slot the name came from, and returns $method unchanged otherwise.
assert_relationship_method
my $method = assert_relationship_method($method);
A relationship method is one of belongs_to, has_one, has_many, might_have and many_to_many. Throws naming the slot for anything else and returns $method unchanged otherwise.
AUTHOR
DBIO & DBIx::Class Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.