Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with CGI.pm on new servers

Status
Not open for further replies.

starbizcon

Programmer
Jul 24, 2008
3
TH
I am using $Cgi->popup_menu and reading default values from a text file, which previously printed

<select name="convert_links_to_friendly" >
<option value="1">Yes</option>
<option selected="selected" value="0">No</option>
</select>

if the value was 0, but since several weeks on all new servers I tried, it prints

<select name="convert_links_to_friendly" >
<option value="1">Yes</option>
<option value="0">No</option>
</select>

how can i get option selected again if the read-in value is 0?
 
I know, but maybe someone knows what changed regarding cgi.pm in new perl distributions which explains such behaviour.
 
Please show us the code you're using to generate this. Otherwise we'd just be guessing what might have happened.
 
It's probably a permissions problem or a code problem not a cgi.pm problem. Post your code.. really.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I recommend you don't post your code, this will be a fun guessing game. First one to guess wins a prize. My guess is that there is no -default option defined.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
My guess: It must have something to do with the flux capacitors in the new servers. Are you sure they're operating at 1.21 jigawatts?
 
I'd put my ducks with Kevin. I'm going to guess that the -default was not set and that you are trying to use selected="selected" instead and that it's not working cause of it.
 
one guess per member please.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
oops ... ok ... well since you got the -default option i'll take the override
 
You've been a member for 7 months and have only 9 posts? I guess the rumors are true that there is life outside the forum? I think I had 9 posts in my first two minutes as a member. Not sure if I should be proud or embarrassed. [flush]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I think i should be embarressed. I actualy drowned myself in my books there for a bit and stopped reading here for a bit, but I'm back. 8)
 
then..... welkome back komrade!

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
My guess would be the same as Kevin's. Have a look at the docs for your answer.

 
It's possible he thinks you've been pointing at it with your middle finger, Chris [smile] Poor lad, it was only his first post on Tek-Tips. After the complete rinsing he got, I suspect it may be his last, too...

Maybe it's the heat, the humidity, the boredom of the summer, but it's amazing how the normally mild-mannered* forum members will suddenly reach tipping point and savage the weakest member like a pack of dogs...

Come on starbizcon, you can do it. Post the code, we've got to know. There's a closely fought competition riding on it!


* well mostly, anyway...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
He has the question on devshed too, where he is getting the same response: post the code. So far he has not responded.

This was all in good humor I thought, he might have taken it the wrong way though, so sorry to the OP if that was the case. Put your finger back in your nose Chris. ;)

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Hello, oops I just re-checked the thread and didnt expect so much attention to my theoretic problem :)

This should be the code in question (I discovered the particular problem occurs only on servers with very recently updated cpanel):

