Results 1 to 4 of 4

Thread: Modification of an existing program in Perl

  1. #1
    Join Date
    Jun 2009
    Posts
    441

    Modification of an existing program in Perl

    I must change a program created in Perl. The purpose of my modification was to add a checkbox 'SID' and therefore to understand the program if my checkbox checkes the reference if it is not the same.

    That is, if the checkbox 'SID' is unchecked, the program runs normally and overthrow me:

    $ name =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (COMMUNITY = $ comm) (PROTOCOL = $ prot) (Host = $ host) (Port = $ port))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = $ serv)
    )
    ) ";

    However, if the checkbox 'SID' is checked, the program overthrow me:

    $ name =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = $ prot) (Host = $ host) (Port = $ port))
    )
    (CONNECT_DATA =
    (SID = $ serv)
    )
    ) ";

    So I post my script already changed but that does not work. I have my checkbox but wonder if the problems.

    On the checkbox if this is line 112 to 124.
    PHP Code:
    $query->param('SID'); 
    if (
    $query->param('SID')=='yes')
    {
            
    my $new="
            
    $name = 
                    (DESCRIPTION = (ADDRESS = (PROTOCOL = 
    $prot)(Host = 
                            
    $host)(Port = $port))
                    )
                    (CONNECT_DATA =
                             (SID = 
    $serv)
                    )
                    )"
    ;

    My checkbox 'SID' this is line 281 to 286 and line 414 to 419

    HTML Code:
    <TR>
            <TD colspan='2'>
                    <input type='checkbox' name='SID' value='yes'
                    <font size='2' style='font-weight:normal;'>Connection by SID<br>
            </TD>
    </TR>
    HTML Code:
    <TR>
            <TD colspan='2'>
                    <input type='checkbox' name='SID' value='yes'
                    <font size='2' style='font-weight:normal;'>Connection by SID<br>
            </TD>
    </TR>

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Modification of an existing program in Perl

    What is your exact error message? And I'd say you're trying to test a variable that does not exist (because an unchecked checkbox is a variable not sent). So it should instead use a if (defined ())

  3. #3
    Join Date
    Jun 2009
    Posts
    441

    Re: Modification of an existing program in Perl

    I have no error message exactly, but that box is checked or not makes no difference. I have always resulted in:

    $ name =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (COMMUNITY = $ comm) (PROTOCOL = $ prot) (Host = $ host) (Port = $ port))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = $ serv)
    )
    ) ";

    Besides I never touched the Perl so I'm confused.

    And I modified the beginning of my if. Now I put:

    if (defined ($ query-> param ( 'SID')))

    But I still have the same result, without an error message.

    HTML Code:
    <script>
    function Verify(string)
    {
            return (string.match(/^[A-Za-z0-9 _'-.]+\$/));
    }
    function VerifyNum(nbr)
    {
            return nbr.match(/^[0-9]+\$/);
    }
    function verif()
    {
            if (!Verify(document.f.name.value))
            {
                    alert(\"Check the size of fields NAME!\");
                    document.f.name.select();
                    return false;
            }
            if (!Verify(document.f.host.value))
            {
                    alert(\"Check the size of fields HOST!\");
                    document.f.host.select();
                    return false;
            }
            if (!Verify(document.f.serv.value))
            {
                    alert(\"Check the size of fields SERVICE_NAME!\");
                    document.f.serv.select();
                    return false;
            }
            if (!Verify(document.f.prot.value))
            {
                    alert(\"Check the size of fields PROTOCOL!\");
                    document.f.prot.select();
                    return false;
            }
            if (!Verify(document.f.comm.value))
            {
                alert(\"Check the size of fields COMMUNITY!\");
                document.f.comm.select();
                return false;
            }
            if (!VerifyNum(document.f.port.value))
            {
                alert(\"Check the size of fields PORT!\");
                document.f.port.select();
                return false;
            }
            document.f.add.value=\"ok\";
            document.f.submit();
    }</script>

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Modification of an existing program in Perl

    In the code you posted:
    Code:
    return (chaine.match (/ ^ [A-Za-z0 -9 _'-.]+ \ $/));
    That should rather be /^[A-Za-z0-9 _'-.]+$/, because in this context, \ $ will be interpreted as the $character and not as the end marker field / line for a regular expression. Same comment for
    Code:
    return nbr.match ( /^ [ 0 -9 ] +\$/ ) ;

Similar Threads

  1. Treasure Isle really needs some modification
    By Lobjeya in forum Video Games
    Replies: 6
    Last Post: 24-02-2011, 12:32 PM
  2. Program Structure in Perl
    By Iker in forum Software Development
    Replies: 5
    Last Post: 27-01-2011, 04:22 PM
  3. Executing a program with exec perl
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 08-03-2010, 02:02 PM
  4. After modification, no screen
    By gazwsx in forum Overclocking & Computer Modification
    Replies: 2
    Last Post: 10-10-2008, 03:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,433,940.07712 seconds with 16 queries