I'm not too sure if this is a perl question.....

  • Thread starter grocery_stocker
  • Start date
G

grocery_stocker

I have a question on the Firefox mork script found at:

http://www.jwz.org/hacks/mork.pl

##########################################################################
# Read in the file.

##########################################################################
open (IN, "<$file") || error ("$file: $!");
print STDERR "$progname: reading $file...\n" if ($verbose);

my $body = <IN>;
close IN;

$body =~ s/\r\n/\n/gs; # Windows Mozilla uses \r\n
$body =~ s/\r/\n/gs; # Presumably Mac Mozilla is similarly dumb

$body =~ s/\\\\/\$5C/gs; # Sometimes backslash is quoted with a
# backslash; convert to hex.
$body =~ s/\\\)/\$29/gs; # close-paren is quoted with a backslash;
# convert to hex.
$body =~ s/\\\n//gs; # backslash at end of line is continuation.

I have a clear understanding of this part
$body =~ s/\r\n/\n/gs; # Windows Mozilla uses \r\n
$body =~ s/\r/\n/gs; # Presumably Mac Mozilla is similarly dumb

However, I don't understand this part.
$body =~ s/\\\\/\$5C/gs; # Sometimes backslash is quoted with a
# backslash; convert to hex.
$body =~ s/\\\)/\$29/gs; # close-paren is quoted with a backslash;
# convert to hex.
$body =~ s/\\\n//gs; # backslash at end of line is continuation.

Let's see if I can break this down.
1)I really don't see when a backslash can be quoted as a backslash
(presum. in URL)
2)I see even less when there can be a close-paren with backslash.

Maybe if I understood this, I could maybe understand why it has to be
converted to hex.

Chad
 
J

John Bokma

grocery_stocker said:
Let's see if I can break this down.
1)I really don't see when a backslash can be quoted as a backslash
(presum. in URL)
2)I see even less when there can be a close-paren with backslash.

Maybe if I understood this, I could maybe understand why it has to be
converted to hex.

If you read the rest of jwz's comments you should have learned fast enough
that MORK is the biggest POS file format you'll probably every encounter
in your life.

Let's hope it will be dropped with Firefox 3.0 (If it hasn't been already)
 
G

grocery_stocker

John said:
If you read the rest of jwz's comments you should have learned fast enough
that MORK is the biggest POS file format you'll probably every encounter
in your life.

Let's hope it will be dropped with Firefox 3.0 (If it hasn't been already)

For whatever reasons, I thought I was somehow missing some strange and
funky CS concept. After following and reading the URLs in the source
code, I realized that those lines were meant to deal with MORK itself.

Chad
 
J

John Bokma

grocery_stocker said:
For whatever reasons, I thought I was somehow missing some strange and
funky CS concept. After following and reading the URLs in the source
code, I realized that those lines were meant to deal with MORK itself.

Yup, kudos to jwz for his script. I once tried to decode the format
myself, and while looking for a specification I found the script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top