Code:
sub Printbehaviour
{

my($message, @label, %LABEL, %LABEL2, @label2, %HTML,%ARLABEL,@cfg,$n,$string);
        ($message) = @_ if $_[0];
        @label  = (1,0);
        %LABEL =(1=>"Yes", 0=>"No");
        %LABEL2 =(0=>"Yes", 1=>"No");
        @label2 = ('instant', 'sendmail','pending');
        @label_ads_when_expires= ('delete', 'suspend','expire','nothing');
        %ARLABEL=("login"=>"login page","panel"=>"control panel","post"=>"ad posting page");
        %DATETIME_ALGO=("POSIX"=>"POSIX","internal"=>"internal");

        $HTML{flock}=      $Cgi->popup_menu("flock", \@label, $CONFIG{flock}, \%LABEL);
        $HTML{rename}=     $Cgi->popup_menu("rename", \@label, $CONFIG{rename}, \%LABEL);
        $HTML{javascript}= $Cgi->popup_menu("javascript", \@label, $CONFIG{javascript}, \%LABEL);
        $HTML{ad_type}=    $Cgi->popup_menu("ad_type", ['instant', 'pending'], $CONFIG{ad_type});

        $HTML{ads_when_expires}=$Cgi->popup_menu("ads_when_expires", \@label_ads_when_expires, $CONFIG{ads_when_expires}); #, \%LABEL);

        $HTML{ads_when_conforms}=$Cgi->popup_menu("ads_when_conforms", \@label, $CONFIG{ads_when_conforms}, \%LABEL);
        $HTML{gal_file_type}=$Cgi->popup_menu("gal_file_type", ['instant', 'pending'], $CONFIG{gal_file_type});
        $HTML{member_type}=$Cgi->popup_menu("member_type", \@label2, $CONFIG{member_type});
        $HTML{duplicate_email}=$Cgi->popup_menu("duplicate_email", \@label, $CONFIG{duplicate_email}, \%LABEL);
        $HTML{thumbnailer}=$Cgi->popup_menu("thumbnailer", [none, GD, "Image Magick"], $CONFIG{thumbnailer});
        $HTML{show_empty_subs}=$Cgi->popup_menu("show_empty_subs", \@label, $CONFIG{show_empty_subs}, \%LABEL);
        $HTML{allow_html}=$Cgi->popup_menu("allow_html", \@label, $CONFIG{allow_html}, \%LABEL);
        $HTML{hide_blank}=$Cgi->popup_menu("hide_blank", \@label, $CONFIG{hide_blank}, \%LABEL);
        $HTML{photos_first}=$Cgi->popup_menu("photos_first", \@label, $CONFIG{photos_first}, \%LABEL);
        $HTML{after_reg}= $Cgi->popup_menu("after_reg",['panel','post'],$CONFIG{after_reg},\%ARLABEL);
        $HTML{mail_non_members}=$Cgi->popup_menu("mail_non_members", \@label, $CONFIG{mail_non_members}, \%LABEL);
        $HTML{convert_links_to_friendly}=$Cgi->popup_menu("convert_links_to_friendly", \@label, $CONFIG{convert_links_to_friendly}, \%LABEL);
        $HTML{mod_perl}=$Cgi->popup_menu("mod_perl", \@label, $CONFIG{mod_perl}, \%LABEL);
        $HTML{add_new_account_ads_allowed_to_previous_ads_allowed}=$Cgi->popup_menu("add_new_account_ads_allowed_to_previous_ads_allowed", \@label, $CONFIG{add_new_account_ads_allowed_to_previous_ads_allowed}, \%LABEL);
        $HTML{increase_member_ads_used_during_renewing_ad}=$Cgi->popup_menu("increase_member_ads_used_during_renewing_ad", \@label, $CONFIG{increase_member_ads_used_during_renewing_ad}, \%LABEL);
        $HTML{datetime_algorithm}= $Cgi->popup_menu("datetime_algorithm",['POSIX','internal'],$CONFIG{datetime_algorithm},\%DATETIME_ALGO);
        $HTML{anti_robot_check}=$Cgi->popup_menu("anti_robot_check", \@label, $CONFIG{anti_robot_check}, \%LABEL);
        $HTML{count_stats_from_non_registered}=$Cgi->popup_menu("count_stats_from_non_registered", \@label, $CONFIG{count_stats_from_non_registered}, \%LABEL);



                $string=&FileRead($TEMPLATE{behaviour});
                @cfg=('',1..64,'3a','18a','18b','18c','20a','20b');
        foreach my $n (@cfg) {
           $string=~ s/\[mj_cfg$n\]/$mj{cfg.$n}/ig;
        }

        $string=~ s/\[message\]/$message/i;
        $string=~ s/\[CONFIG_ad_notify\]/$CONFIG{ad_notify}/i;
        $string=~ s/\[CONFIG_max_message_length\]/$CONFIG{max_message_length}/i;
        $string=~ s/\[CONFIG_currency\]/$CONFIG{currency}/i;
        $string=~ s/\[CONFIG_registration_bonus\]/$CONFIG{registration_bonus}/i;
        $string=~ s/\[CONFIG_days_keep_ads_in_db_after_expire\]/$CONFIG{days_keep_ads_in_db_after_expire}/i;
        $string=~ s/\[CONFIG_datetime_algorithm\]/$CONFIG{datetime_algorithm}/i;
        $string=~ s/\[CONFIG_datetime_format\]/$CONFIG{datetime_format}/i;
        $string=~ s/\[CONFIG_add_new_account_ads_allowed_to_previous_ads_allowed\]/$CONFIG{add_new_account_ads_allowed_to_previous_ads_allowed}/i;



        foreach my $key(keys %CONFIG) {$string=~ s/\[CONFIG_$key\]/$CONFIG{$key}/i;}
        foreach $key(keys %HTML) {$string=~ s/\[HTML_$key\]/$HTML{$key}/i;}

        &PrintHeader;
                print $string;
                &PrintFooter; exit;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top