in reply to Mouse action using SVG

What's the relation to Perl?

Please show some code and context, this sounds rather like browser and JS related.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Mouse action using SVG
by Ezhil4663 (Novice) on Jul 29, 2016 at 21:29 UTC

    Here is the perl script to draw rectangle using SVG module. In which, I would like to have mouse interactivity. The module supports mouse actions but I am not clear about how to use it.

    $svg->rectangle( x =>$x1, y =>$y1, width => $x2, height => $y2, style => { 'fill' => 'rgb(0, 0, 128)', 'stroke' => 'black', 'stroke-width' => 1, 'stroke-opacity' => 1, 'fill-opacity' => 1, }, );
      >  The module supports mouse actions but I am not clear about how to use it.

      Would you mind to specify "the module" or maybe even link to it?

      There are several SVG modules on cpan,   but I am not clear about it.

      See How (Not) To Ask A Question for further ideas.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        It doesn't seem to work for me. I want to show the message which is stored in $message when I click the rectangle. I modified the code this way.
        $svg->rectangle( x =>$x1, y =>$y1, width => $x2, height => $y2, style => { 'fill' => 'rgb(0, 0, 128)', 'stroke' => 'black', 'stroke-width' => 1, 'stroke-opacity' => 1, 'fill-opacity' => 1, }, ); $rectangle->attrib(onclick=>q{alert($message);});
        Please correct me if I am wrong