Re: Perl CGI-html quotation marks

2014-07-04 Thread James Kerwin
Hello again,

Apologies for the delay. I shut my laptop in frustration for the night
yesterday.

Here is a chunk of the code:

my $html2 = '/Results.tar.gz
div style=text-align: center;button type=submitDownload
Files/button/div
p style=text-align: center;Click the button below to View your
alignment in JBrowse Viewer/p
input type=button value=Open Window
onclick=window.open(\'
bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
';


my $html4 =
'/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
  /body
/html';

print $html1;
print $directory;
print $html3;
print $directory;
print $html2;
print $directory;
print $html4;

Another person in my group had a look at it today and let me know that I
hadn't closed the button THING with a . Apparently with that it's able
to handle the single quotation marks.

What a fool!

Thanks,
James.


On Thu, Jul 3, 2014 at 5:23 PM, Uri Guttman u...@stemsystems.com wrote:

 On 07/03/2014 12:16 PM, James Kerwin wrote:

 Hello all,

 I'm currently using Perl CGI to generate a Results webpage. This
 results webpage specifies unique directories generated within the script
 and print these in between the blocks of html so various download and
 display buttons work.

 My problem is that I'm using a button to open a file in a new tab and
 the new tab URL uses single quotes and won't work using double or none.
 This then messes up the printing of the html in the Perl script.

 Can anybody help me? (Example provided below).

   input type=button value=Open Window
 onclick=window.open('THE URL OF THE FILE I WANT TO OPEN IN A NEW TAB
 UPON CLICKING THE BUTTON')


 it would be most helpful if you posted your relevant perl code. if you say
 it messes up printing html i sense you are not creating your html strings
 in the best way.

 uri


 --
 Uri Guttman - The Perl Hunter
 The Best Perl Jobs, The Best Perl Hackers
 http://PerlHunter.com

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: Perl CGI-html quotation marks

2014-07-04 Thread Sam

On 07/04/2014 12:41 AM, Shaji Kalidasan wrote:

Here's one way to do it

print  BUTTON;
input type=button value=Open Window
onclick=window.open('http://www.example.com')
BUTTON



or:

print qq{input type=button value=Open Window
 onclick=window.open('http://www.example.com')};



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread Uri Guttman

On 07/04/2014 07:18 AM, James Kerwin wrote:

Hello again,

Apologies for the delay. I shut my laptop in frustration for the night
yesterday.

Here is a chunk of the code:

my $html2 = '/Results.tar.gz
div style=text-align: center;button type=submitDownload
Files/button/div
p style=text-align: center;Click the button below to View your
alignment in JBrowse Viewer/p
input type=button value=Open Window
onclick=window.open(\'bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
http://bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles';


my $html4 =
'/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
   /body
/html';

print $html1;
print $directory;
print $html3;
print $directory;
print $html2;
print $directory;
print $html4;

Another person in my group had a look at it today and let me know that I
hadn't closed the button THING with a . Apparently with that it's
able to handle the single quotation marks.



regardless of the html error you must do a better job with your strings. 
don't use single quotes when you have single quotes in the string. use a 
here document (someone posted that for you) or an alternate delimiter 
(another post showed that). that way you don't need to escape your 
internal quote chars and you can see the text better and find any 
missing angles and such.


also you can print all those in one print call. just pass the variables 
in a list to print. no need to print one at a time.


uri


--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread Shlomi Fish
Hi all,

thanks for helping James (= the original poster).

On Fri, 04 Jul 2014 11:56:05 -0400
Uri Guttman u...@stemsystems.com wrote:

 On 07/04/2014 07:18 AM, James Kerwin wrote:
  Hello again,
 
  Apologies for the delay. I shut my laptop in frustration for the night
  yesterday.
 
  Here is a chunk of the code:
 
  my $html2 = '/Results.tar.gz
  div style=text-align: center;button type=submitDownload
  Files/button/div
  p style=text-align: center;Click the button below to View your
  alignment in JBrowse Viewer/p
  input type=button value=Open Window
  onclick=window.open(\'bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles
  http://bioinf6.bioc.le.ac.uk/~srpgrp3/JBrowse-1.11.4/index.html?data=http://bioinf6.bioc.le.ac.uk/~srpgrp3/UserFiles';
 
 
  my $html4 =
  '/datatracks=DNA,transcript_with_no_features,Geneshighlight=\')
 /body
  /html';
 
  print $html1;
  print $directory;
  print $html3;
  print $directory;
  print $html2;
  print $directory;
  print $html4;
 
  Another person in my group had a look at it today and let me know that I
  hadn't closed the button THING with a . Apparently with that it's
  able to handle the single quotation marks.
 
 
 regardless of the html error you must do a better job with your strings. 
 don't use single quotes when you have single quotes in the string. use a 
 here document (someone posted that for you) or an alternate delimiter 
 (another post showed that). that way you don't need to escape your 
 internal quote chars and you can see the text better and find any 
 missing angles and such.
 

Indeed. One should note that Perl 5 has very good quoting support with its
here-documents, interpolation, variable delimiters, and also - templating
systems such as Template Toolkit. There's a thread about it on Sayeret Lambda (=
an Israeli forum of programming languages’ enthusiasts):

* https://groups.google.com/forum/#!topic/sayeret-lambda/oTdS8d0hqoE

It sparked an active discussion there.

When doing Perl, one should make a wise use of all that.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

What does “IDK” stand for? I don’t know.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/