Forum archive 2000-2006

Stephen Corwin - PSOD on moveTo(), lineTo()

Stephen Corwin - PSOD on moveTo(), lineTo()

by Arnold Pizer -
Number of replies: 0
inactiveTopicPSOD on moveTo(), lineTo() topic started 7/15/2005; 1:33:28 AM
last post 7/15/2005; 1:23:32 PM
userStephen Corwin - PSOD on moveTo(), lineTo()  blueArrow
7/15/2005; 1:33:28 AM (reads: 911, responses: 2)
Hi--

I'm fairly new at this; I hope this hasn't been answered a hundred times. Why do I get a pink screen from the code below, which just draws a line from (2,2) to (2,4)? The graph displays correctly, but I get a pink screen and the error message at the bottom of this post. Thanks in advance for any help,

Steve

#######################################

DOCUMENT();

loadMacros(PG.pl,
PGbasicmacros.pl,
PGchoicemacros.pl,
PGanswermacros.pl,
PGauxiliaryFunctions.pl,
PGgraphmacros.pl);

$showPartialCorrectAnswers = 0;

# make a 'canvas' on which to draw
$g = init_graph(0,0,10,10);

# draw a line

$g->moveTo(2,2);
$g->lineTo(2,4);

TEXT(image(insertGraph($g), width => 400, height => 400, tex_size => 800));

BEGIN_TEXT
$BR
Is this really going to work? {ans_rule(5)}
$BR
END_TEXT

ANS(str_cmp("Yes"));

ENDDOCUMENT();

#######################################

The error message:

* Use of uninitialized value in pattern match (m//) at
/home/webwork2/webwork/system_1.9_05/courseScripts//WWPlot.pm line 369.
##More details:
-------- WWPlot::lineTo called at (eval 57) line 17
---- Safe::Root2::__ANON__ called at
/home/webwork2/local/lib/perl5/5.6.1/sun4-solaris/Safe.pm line 222 ---- Safe::reval called at
/home/webwork2/webwork/system_1.9_05/courseScripts//WeBWorK/PG/Translator.pm line 858
---- WeBWorK::PG::Translator::translate called at
/home/webwork2/webwork/system_1.9_05/cgi/cgi-scripts/processProblem8.pl line 466

<| Post or View Comments |>


userMichael Gage - Re: PSOD on moveTo(), lineTo()  blueArrow
7/15/2005; 7:17:05 AM (reads: 1158, responses: 0)
Hi Steve,

lineTo requires a color:

 

 moveTo, lineTo
$graph->moveTo($x,$y);
$graph->lineTo($x,$y,$color);



Moves to the point ($x, $y) (defined in real world coordinates) or
draws a line from the current position to the specified point ($x,
$y) using the color $color. $color is the name, e.g. 'white', of the
color, not an index value or RGB specification. These are low level
call back routines used by the function, label and stamp objects to
draw themselves.

While this is a low level command, it would still be helpful if the error message was more enlightening. :-) I'll add it to the bug list. Thanks for pointing it out.

-- Mike

<| Post or View Comments |>


userStephen Corwin - Re: PSOD on moveTo(), lineTo()  blueArrow
7/15/2005; 1:23:32 PM (reads: 1171, responses: 0)
Thanks!

<| Post or View Comments |>