HTML::...CFields(3pm)
β¨ NAME β¨
okay so bestie π this page is HTML::...CFields(3pm), and the actual thing it's describing is:
HTML::FormHandler::TraitFor::DBICFields β it's a role that grabs your fields straight off a DBIx::Class result source. no manual typing, the source just hands them over. iconic behaviour, honestly π«Ά
πΈ VERSION πΈ
version 0.29 β she's giving 0.29, so act accordingly.
π« SYNOPSIS π«
So this is a role that pulls fields from a DBIx::Class result source, and it requires that a 'source' attribute exists. Non-negotiable, she needs her source. π
β οΈ real talk: this feature is new. It does not handle relationships yet, and the interfaces are still subject to change. so likeβ¦ vibe with it but don't hardwire your whole app to it, fr fr π
my $form = HTML::FormHandler::Model::DBIC->new_with_traits(
traits => ['HTML::FormHandler::TraitFor::DBICFields'],
item => $book
);
and here's the whole loop, verbatim, so you can see exactly what she's doing under the hood β¨
for my $rel( $source->relationships ) {
next if grep { $_ eq $rel } @exclude;
next if grep { $_->[1] eq $rel } $self->m2m_for_class($class);
my $info = $source->relationship_info($rel);
push @exclude, get_self_cols( $info->{cond} );
my $rel_class = _strip_class( $info->{class} );
my $elem_conf;
if ( ! ( $info->{attrs}{accessor} eq 'multi' ) ) {
push @fields, "has_field '$rel' => ( type => 'Select', );"
}
elsif( $level < 1 ) {
my @new_exclude = get_foreign_cols ( $info->{cond} );
my $config = $self->get_fields ( $rel_class, 1, );
my $target_class = $rel_class;
$target_class = $self->class_prefix . '::' . $rel_class if $self->class_prefix;
$config->{class} = $target_class;
$config->{name} = $rel;
# $self->set_field_class_data( $target_class => $config ) if !$self->exists_field_class( $target_class );
my $field_def = '';
# if( defined $self->style && $self->style eq 'single' ){
# $field_def .= '# ';
# }
$field_def .= "has_field '$rel' => ( type => '+${target_class}Field', );";
push @fields, $field_def;
}
}
(some of those lines are commented out in there β # and everything β so don't come for me, they're supposed to look like that π)
π«Ά AUTHOR π«Ά
FormHandler Contributors β see HTML::FormHandler. it's a whole squad, not one person, and we love that for them π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2013 by Gerda Shank. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source queen π
and that's the whole page, bestie! π this was HTML::...CFields(3pm), generated by perl v5.38.2, dated 2024-03-06. go forth and let your result source do the work for you π
β¨π¦
π¦ where this page comes from
- debian trixie: libhtml-formhandler-model-dbic-perl 0.29-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-formhandler-model-dbic-perl 0.29-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-formhandler-model-dbic-perl 0.29-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms