Skip to content

Instantly share code, notes, and snippets.

@adamtaylor
Last active August 29, 2015 14:27
Show Gist options
  • Save adamtaylor/e76e8e93992183207b66 to your computer and use it in GitHub Desktop.
Save adamtaylor/e76e8e93992183207b66 to your computer and use it in GitHub Desktop.
Catalyst authentication auto_update and auto_create result/resultset methods
package MyApp::Schema::Result::User;
...
# Called everytime a user logs in
sub auto_update {
my ( $self, $auth_args ) = @_;
$self->update( $auth_args );
return $self;
}
package MyApp::Schema::ResultSet::User;
...
# Called when a new user is found
sub auto_create {
my ( $self, $auth_args ) = @_;
my $user = $self->create( $auth_args );
return $user;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment