RE: perl module problem
[email protected] ("Moon, John") Fri, 16 Aug 2002 09:12:41 -0400
| Newsgroups | perl.javascript |
|---|---|
| Message-ID | <870A2C59C4C884418DD7EB4B9306124F03231CEA@dmssem01.dms.state.fl.us> |
Thanks to all ... jwm -----Original Message----- From: David Gray [mailto:[email protected]] Sent: August 16, 2002 09:08 To: 'Moon, John' Cc: [email protected] Subject: RE: perl module problem > A perl-javascript question (?) :) > > I sometime code javascript in my scripts like: > > my $script=<<EOS; > function foo { > alert('message from foo\\n'); > } > EOS > > then do : > > print $q->start_html(-script=>'$script'); > > But this requires the "escapes" have to be "escaped" ... Does > anyone have an alternative... IS there a "switch" in perl to > "handle" this ? You could do: my $script =<<'EOS'; function foo { alert('message from foo\n'); } EOS Which forces the 'here document' to be a single-quoted string. The downside of this is that it is a single-quoted string, so you can't interpolate variables, which sort of defeats the purpose of writing out javascript from perl to begin with. HTH, -dave