Comparison: HTTP with Java, Perl or Python

Ingo Linkweiler i.linkweiler at gmx.de
Sat Jun 8 11:43:48 EDT 2002


Thanks a lot for your versions.
Which of ALL solutions is the shortest, and which the best ?
Do you know good ways to measure the size? (LOC, irredundant or packed 
bytes....)
But even without this:

The Python version is quite short, even after adding exception handling. 
TCL seems to be same.
The Perl version seems to be the shortest, but can you read it without 
knowing Perl?

Can you estimate the time you needed for writing it?
Did you have any difficulties?
My Python version needed 2 Minutes, with Java I needed 20, because I did 
not unterstand the f******* manual.




PS:
This was my own Java solution:

package meintest;
import java.lang.Exception;
import java.net.*;
import java.io.*;
public class getURL {
  public static void main(String[] args) {
    try {
      URL url = new URL("http://www.uni-dortmund.de");
      InputStream in = url.openStream();
      for (;;)
      {
          int data = in.read();
          if (data == -1)
              break;
          else
              System.out.print ( (char) data);
      }
    }
    catch (Exception e) { }
  }
}




More information about the Python-list mailing list