1DBIx::Class::InflateColUusmenr::CFoinlter(i3b)uted PerlDDBoIcxu:m:eCnltaastsi:o:nInflateColumn::File(3)
2
3
4

NAME

6       DBIx::Class::InflateColumn::File -  DEPRECATED (superseded by
7       DBIx::Class::InflateColumn::FS)
8
9   Deprecation Notice
10        This component has a number of architectural deficiencies that can quickly
11        drive your filesystem and database out of sync and is not recommended for
12        further use. It will be retained for backwards compatibility, but no new
13        functionality patches will be accepted. Please consider using the much more
14        mature and actively supported DBIx::Class::InflateColumn::FS. You can set
15        the environment variable DBIC_IC_FILE_NOWARN to a true value to disable
16        this warning.
17

SYNOPSIS

19       In your DBIx::Class table class:
20
21           use base 'DBIx::Class::Core';
22
23           __PACKAGE__->load_components(qw/InflateColumn::File/);
24
25           # define your columns
26           __PACKAGE__->add_columns(
27               "id",
28               {
29                   data_type         => "integer",
30                   is_auto_increment => 1,
31                   is_nullable       => 0,
32                   size              => 4,
33               },
34               "filename",
35               {
36                   data_type           => "varchar",
37                   is_file_column      => 1,
38                   file_column_path    =>'/tmp/uploaded_files',
39                   # or for a Catalyst application
40                   # file_column_path  => MyApp->path_to('root','static','files'),
41                   default_value       => undef,
42                   is_nullable         => 1,
43                   size                => 255,
44               },
45           );
46
47       In your Catalyst::Controller class:
48
49       FileColumn requires a hash that contains IO::File as handle and the
50       file's name as name.
51
52           my $entry = $c->model('MyAppDB::Articles')->create({
53               subject => 'blah',
54               filename => {
55                   handle => $c->req->upload('myupload')->fh,
56                   filename => $c->req->upload('myupload')->basename
57               },
58               body => '....'
59           });
60           $c->stash->{entry}=$entry;
61
62       And Place the following in your TT template
63
64           Article Subject: [% entry.subject %]
65           Uploaded File:
66           <a href="/static/files/[% entry.id %]/[% entry.filename.filename %]">File</a>
67           Body: [% entry.body %]
68
69       The file will be stored on the filesystem for later retrieval.  Calling
70       delete on your resultset will delete the file from the filesystem.
71       Retrevial of the record automatically inflates the column back to the
72       set hash with the IO::File handle and filename.
73

DESCRIPTION

75       InflateColumn::File
76

METHODS

78   _file_column_callback ($file,$ret,$target)
79       Method made to be overridden for callback purposes.
80

FURTHER QUESTIONS?

82       Check the list of additional DBIC resources.
83
85       This module is free software copyright by the DBIx::Class (DBIC)
86       authors. You can redistribute it and/or modify it under the same terms
87       as the DBIx::Class library.
88
89
90
91perl v5.30.1                      2020-01-29DBIx::Class::InflateColumn::File(3)
Impressum