By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

Form to my perl-script

P: 2
I have a script that change a gpx-file. Some of the commands has to be deleted.
Expand|Select|Wrap|Line Numbers
  1. $filename = "tourfile.gpx";
  2. local ($^I, @ARGV) = ('.bak', $filename);
  3. while (<>) {
  4.   print unless m|<extensions>| .. m|</extensions>|;        
  5. }
This script deletes the "excentions" commands.
I want to make a form so I can load the filename to the script true this form.
After the file has been made I want to rename it to a xml-file.

Can somebody help me?
Feb 22 '10 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 2.5K+
P: 3,503
If you create a form to have someone input a script name, then you have to have to worry about cgi and such. Why not just take the script and modify it to accept an argument to the script? Would that be a possibility?
Feb 22 '10 #2

P: 2
I show here the (a part) of the source of my program:
Expand|Select|Wrap|Line Numbers
  1.    <script src="loadgpx.4.js" type="text/javascript"></script>
  2.         <script type="text/javascript">
  3.         //<![CDATA[
  5.         var MyMap;
  7.         function LoadGPXFileIntoGoogleMap(map, filename)
  8.         {
  9.             // Remove any existing overlays from the map.
  10.             map.clearOverlays();
  12.             var request = GXmlHttp.create();
  13.   "GET", filename, true);
  14.             request.onreadystatechange = function()
  15.             {
  16.                 if (request.readyState == 4)
  17.                 {
  18.                     parser = new GPXParser(request.responseXML, map);
  19.                     parser.SetTrackColour("#ff0000");                    // Set the track line colour
  20.                     parser.SetTrackWidth(5);                            // Set the track line width
  21.                     parser.SetMinTrackPointDelta(0.001);                // Set the minimum distance between track points
  22.                     parser.CenterAndZoom(request.responseXML, G_HYBRID_MAP); // Center and Zoom the map over all the points.
  23.                     parser.AddTrackpointsToMap();                        // Add the trackpoints
  24.                     parser.AddWaypointsToMap();                            // Add the waypoints
  25.                 }
  26.             }
  27.             request.send(null);
  28.         }
  30.         function onLoad()
  31.         {
  32.             MyMap = new GMap2(document.getElementById("map"));
  33.             MyMap.addControl(new GLargeMapControl());
  34.             MyMap.addControl(new GMapTypeControl());
  35.             LoadGPXFileIntoGoogleMap(MyMap, "blog/2005-07/gurreso2.gpx");
  36.         }
  38.         //]]>
  39.         </script>
  40.     </head>
  41.     <body onload="onLoad()">
  42.         <div id="map" style="width: 100%; height: 100%;"></div>
  43.     </body>
  44. </html>
I have experienced that I don't need the "<excentions>"-statement.
I need to load the gpx-file into the code through a inputform AND rename it to a .xml-file.
Maybe I don't need to rename, but it only works if I start to rename the gpx-file.

Can anybody help me?
Feb 23 '10 #3

Expert Mod 2.5K+
P: 3,503
You need to really learn to use code tags. They are required around code you post into the forums. If you do not know how to use them, then please read #11 here.

Looking closer at the code, now that you have provided it, this is not Perl, but is instead Javascript. I am moving this to the javascript forum.


Feb 23 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.