New subroutine PSPP::Dict::get_var_by_name
[pspp-builds.git] / perl-module / lib / PSPP.pm
index a000b0115adbbd60a066787cdb6fec2f7cd19c6a..6fbae803a9b250cf3d0aa8aaccaebaaace00aba5 100644 (file)
@@ -106,6 +106,28 @@ sub get_var
     return $var;
 }
 
+=pod
+
+=head3 get_var_by_name ($name)
+
+Returns the variable from the dictionary whose name is C<name>.
+If there is no such variable, a null reference will be returned.
+
+=cut
+
+sub get_var_by_name
+{
+    my $dict = shift;
+    my $name = shift;
+    my $var = pxs_get_var_by_name ($dict, $name);
+
+    if ( ref $var ) 
+    {
+       bless ($var, "PSPP::Var");
+    }
+    return $var;
+}
+
 
 package PSPP::Fmt;