Storm(3)
π Storm(3) π
okay bestie, so this is Storm(3) β one of the pages from User Contributed Perl Documentation β and it's literally the object-relational mapping girlie of your dreams. pull up a chair, grab a strawberry π, and let's get into it.
β¨ NAME β¨
Storm β Object-relational mapping π
π¦ TUTORIAL π¦
new here? no stress, bestie. If you're new to Storm check out Storm::Tutorial. it's giving read me first energy, fr fr.
πΈ SYNOPSIS πΈ
okay so here's the whole vibe, verbatim, no notes:
package Foo;
use Storm::Object;
storm_table('Foo');
has 'id' => ( is => 'rw', traits => [qw( PrimaryKey AutoIncrement )] );
has 'label' => ( is => 'rw' );
# and then ....
package main;
use Storm;
# connect to a database
$storm = Storm->new( source => ['DBI:SQLite:dbname=:memory:'] );
$o = Foo->new( label => 'Storm Enabled Object' );
# store object
$storm->insert( $o );
# update object
$o->label( 'Updated Object' );
$storm->update( $o );
# sync object with database
$storm->refresh( $o );
# lookup object in database
$o = $storm->lookup( 'Foo', 1 );
# search for objects in database
$query = $storm->select( 'Foo' );
$query->where( '.label', '=', 'Updated Object' )
$iter = $query->results;
@results = $iter->all;
# delete objects
$storm->delete( $o );
see how it all flows?? define your class, connect, and then insert/update/refresh/lookup/select/delete like it's nothing. main character energy honestly. π
π DESCRIPTION π
Storm is a Moose based library for storing and retrieving objects over a DBI connection. that's it. that's the pitch. and it ate. π₯
π ATTRIBUTES π
aeolusβ Read-only. AStorm::Aeolusobject for installing/uninstalling database tables. (table bouncer, basically π )live_objectsβ Read-only. AStorm::LiveObjectsobject for tracking the set of live objects. Creates scope objects to help ensure that objects are not garbage collected. This is used internally and you typically shouldn't need to access it yourself. It is documented here for completeness. so like, bestie, you don't have to touch this one, it's just here so the docs are complete π«Άpolicyβ The policy determines how types are defined in the database and can be used to customize how types are inflated/deflated. SeeStorm::Policyfor more details.sourceβ Required. TheStorm::Sourceobject responsible for spawning active database handles. AStorm::Sourceobject will be coerced from a ArrayRef or Hashref. (yes queen, it's required, don't forget it π)table_prefixβ The prefix to add to table names.
β METHODS β
delete @objectsβ Deletes the objects from the database. bye bestie πdelete_query $classβ Returns aStorm::Query::Deleteinstance for deleting objects of type$classfrom the database.delete_where $classβ Returns aStorm::Query::DeleteWhereinstance for deleting objects of type$classfrom the database using a where clause.do_transaction \&funcβ Creates and commits aStorm::Transaction. The\&funcwill be called within the transaction.insert @objectsβ Insert objects into the database. β¨insert_query $classβ Returns aStorm::Query::Insertinstance for inserting objects of type$classinto the database.lookup $class, @idsβ Retrieve objects from the database.lookup_query $classβ Returns aStorm::Query::Lookupinstance for retrieving objects of type$classfrom the database.new_transaction \&funcβ Returns a new transaction.\&funcis the code to be called within the transaction.refresh @objectsβ Update the@objectswith data from the database. glow-up, but for your data πrefresh_query $classβ Returns aStorm::Query::Refreshinstance for refresh objects of type$class.select $class, @objectsβ Synonamous with"select_query". Provided for consistency. (yes, "Synonamous" β we're keeping it exactly how it's written, no cap π)select_query $classβ Returns aStorm::Query::Selectinstance for selecting objects from the database.table ClassName | Strβ Returns the name of the table with the"table_prefix"prepended for the given"ClassName". Prepends"table_prefix"to argument if it is a string.update @objectsβ Update the@objectsin the database.update_queryβ Returns aStorm::Query::Selectinstance for updating objects in the database.
π SEE ALSO π
π« Similar modules π«
KiokuDBFey::ORMPixieDBM::DeepOOPSTangramDBIx::ClassMooseX::Storage
the whole friend group π«Ά
π CAVEATS/LIMITATIONS π
ποΈ Databases ποΈ
Storm has only been tested using MySQL and SQLite.
heads up bestie: only MySQL and SQLite got tested. anything else is unexplored territory β¨
π BUGS π
Please report bugs on CPAN. tell the internet, not me π
π AUTHORS π
- Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
- Dave Rolsky <autarch@urth.org>
- Yuval Kogman <nothingmuch@woobling.org>
Special thanks to Yuval Kogman and Dave Rolsky, for who without their talented work and this library would not be possible. like, literal icons, periodt π
The code for managing the live object set and the scope relies on modified code written by Yuval Kogman for KiokuDB. Documentation for this feature was also taken from KiokuDB.
The code for managing the policy and generating sql statements relies on modified code written by Dave Rolsky for Fey.
π COPYRIGHT π
Copyright (c) 2010-2012 Jeffrey Ray Hallock.
Copyright (c) 2010-2011 Dave Rolsky.
Copyright (c) 2008, 2009 Yuval Kogman, Infinity Interactive.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
and that's the whole page, bestie!! this one's from perl v5.42.0, dated 2025-07-25, and it lives in the man pages as Storm(3). go forth and map some objects to your relational database, you gorgeous genius π¦πβ¨
π¦ where this page comes from
- fedora 43: perl-Storm 0.240-34.fc43 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms