[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Perl HDML Utility Library
Section 38 out of 79 total sections , Section 3 out of 3 sections in this chapter


Functions

The following sections describe functions in the UP.SDK Perl HDML utility library.



OutputDeck()


Description

OutputDeck() prints an HDML deck with appropriate HTTP headers to standard output.


Synopsis


Arguments

Argument  Meaning  
$deck  

The deck to output. 

$charset  

The character set used in the deck. If you don't specify a character set, none is used. 


Example

The following code:

generates the HTTP response below and the display card shown in Figure 5-1.

FIGURE  5-1.     Display card generated by OutputDeck()



OutputDigest()


Description

Prints an UP.Link digest with appropriate HTTP headers to standard output.


Synopsis


Arguments

Argument  Meaning  
$digest  

The digest to output.  


Example

The following code generates the digest depicted in Figure 5-2:

FIGURE  5-2.     A digest containing two decks



HTTPEscapeString()


Description

HTTPEscapeString() converts characters that are reserved in URLs to legal escape sequences. For example, if you pass HTTPEscapeString() a string containing spaces, it converts them to plus signs (+).


Synopsis


Arguments

Argument  Meaning  
$string  

The string to escape.  


Example

The following code:

prints:



HDMLEscapeString()


Description

HDMLEscapeString() converts characters that are reserved in HDML (such as angle brackets) to legal escape sequences. For example, if a URL contains an ampersand, HDMLEscapeString() converts it to an & string.


Synopsis


Arguments

Argument  Meaning  
$string  

A string containing reserved characters.  


Example

The following code:

prints:



ParseCGIVars()

ParseCGIVars() parses CGI environment variables into an associative array.


Description

Extracts the key-data pairs from the CGI environment and into an associative array.


Returns

An associative array of all CGI environment key-data pairs.


Example

The following code prints the UP.Link subscriber number after a request from an UP.Link server:



ParseURLEncodedString()


Description

Extracts key-data pairs from a URL-encoded string.


Synopsis


Arguments

Argument  Meaning  
$string  

The URL-encoded input string to parse.  


Returns

Returns an associative array of the key-data pairs in the specified string.


Example

The following code:

prints:



ErrorExit()


Description

Prints an error deck to standard output, then exits.


Synopsis


Arguments

Argument  Meaning  
$str1  

Error description. 

$str2  

Additional error description.  


Example

The following code:

generates the HTTP response below and the display card shown in Figure 5-3.

FIGURE  5-3.     Display card generated by ErrorExit()


[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Perl HDML Utility Library
Section 38 out of 79 total sections , Section 3 out of 3 sections in this chapter


Copyright © 1999, Unwired Planet, Inc. All rights reserved.