2 Replies - 1738 Views - Last Post: 23 February 2009 - 10:28 AM

#1 tejasce14   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-February 09

convert coding into procedural to Object Oriented in perl

Post icon  Posted 20 February 2009 - 03:39 AM

sub main{
	my $page;

	# Create CGI Object and Template object
	my $query = CGI->new();
    $page = HTML::Template->new(filename => $html_path.'/vacation_vacation_wait.html',die_on_bad_params => 0,);
	print $query->header();
    $|=1; # Pass buffered output to browser
	print $page->output();

    my $memd = new Cache::Memcached { # Memory cached for large file
        'servers' => [ "localhost:11211" ],
    };
    $memd->set_compress_threshold(10_000);

	# Create
	my $qdata;
	my $fn_cache;
	my %cacheopts =(
        'permissions'   => 0777,
        'expiry'        => 3600,	# expires in 60 minutes
        'bucketsize'    => 32768,
    );
    my $result;
    my $cookie = $query->cookie('sessid');
    $fn_cache = Cache::Mmap->new('/tmp/fmvacation',\%cacheopts);
    $qdata = $fn_cache->read($cookie);

    my @parameter_list;
	if ($ENV{'REQUEST_METHOD'} eq "GET") { # Get query string
		@parameter_list = split(/&/,$ENV{'QUERY_STRING'});
	}
	if(scalar @parameter_list eq 0){
		# Release memcahced key
        $memd->delete($cookie."same_date");
        $memd->delete($cookie."alter_date");

        #Create Search Query
        my $query_page = HTML::Template->new(filename => $html_path.'/template/search_query.tmpl',die_on_bad_params => 0,);
        $query_page->param('USERNAME' => $qdata->{saxusername});
        $query_page->param('PASSWORD' => $qdata->{saxpassword});
        for $tmpval (keys %req_value){
			my $flag = 0;
		    foreach $p_name (@names){
			    if(upcase($p_name) eq $tmpval){
			    	my $text;
			    	my $val;
			    	if(upcase($p_name) eq 'DATE_DEP'){
			    		my $dt = param($p_name);
			    		$dt =~ s/\///g;
						$val = $dt;
			    	}
			    	elsif(upcase($p_name) eq 'DEST_DEP'){
			    		$val = substr(param($p_name),rindex(param($p_name),"x")+1,length(param($p_name)));
			    		print "Destination : ",$val,"<br>" if $DEBUG_TRACE;
			    	}
			    	else{
			    		$val = param($p_name);
			    	}
			    	$query_page->param(upcase($p_name) => $val);
			    	$flag = 1;
			    }
			}
			if($flag eq 0){
		    	$query_page->param($tmpval => $req_value{$tmpval});
			}
		}


MOD EDIT: added code tags.

Is This A Good Question/Topic? 0
  • +

Replies To: convert coding into procedural to Object Oriented in perl

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: convert coding into procedural to Object Oriented in perl

Posted 23 February 2009 - 09:48 AM

Probably be better off in the Perl and Python forum, so off you go.
Was This Post Helpful? 0
  • +
  • -

#3 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: convert coding into procedural to Object Oriented in perl

Posted 23 February 2009 - 10:28 AM

There is not enough explanation to offer any help or suggestions, plus the question makes no sense anyway:

convert coding into procedural to Object Oriented in perl, perl in oops

No idea what that is asking or trying to ask.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1