Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-11-2009
Member
 
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>
Reply With Quote
  #2  
Old 26-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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 ())
Reply With Quote
  #3  
Old 26-11-2009
Member
 
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>
Reply With Quote
  #4  
Old 26-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
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 ] +\$/ ) ;
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Modification of an existing program in Perl"
Thread Thread Starter Forum Replies Last Post
Treasure Isle really needs some modification Lobjeya Video Games 6 24-02-2011 12:32 PM
Program Structure in Perl Iker Software Development 5 27-01-2011 04:22 PM
Executing a program with exec perl Ash maker Software Development 5 08-03-2010 02:02 PM
After modification, no screen gazwsx Overclocking & Computer Modification 2 10-10-2008 03:48 PM


All times are GMT +5.5. The time now is 01:33 PM.