Welcome to EZDefinition.com
Technological Concepts, Abbreviations & Definitions
Main Menu
Main categories
  • Operating Systems
  • Computer Hardware
  • Internet
  • Programming Languages
  • Multimedia
  • Software
  • Security and Encryption
  • Communications and Networking
  • Organizations
  • Books
  • Databases
  • Games
  • E-commerce

    [an error occurred while processing this directive]

  • EZDefinition Sponsor
    Please visit our sponsor Parosoft.com
    Related Links to Debugging CGI
    [an error occurred while processing this directive]
    Debugging CGI
    [an error occurred while processing this directive]
    Computer Technologies  Programming Languages  Perl Debugging CGI

    Debugging

    Debugging

    If you are running the script from the command line or in the perl debugger, you can pass the script a list of keywords or parameter=value pairs on the command line or from standard input (you don't have to worry about tricking your script into reading from environment variables). You can pass keywords like this:

    my_script.pl keyword1 keyword2 keyword3
    or this:
    my_script.pl keyword1+keyword2+keyword3
    or this:
    my_script.pl name1=value1 name2=value2
    or this:
    my_script.pl name1=value1&name2=value2

    If you pass the -debug pragma to CGI.pm, you can send CGI name-value pairs as newline-delimited parameters on standard input:

    % my_script.pl
    first_name=fred
    last_name=flintstone
    occupation='granite miner'
    ^D

    When debugging, you can use quotation marks and the backslash character to escape spaces and other funny characters in exactly the way you would in the shell (which isn't surprising since CGI.pm uses "shellwords.pl" internally). This lets you do this sort of thing:

    my_script.pl 'name 1=I am a long value' name\ 2=two\ words

    If you run a script that uses CGI.pm from the command line and fail to provide it with any arguments, it will print out the line

    (offline mode: enter name=value pairs on standard input)

    then appear to hang. In fact, the library is waiting for you to give it some parameters to process on its standard input. If you want to give it some parameters, enter them as shown above, then indicate that you're finished with input by pressing ^D (^Z on NT/DOS systems). If you don't want to give CGI.pm parameters, just press ^D.
    You can suppress this behavior in any of the following ways:
    1. Call the script with an empty parameter.
    Example:
    my_script.pl ''

    2. Redirect standard input from /dev/null or an empty file.
    Example:
    my_script.pl </dev/null

    3. Include "-no_debug" in the list of symbols to import on the "use" line.
    Example:
    use CGI qw/:standard -no_debug/;

    Dumping Out All The Name/Value Pairs

    The Dump() method produces a string consisting of all the query's name/value pairs formatted nicely as a nested list. This is useful for debugging purposes:
    print $query->Dump
    Produces something that looks like this:
    <UL>
    <LI>name1
    <UL>
    <LI>value1
    <LI>value2
    </UL>
    <LI>name2
    <UL>
    <LI>value1
    </UL>
    </UL>
    You can achieve the same effect by incorporating the CGI object directly into a string, as in:
    print "<H2>Current Contents:</H2>\n$query\n";


    [an error occurred while processing this directive]

    [an error occurred while processing this directive]
     

    All Rights Reserved

    Terms of usage   Please read our privacy stetment
    Copyright © 1999-2006 EZDefinition.com

     

    [an error occurred while processing this directive]