Home
Authors History
Donations Cats
News
News FVWM Logo
Logo Competition
Features
Features
Download
Download
Icons and Sounds
Screenshots
Desktop Screenshots Menu Screenshots
Window Decor Screenshots Vectorbuttons
Documentation
Documentation Man pages
FAQ Developer Info
Mailing Lists
Mailing Lists
Links
Links
Customize
 
 Official FVWM Home Page plain theme

FVWM - Perl library - General::Parse


General::Parse

Section: FVWM Perl library (3)
Updated: 2005-08-24
Source: General/Parse.pm
This page contents - Return to main index
 

NAME

General::Parse - parsing functions  

SYNOPSIS

  use General::Parse;

  my $string = q{Some "not very long" string of 6 tokens.};
  my $token1 = cutToken(\$string);          # $token1 = "Some";
  my ($token2, $token3) = cutTokens(\$string, 2);
  my @subtokens = getTokens($token2);       # ("not", "very", "long")
  my $subtoken1 = getToken($token2);        # the same as $subtokens[0]
  my $endingArrayRef = getTokens($string);  # ["of", "6", "tokens."]
 

DESCRIPTION

This package may be used for parsing a string into tokens (quoted words).  

FUNCTIONS

 

getToken

description
Returns the first token of the given string without changing the string itself.

If the string is empty or consists of only spaces the returned token is undef.

If the caller expects a scalar - the token is returned. If it expects an array - 2 values returned, the token and the rest of the string.

parameters
String (scalar) to be parsed.
returns
Token (scalar). Or, in array context, array of 2 scalars: token and the rest of string.
 

cutToken

description
Returns the first token of the given string, the input string is cut to contain tokens starting from the second one.

If the string is empty or consists of only spaces the returned token is undef and the string is changed to an empty string.

parameters
String (scalar) to be parsed.
returns
Token (scalar).
 

getTokens

description
Returns all or the requested number of tokens of the given string without changing the string itself.

The returned array may contain less tokens than requested if the string is too short. Particularly, the returned array is empty if the string is empty or consists of only spaces.

If the caller expects a scalar - a reference to the token array is returned. If it expects an array - the token array is returned.

parameters
String (scalar) to be parsed, and optional limit (integer) for number of returned tokens.
returns
Tokens (array of scalars or array ref of scalars depending on context).
 

cutTokens

description
Returns the requested number of tokens of the given string, the string is cut to contain the tokens starting from the first non returned token.

The returned array may contain less tokens than requested if the string is too short. Particularly, the returned array is empty if the string is empty or consists of only spaces.

If the caller expects a scalar - a reference to the token array is returned. If it expects an array - the token array is returned.

parameters
String (scalar) to be parsed, and limit (integer) for number of returned tokens.
returns
Tokens (array of scalars or array ref of scalars depending on context).
 

eqi

description
Similar to eq, but case-insensitive, gets 2 strings, returns boolean.
 

nei

description
Similar to ne, but case-insensitive, gets 2 strings, returns boolean.
 

AUTHOR

Mikhael Goikhman <migo@homemail.com>


 

Index

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
getToken
cutToken
getTokens
cutTokens
eqi
nei
AUTHOR

This document was created by man2html, using the manual pages.
Time: 00:51:37 GMT, August 27, 2005

Last modified on August 26, 2005