[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.117, Thu Apr 2 01:13:32 2009 UTC revision 1.118, Thu May 21 18:56:28 2009 UTC
# Line 3461  Line 3461 
3461      return $retVal;      return $retVal;
3462  }  }
3463    
3464    =head3 Quoted
3465    
3466        my $string = Tracer::Quoted($var);
3467    
3468    Convert the specified value to a string and enclose it in single quotes.
3469    If it's undefined, the string C<undef> in angle brackets will be used
3470    instead.
3471    
3472    =over 4
3473    
3474    =item var
3475    
3476    Value to quote.
3477    
3478    =item RETURN
3479    
3480    Returns a string enclosed in quotes, or an indication the value is undefined.
3481    
3482    =back
3483    
3484    =cut
3485    
3486    sub Quoted {
3487        # Get the parameters.
3488        my ($var) = @_;
3489        # Declare the return variable.
3490        my $retVal;
3491        # Are we undefined?
3492        if (! defined $var) {
3493            $retVal = "<undef>";
3494        } else {
3495            # No, so convert to a string and enclose in quotes.
3496            $retVal = $var;
3497            $retVal =~ s/'/\\'/;
3498            $retVal = "'$retVal'";
3499        }
3500        # Return the result.
3501        return $retVal;
3502    }
3503    
3504  =head3 EOF  =head3 EOF
3505    
3506  This is a constant that is lexically greater than any useful string.  This is a constant that is lexically greater than any useful string.

Legend:
Removed from v.1.117  
changed lines
  Added in v.1.118

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3