.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBIx::Class::InflateColumn::File 3pm" .TH DBIx::Class::InflateColumn::File 3pm "2022-05-21" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBIx::Class::InflateColumn::File \- DEPRECATED (superseded by DBIx::Class::InflateColumn::FS) .SS "Deprecation Notice" .IX Subsection "Deprecation Notice" .Vb 7 \& This component has a number of architectural deficiencies that can quickly \& drive your filesystem and database out of sync and is not recommended for \& further use. It will be retained for backwards compatibility, but no new \& functionality patches will be accepted. Please consider using the much more \& mature and actively supported DBIx::Class::InflateColumn::FS. You can set \& the environment variable DBIC_IC_FILE_NOWARN to a true value to disable \& this warning. .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" In your DBIx::Class table class: .PP .Vb 1 \& use base \*(AqDBIx::Class::Core\*(Aq; \& \& _\|_PACKAGE_\|_\->load_components(qw/InflateColumn::File/); \& \& # define your columns \& _\|_PACKAGE_\|_\->add_columns( \& "id", \& { \& data_type => "integer", \& is_auto_increment => 1, \& is_nullable => 0, \& size => 4, \& }, \& "filename", \& { \& data_type => "varchar", \& is_file_column => 1, \& file_column_path =>\*(Aq/tmp/uploaded_files\*(Aq, \& # or for a Catalyst application \& # file_column_path => MyApp\->path_to(\*(Aqroot\*(Aq,\*(Aqstatic\*(Aq,\*(Aqfiles\*(Aq), \& default_value => undef, \& is_nullable => 1, \& size => 255, \& }, \& ); .Ve .PP In your Catalyst::Controller class: .PP FileColumn requires a hash that contains IO::File as handle and the file's name as name. .PP .Vb 9 \& my $entry = $c\->model(\*(AqMyAppDB::Articles\*(Aq)\->create({ \& subject => \*(Aqblah\*(Aq, \& filename => { \& handle => $c\->req\->upload(\*(Aqmyupload\*(Aq)\->fh, \& filename => $c\->req\->upload(\*(Aqmyupload\*(Aq)\->basename \& }, \& body => \*(Aq....\*(Aq \& }); \& $c\->stash\->{entry}=$entry; .Ve .PP And Place the following in your \s-1TT\s0 template .PP .Vb 4 \& Article Subject: [% entry.subject %] \& Uploaded File: \& File \& Body: [% entry.body %] .Ve .PP The file will be stored on the filesystem for later retrieval. Calling delete on your resultset will delete the file from the filesystem. Retrevial of the record automatically inflates the column back to the set hash with the IO::File handle and filename. .SH "DESCRIPTION" .IX Header "DESCRIPTION" InflateColumn::File .SH "METHODS" .IX Header "METHODS" .SS "_file_column_callback ($file,$ret,$target)" .IX Subsection "_file_column_callback ($file,$ret,$target)" Method made to be overridden for callback purposes. .SH "FURTHER QUESTIONS?" .IX Header "FURTHER QUESTIONS?" Check the list of additional \s-1DBIC\s0 resources. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This module is free software copyright by the DBIx::Class (\s-1DBIC\s0) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.