dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
448
share rss forum feed


aefstoggaflm
Open Source Fan
Premium
join:2002-03-04
Bethlehem, PA
kudos:7
Reviews:
·PenTeleData
·Verizon Online DSL

combine two perl scripts together?

#1 Script one

#!/usr/bin/perl
 
    local ($buffer, @pairs, $pair, $name, $value, %FORM);
    # Read in text
    $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
    if ($ENV{'REQUEST_METHOD'} eq "POST")
    {
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    }else {
$buffer = $ENV{'QUERY_STRING'};
    }
    # Split information into name/value pairs
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs)
    {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(..)/pack("C", hex($1))/eg;
$FORM{$name} = $value;
    }
    $text_content = $FORM{textcontent};
 
print "Content-type:text/html\r\n\r\n";
print "<html>";
print "<head>";
print "<title>Text Area - Fifth CGI Program</title>";
print "</head>";
print "<body>";
print "<h2> Convert Text Content is $text_content</h2>";
print "</body>";
print "</html>";
 
1;
 

#2 Script two

#!/usr/bin/perl
 
open NEWFILE, ">", "fixedteles".int(rand(999)).".bzw";
$i=0;#Start the counter
$inteleporter=0;#If we are between "teleporter" and "end"
foreach(<>)
{
     if(/^(\s*teleporter)(.*)$/)
     {
          #It's a teleporter
          print NEWFILE $1," tele",$i," ",$2;#Give a name to each teleporter
          
          $i+=2;#Increment by two: because odd numbers are just the backs of the even number tele's
          $inteleporter=1;
     }
     elsif(/^\s*(to|from)\s+(\d+)(.*)$/)
     {
          #It's a link. Figure out what to change the tele # to. ($2)
          $newlink=$2;#Get the link number
          $backfront=":f";#Decide on the front or back.
          if($newlink % 2)
          {
               $newlink-=1;$backfront=":b";#if it's an odd number, increase it by one and change it to the back of the tele.
          }
          $newlink="tele".$newlink.$backfront;#Add tele at the beginning and then back or front
          print NEWFILE $1, " ", $newlink, $3;#Print in the new link.
     }
     elsif($inteleporter && /^\s*name(\s+.*)/)
     {
          #If we are in the teleporter and find a name, remove it.
          1;#don't print anything
     }
     else
     {
          
          print NEWFILE $_;
          #otherwise just print the line
          if (/^\s*end/){$inteleporter=0;}#If we get to the end, we are not in the teleporter.
     }
     
}
 

#3 Notes:

a) I know this is possible since I see and use »d41games.freehostia.com/stuff/te···put.html but I do not know how to do it.

b) I get the HTML, I need to use a web server that can use perl/cgi, and I know that I need to have perl/cgi support up and running with my web server, but it is just the perl/cgi programing part that got me confused.

Thank you for any help.

--
Please use the "yellow (IM) envelope" to contact me and please leave the URL intact.

aguen
Premium
join:2003-07-16
Grants Pass, OR
kudos:2

I suggest you start your journey looking through some of the links found here:

»www.google.com/search?q=perl+mon···official
--
Stupid people shouldn't be allowed to breathe



aefstoggaflm
Open Source Fan
Premium
join:2002-03-04
Bethlehem, PA
kudos:7
Reviews:
·PenTeleData
·Verizon Online DSL

1 edit

said by aguen:

I suggest you start your journey looking through some of the links found here:

»www.google.com/search?q=perl+mon···official

So, you are saying asking them too?

Thank you
--
Please use the "yellow (IM) envelope" to contact me and please leave the URL intact.

aguen
Premium
join:2003-07-16
Grants Pass, OR
kudos:2

1 recommendation

reply to aefstoggaflm

I guess I'm saying, that this forum is primarily for UNIX/LINUX OS related questions or issues. PERL is a programming language which can be installed and used on many different platforms such as Windows, AIX, SOLARIS as well as the various nix's.

The first link provided in the results list I posted can be used to either ask perl specific coding questions, find tutorials for learning about perl and other links can provide examples of code that may assist you on your way as well.
--
Stupid people shouldn't be allowed to breathe



aefstoggaflm
Open Source Fan
Premium
join:2002-03-04
Bethlehem, PA
kudos:7
Reviews:
·PenTeleData
·Verizon Online DSL

They did help, but they only answered how to combine them together.

Is/are there any other website(s) with message board(s), where people will write the code to do so?

Thank you
--
Please use the "yellow (IM) envelope" to contact me and please leave the URL intact.



Salty_Peaks

@173.255.181.x

I'm highly proficient in Perl, I'd do it for you, but without understanding what exactly you're trying to do I can't find the proper merge point.



aefstoggaflm
Open Source Fan
Premium
join:2002-03-04
Bethlehem, PA
kudos:7
Reviews:
·PenTeleData
·Verizon Online DSL

said by Salty_Peaks :

I'm highly proficient in Perl, I'd do it for you, but without understanding what exactly you're trying to do I can't find the proper merge point.

Ok.

Get user input for a bzflag map, convert the teleporters and links for the teleporters, and provide the output in a webpage. Something like the way that is used at »d41games.freehostia.com/stuff/te···put.html

For example convert from this map
download5-lasertag.bzw 1585 bytes
org map
(5-lasertag.bzw.zip)
to this map
downloadconverted 5-···rtag.bzw 1599 bytes
fixed map
(converted 5-lasertag.bzw.zip)

--
Please use the "yellow (IM) envelope" to contact me and please leave the URL intact.


rsaturns

join:2004-12-06
Beaverton, OR
reply to aefstoggaflm

Check out Stack Overflow on the Stack Exchange awesome when you need some eyes on code.
--
»tripplehelix.net