NAME
Fry::Lib::Default - Default library loaded by Fry::Shell
DESCRIPTION
This library contains the basic commands to manipulate shell components: listing them, dumping (printing) their objects,unloading them, loading them via a library and a few general-purpose functions. Currently the commands are documented by their above definitions in &_default_data ie their 'u' attribute describes what input they take and their 'd' attribute describes them.
Autoloaded Libraries
There are currently two ways of using an autoloaded library via a library's class methods or a library's object methods. These two ways use the commands classAct and objectAct respectively. Before using either command you must load an autoload library via &initLibs.
&classAct
The only current autoload library for &classAct is Fry::Lib::Inspector. After installing Class::Inspector, start a shell session and load this library (ie 'initLibs :Inspector'). You can now execute the class methods of Class::Inspector! Looking at the 'u' (usage) attribute of classAct above you see that the first argument is a library followed by a method and then its arguments. For example you could run the &resolved_filename method of Class::Inspector ie 'classAct :Inspector resolved_filename Class::Inspector'. Note that I don't have to change the parsing of this line as the arguments neatly split on whitespaces (the default parser). Also, the :$basename is a shorthand for libraries under Fry::Lib space.
&objectAct
We'll use Fry::Lib::DBI as our sample library. Installing DBI and load the library as before ie 'initLibs :DBI'. To establish your own database connection you need to define your own variables for user, password (pwd),dbms (db) and database (dbname) in a separate config file (or just change them in the module in &_initLib for a quick hack ;)). The former requires using &loadFile $filename at the commandline. You can now act on methods of a basic database handle. The usage for &objectAct indicates to pass the object name followed by its method and its arguments ie 'objectAct dbh tables' which will print out all the database's tables. A more advanced command could be "-p=e objectAct dbh selectall_arrayref,,'select * from perlfn' ". This commandline changes the parse subroutine to &parseEval and executes an sql query on the perlfn table. You should have gotten a list of records. You now have a simple DBI shell without having hardwritten any perl code!
AUTHOR
Me. Gabriel that is. I welcome feedback and bug reports to cldwalker AT chwhat DOT com . If you like using perl,linux,vim and databases to make your life easier (not lazier ;) check out my website at www.chwhat.com.
COPYRIGHT & LICENSE
Copyright (c) 2004, Gabriel Horner. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.