NAME

DBIO::Candy::Exports - Create sugar for DBIO components

VERSION

version 0.900004

SYNOPSIS

package DBIO::SomeComponent;

sub create_widget { ... }

# so you don't depend on ::Candy
eval {
  require DBIO::Candy::Exports;
  DBIO::Candy::Exports->import;
  export_methods ['create_widget'];
  export_method_aliases {
    widget => 'create_widget'
  };
};

1;

The above will make it such that users of your component who use it with DBIO::Candy will have the methods you designate exported into their namespace.

See t/candy_exports.t for a runnable example, including a component consumed by DBIO::Candy's -components option.

DESCRIPTION

This module allows DBIO components to register sugar functions that DBIO::Candy will export into result classes that load those components.

METHODS

get_methods_for

my $arrayref = DBIO::Candy::Exports::get_methods_for($package);

Returns the arrayref most recently registered for $package via "export_methods", or undef if that package never called it. Called by DBIO::Candy while composing sugar for a result class; not normally called directly.

get_aliases_for

my $hashref = DBIO::Candy::Exports::get_aliases_for($package);

Returns the hashref most recently registered for $package via "export_method_aliases", or undef if that package never called it. Called by DBIO::Candy while composing sugar for a result class; not normally called directly.

export_methods

export_methods [qw( foo bar baz )];

Define methods that get exported as subroutines of the same name.

export_method_aliases

export_method_aliases {
  new_sub_name => 'existing_method_name',
};

Define methods that get exported as subroutines of a different name. The key is the name of the exported subroutine, the value the method it calls.

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.