I wanted to modify the URL before inserting the database on I: But this does not work: Show: I want a class: DBI mailing The list was still alive!
Package Hosting :: Company; Use Base 'Class :: DBI'; My $ class = __PACKAGE__; $ Square & gt; Table ('companies'); $ Square-> column (primary = & gt; 'company id'); $ Square-> column (other => qw / name url comment); Sub URL {My $ self = shift; # Modify the URL if (@_) {$ _ [0] = 'Aaaaa'; # Return $ self-> _Url_accessor ('Aaaaa'); - Either does not work} # Return to normal class: DBI back $ self-> _Url_accessor (@_); }
My $ company = hosting :: company-> Insert ({name = & gt; 'test', url = & gt; 'http: // http: // url'}); Print $ Company- & gt; URL, "\ n";
http: // http: // url
Do not change insert
by overriding an accelerator. The best way to handle data normalization is to override but it's okay, your accessor has been exposed.
PS is still active, just have not seen so much posting. Most people have gone on this.
Comments
Post a Comment