# NAME

Soar::WM - Traverse Soar working memory dumps

# VERSION

version 0.04

# SYNOPSIS

    use Soar::WM qw(wm_root_from_file);
    my $root = wm_root_from_file('/path/to/wme/dump');
    print $root->id; #probably prints S1
    

    #or
    my $wm = Soar::WM->new(text => '(S1 ^foo bar)
    (S2 ^boo far)');
    my $wme = $wm->get_wme('s2');

# DESCRIPTION

This module represents Soar's working memory. It can be used for traversing and manipulating WME dumps
generated by Soar.

# NAME

Soar::WM - Perl extension for representing Soar working memory given a WME dump file

# METHODS

## `new`

Creates a new instance of Soar::WM. The arguments to this method are the same as those to wm\_root.

## `get_wme`

Argument: string working memory element ID ('S1', 'Z33', etc.); since WME ID's are always uppercase, this method is
case insensitive.

Returns a [Soar::WM::Element](http://search.cpan.org/perldoc?Soar::WM::Element) instance representing the given ID. 

## `wm_root_from_file`

This is a shortcut for:

    wm_root(file=>$arg)

It's single argument is the path to a WME dump file, or an opened file handle for one. It returns a [Soar::WM::Element](http://search.cpan.org/perldoc?Soar::WM::Element) object representing the root
of the given WME dump.

## `wm_root`

This function reads in a Soar WME dump and returnes a [Soar::WM::Element](http://search.cpan.org/perldoc?Soar::WM::Element) representing its root.
It takes a named argument, file or text. Using `wm_root(file=`path)> or `wm_root(file=`$fileGlob)>, you can create an object given the path to a WME dump file.

Using `wm_root(text=`'(S1 ^foo bar)')>, you can create an object using a given WME dump text. 
If neither argument is specified, this function will wait for input from standard in.

# SEE ALSO

The homepage for the Soar cognitive architecture is here: [http://sitemaker.umich.edu/soar/home](http://sitemaker.umich.edu/soar/home).

# AUTHOR

Nathan Glenn <garfieldnate@gmail.com>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Nathan Glenn.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
