Dev Tools/ljconsole

From Dreamwidth Notes
Revision as of 07:01, 4 October 2008 by Foxfirefey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a tool to perform an eval with the LJ codebase loaded in, similar to the script/console in Ruby on Rails. It is useful for testing out code for correctness in the LJ framework. (Note: this tool will have prettier output if you have the Perl library Term::Readline.)

On running this program, you get a prompt for the code to be eval'd. It will be evaluated in a "no strict" block--any variables you set will be retained between lines you enter.

Here is an example session, with entered commands preceded by a >:

> $u = LJ::load_user("system")
$VAR1 = bless( {
                'bdate' => '0000-00-00',
                'clusterid' => '1',
                'journaltype' => 'P',
                'caps' => '32770',
                'opt_htmlemail' => 'Y',
                'email' => undef,
                'password' => undef,
                'allow_getljnews' => 'N',
                'user' => 'system',
                'statusvis' => 'V',
                '_email' => 'EXAMPLE@gmail.com',
                'lang' => 'EN',
                'allow_infoshow' => ,
                'is_system' => 'N',
                'has_bio' => 'N',
                'name' => 'System Account',
                'moodthemeid' => '1',
                'opt_gettalkemail' => 'Y',
                'statusvisdate' => undef,
                'opt_showtalklinks' => 'Y',
                'useoverrides' => 'N',
                'txtmsg_status' => 'off',
                'userid' => 1,
                'status' => 'A',
                'themeid' => '1',
                '_orig_user' => 'system',
                'opt_forcemoodtheme' => 'N',
                'opt_mangleemail' => 'N',
                'defaultpicid' => '1',
                'oldenc' => '0',
                'dversion' => 8,
                'allow_contactshow' => 'Y',
                '_orig_userid' => '1',
                'opt_whatemailshow' => 'A',
                'opt_whocanreply' => 'all'
              }, 'LJ::User' );
> $u->{"has_bio"};
$VAR1 = 'N';