Alzabo::FAQ(3pm)

πŸ“¦
version 0.92 Β· 2 versions
  • 0.92 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.92 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

Alzabo::FAQ β€” the Frequently Asked Questions, bestie edition. Everything you were about to ask in the group chat, already answered. πŸ’–


✨ How can I generate the SQL to turn one schema into another?

Okay so picture this: you already have schema objects for both sides (maybe you got them via reverse engineering, no judgement), and both schemas are for the same RDBMS. Then you literally just do this:

my @sql = $schema1->rules->schema_diff( old => $schema1, new => $schema2 );

And the @sql array is gonna hold all the SQL statements you need to transform the schema in $schema1 into the schema in $schema2. Chef's kiss. πŸ‘‘

If what you actually want is to sync a schema object to the current state of the RDBMS backend's schema, go look at the Alzabo::Create::Schema->sync_backend method instead. Iykyk. πŸ¦‹


πŸŽ€ How can I make a local copy of the documentation as HTML?

Alzabo ships with a script called make_html_docs.pl, and it takes three arguments, in this exact order:

  1. the source file directory root
  2. the target directory
  3. the absolute URL path that this target directory represents

If you've got perl 5.6.0 or newer installed, pls use it to run this script β€” the Pod::Html module that comes with more recent Perls does a much better job of making HTML. Glow up, honestly. ✨

If you were chillin' in the root of the source directory, you'd run it like:

perl ./make_html_docs.pl ./lib /usr/local/apache/htdocs/Alzabo_docs /Alzabo_docs

The script will make an index.html file and turn the documentation into HTML. Two for one, we love to see it. πŸ’…


πŸ’œ How can I optimize memory usage under mod_perl?

Three moves, bestie:

  • Simply preload the Alzabo::Runtime module β€” it loads all the other modules it needs anyway, so it's giving main character energy and doing the work for you.
  • Also, if you're using Alzabo::MethodMaker, make sure it runs in the parent. That module can create a lot of methods on the fly, and every single method eats up some memory. Not me watching my RAM disappear 😭
  • Finally, you can preload one or more schema objects. Easiest way is to just pass its name to Alzabo::Runtime when you use it, like this:
use Alzabo::Runtime qw( schema1 schema2 );

πŸ¦‹ How can I get objects for tables linked via the Mason GUI?

For example, if I have a websites2categories table which maps a list of categories that a given web site should display β€” and uses website_id and category_id in a 1..n relationship β€” what is the proper way to set that up in the GUI and then in my code?

Okay so in the GUI you can simply create a relationship from websites to categories, and declare it n..n. Alzabo will automatically create a table called websites_categories, and you're free to rename it to literally whatever you want. ✨

Then if you use Alzabo::MethodMaker, Alzabo will clock that you have a table with 2 cols, both of which are part of the PK, and that it has 1..n relationships with 2 other tables β€” and it will create the appropriate methods for you. Slay.

Wanna see what methods are being created? Set the ALZABO_DEBUG environment variable to METHODMAKER before loading Alzabo::MethodMaker, and it'll spit everything out to STDERR. Also there's the generated documentation, which you can grab via the docs_as_pod() schema method after MethodMaker does its thing. πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky, <autarch@urth.org>. Respect the legend. 🫢


And that's a wrap, bestie β€” this was written for perl v5.34.0, dated 2022-06-14, and it's the Alzabo::FAQ(3pm) page. Go forth and build ur schemas. Periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from