Added method to get the custom variable attributes
[pspp-builds.git] / perl-module / lib / PSPP.pm
index f99afde36ea7d68b85591708ec1595f83c6ca7c0..2ea613dee31b8ae987779ec7e2865f2a1cf73e98 100644 (file)
@@ -4,7 +4,7 @@ use warnings;
 
 =head1 NAME
 
-PSPP - Perl extension to PSPP
+PSPP-Perl - Perl extension to PSPP
 
 =head1 SYNOPSIS
 
@@ -12,8 +12,8 @@ PSPP - Perl extension to PSPP
 
 =head1 DESCRIPTION
 
-PSPP:: provides an interface to the libraries used by pspp to create
-system files.  
+PSPP-Perl provides an interface to the libraries used by pspp to read and
+write system files.  
 
 =head1 EXPORT
 
@@ -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;
 
@@ -333,6 +355,12 @@ sub set_value_labels
 Sets the missing values for the variable.  
 No more than three missing values may be specified.
 
+=head3 get_attributes()
+
+Returns a reference to a hash of the custom variable attributes.
+Each value of the hash is a reference to an array containing the 
+attribute values.
+
 =head3 get_name ()
 
 Returns the name of the variable.