Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8358135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:42:15+00:00 2026-06-09T10:42:15+00:00

Using DBIx::Class I am trying to manipulate the data of a column whenever it

  • 0

Using DBIx::Class I am trying to manipulate the data of a column whenever it is being updated or retrieved. For instance, before it goes into the database I would like to encrypt it, and whenever it is being accessed I would like to decrypt it. I am following this example in the DBIx::Class::Manual::Cookbook, however I can’t seem to get it to work. I have placed the following in my User schema. For testing I am just using the name column, I know it doesn’t make sense:

__PACKAGE__->add_columns("name" => { accessor => '_name' });

sub name {
    my $self = shift;

    # If there is an update to the column, we'll let the original accessor
    # deal with it.
    if(@_) {
        return $self->_name('test 1');
    }

    # Fetch the column value.
    my $name = $self->_name;
    $name = 'test 2';
    return $name;
}

I can’t see what I’m doing any different than what the cookbook says. Can’t anyone help me understand what I’m doing wrong? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:42:17+00:00Added an answer on June 9, 2026 at 10:42 am

    DBIx::Class has a component for that called FilterColumn.

    There are various modules on CPAN using that component like DBIx::Class::EncodedColumn and PassphraseColumn.

    If you tell us what you use case is we might give you more/better suggestions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a model for Catalyst by using DBIx::Class::Schema::Loader. I want
Using DBIx::Class and I have a resultset which needs to be filtered by data
Using DBIx::Class, I am trying to create a many-to-many accessor (or even just a
I'm using DBIx::Class in a web context and I'd like to display the number
I am using DBIx::Class and I have got a ResultSet. I like to re-order
In DBIx::Class, when I generate a query using this syntax: ... 'Time(submitted_at)' => {
I have a bunch of tests for my DBIx::Class schema and I am using
I'm using the DBIx::Class modules for an ORM approach to an application I have.
When using the new() method on a DBIx::Class ResultSource to create a (potentially temporary)
I'm using group_by in a DBIx::Class resultset search. The result returned for each group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.