l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2001 Dec 30 16:53

The following is an archive of a post made to our 'vox mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox] E-mail addresses munged on members page
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox] E-mail addresses munged on members page



> I'm not gonna even go in to the fun that can be had with javascript ;)

Ok, I lied, I needed this for somthing else anyway.
I whiped up a quick perl script that escpaes STDIN
then slaps it into document.write commands.

---- begin ----

#!/usr/bin/perl
################################################################
##                                                            ##
# # This is a simple script to take STDIN and quote + escape  ##
##  it into JavaScript document.write commands while keeping  ##
##  things somewhat clean.                                    ##
##                                                            ##
################################################################
@lines = <STDIN>;                          # Couldn't figure out
                                           # how to imply this
foreach $line (@lines)                     # Process each line
{
  $line =~ s/\t/\\\t/g;                    # Escape tabs
  $line =~ s/\"/\\\"/g;                    # Escape double quotes
  $line =~ s/\'/\\\'/g;                    # Escape single quotes
  $line =~ s/\n/\\n/g;                     # Escape newlines
  print "document.write('$line');\n";      # OUTPUT!!!!!!!
}

---- end ----

If you save the output of this, you can have whatever the input was inserted 
into a html document by the user's browser with no more then a

<script language="javascript" src="whereyousavedtheoutput"></script>

in the html document. See it a work at http://mother.com/~ryan/search.html 
this is called by my custom slashbox at slashdot.org to overcome a limit on 
the amount of code.

Note that I didn't know any perl when I started writing this script.
--
Ryan 

Attachment: js-docwrite.pl
Description: Perl program



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.