1Storm(3)              User Contributed Perl Documentation             Storm(3)
2
3
4

NAME

6       Storm - Object-relational mapping
7

TUTORIAL

9       If you're new to Storm check out Storm::Tutorial.
10

SYNOPSIS

12           package Foo;
13
14           use Storm::Object;
15
16           storm_table('Foo');
17
18           has 'id' => ( is => 'rw', traits => [qw( PrimaryKey AutoIncrement )] );
19
20           has 'label' => ( is => 'rw' );
21
22
23
24           # and then ....
25
26           package main;
27
28           use Storm;
29
30           # connect to a database
31           $storm = Storm->new( source => ['DBI:SQLite:dbname=:memory:'] );
32
33           $o = Foo->new( label => 'Storm Enabled Object' );
34
35           # store object
36           $storm->insert( $o );
37
38           # update object
39           $o->label( 'Updated Object' );
40           $storm->update( $o );
41
42           # sync object with database
43           $storm->refresh( $o );
44
45           # lookup object in database
46           $o = $storm->lookup( 'Foo', 1 );
47
48           # search for objects in database
49           $query = $storm->select( 'Foo' );
50           $query->where( '.label', '=', 'Updated Object' )
51           $iter  = $query->results;
52           @results = $iter->all;
53
54           # delete objects
55           $storm->delete( $o );
56

DESCRIPTION

58       Storm is a Moose based library for storing and retrieving objects over
59       a DBI connection.
60

ATTRIBUTES

62       aeolus
63           Read-only.
64
65           A Storm::Aeolus object for installing/uninstalling database tables.
66
67       live_objects
68           Read-only.
69
70           A Storm::LiveObjects object for tracking the set of live objects.
71           Creates scope objects to help ensure that objects are not garbage
72           collected. This is used internally and you typically shouldn't need
73           to access it yourself. It is documented here for completeness.
74
75       policy
76           The policy determines how types are defined in the database and can
77           be used to customize how types are inflated/deflated. See
78           Storm::Policy for more details.
79
80       source
81           Required.
82
83           The Storm::Source object responsible for spawning active database
84           handles. A Storm::Source object will be coerced from a ArrayRef or
85           Hashref.
86
87       table_prefix
88           The prefix to add to table names.
89

METHODS

91       delete @objects
92           Deletes the objects from the database.
93
94       delete_query $class
95           Returns a Storm::Query::Delete instance for deleting objects of
96           type $class from the database.
97
98       delete_where $class
99           Returns a Storm::Query::DeleteWhere instance for deleting objects
100           of type $class from the database using a where clause.
101
102       do_transaction \&func
103           Creates and commits a Storm::Transaction. The \&func will be called
104           within the transaction.
105
106       insert @objects
107           Insert objects into the database.
108
109       insert_query $class
110           Returns a Storm::Query::Insert instance for inserting objects of
111           type $class into the database.
112
113       lookup $class, @ids
114           Retrieve objects from the database.
115
116       lookup_query $class
117           Returns a Storm::Query::Lookup instance for retrieving objects of
118           type $class from the database.
119
120       new_transaction \&func
121           Returns a new transaction. \&func is the code to be called within
122           the transaction.
123
124       refresh @objects
125           Update the @objects with data from the database.
126
127       refresh_query $class
128           Returns a Storm::Query::Refresh instance for refresh objects of
129           type $class.
130
131       select $class, @objects
132           Synonamous with "select_query". Provided for consistency.
133
134       select_query $class
135           Returns a Storm::Query::Select instance for selecting objects from
136           the database.
137
138       table ClassName | Str
139           Returns the name of the table with the "table_prefix" prepended for
140           the given "ClassName".  Prepends "table_prefix" to argument if it
141           is a string.
142
143       update @objects
144           Update the @objects in the database.
145
146       update_query
147           Returns a Storm::Query::Select instance for updating objects in the
148           database.
149

SEE ALSO

151   Similar modules
152       KiokuDB
153       Fey::ORM
154       Pixie
155       DBM::Deep
156       OOPS
157       Tangram
158       DBIx::Class
159       MooseX::Storage
160

CAVEATS/LIMITATIONS

162   Databases
163       Storm has only been tested using MySQL and SQLite.
164

BUGS

166       Please report bugs on CPAN.
167

AUTHORS

169       Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
170
171       Dave Rolsky <autarch@urth.org>
172
173       Yuval Kogman <nothingmuch@woobling.org>
174
175       Special thanks to Yuval Kogman and Dave Rolsky, for who without their
176       talented work and this library would not be possible.
177
178       The code for managing the live object set and the scope relies on
179       modified code written by Yuval Kogman for KiokuDB. Documentation for
180       this feature was also taken from KiokuDB.
181
182       The code for managing the policy and generating sql statements relies
183       on modified code written by Dave Rolsky for Fey.
184
186           Copyright (c) 2010-2012 Jeffrey Ray Hallock.
187
188           Copyright (c) 2010-2011 Dave Rolsky.
189
190           Copyright (c) 2008, 2009 Yuval Kogman, Infinity Interactive.
191
192           This is free software, licensed under:
193
194           The Artistic License 2.0 (GPL Compatible)
195
196
197
198perl v5.32.0                      2020-07-28                          Storm(3)
Impressum