[system] / trunk / pg / lib / PGcore.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/PGcore.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 6850 Revision 6851
166 $self->{PG_original_problem_seed} = $self->{envir}->{problemSeed}; 166 $self->{PG_original_problem_seed} = $self->{envir}->{problemSeed};
167 $self->{PG_random_generator} = new PGrandom( $self->{PG_original_problem_seed}); 167 $self->{PG_random_generator} = new PGrandom( $self->{PG_original_problem_seed});
168 168
169 $self->{tempDirectory} = $self->{envir}->{tempDirectory}; 169 $self->{tempDirectory} = $self->{envir}->{tempDirectory};
170 $self->{PG_problem_grader} = $self->{envir}->{PROBLEM_GRADER_TO_USE}; 170 $self->{PG_problem_grader} = $self->{envir}->{PROBLEM_GRADER_TO_USE};
171 $self->{PG_alias} = new PGalias($self->{envir}); 171 $self->{PG_alias} = PGalias->new($self->{envir});
172 $self->{PG_loadMacros} = new PGloadfiles($self->{envir}); 172 $self->{PG_loadMacros} = new PGloadfiles($self->{envir});
173 $self->{flags} = { 173 $self->{flags} = {
174 showpartialCorrectAnswers => 1, 174 showpartialCorrectAnswers => 1,
175 showHint => 1, 175 showHint => 1,
176 hintExists => 0, 176 hintExists => 0,
578# } else { 578# } else {
579# return $self->($name); #if no parameters just return the value 579# return $self->($name); #if no parameters just return the value
580# } 580# }
581# } 581# }
582 582
583=head2 base64 coding
584
585 $str = decode_base64($coded_str);
586 $coded_str = encode_base64($str);
583 587
584# Sometimes a question author needs to code or decode base64 directly 588# Sometimes a question author needs to code or decode base64 directly
589
590=cut
591
585sub decode_base64 ($) { 592sub decode_base64 ($) {
586 my $self = shift; 593 my $self = shift;
587 my $str = shift; 594 my $str = shift;
588 MIME::Base64::decode_base64($str); 595 MIME::Base64::decode_base64($str);
589} 596}
592 my $self = shift; 599 my $self = shift;
593 my $str = shift; 600 my $str = shift;
594 my $option = shift; 601 my $option = shift;
595 MIME::Base64::encode_base64($str); 602 MIME::Base64::encode_base64($str);
596} 603}
604
605=head2 Message channels
606
607There are three message channels
608 $PG->debug_message() or in PG: DEBUG_MESSAGE()
609 $PG->warning_message() or in PG: WARNING_MESSAGE()
610
611They behave the same way, it is simply convention as to how they are used.
612
613To report the messages use:
614
615 $PG->get_debug_messages
616 $PG->get_warning_messages
617
618These are used in Problem.pm for example to report any errors.
619
620There is also
621
622 $PG->internal_debug_message()
623 $PG->get_internal_debug_message
624 $PG->clear_internal_debug_messages();
625
626There were times when things were buggy enough that only the internal_debug_message which are not saved
627inside the PGcore object would report.
628
629=cut
630
597sub debug_message { 631sub debug_message {
598 my $self = shift; 632 my $self = shift;
599 my @str = @_; 633 my @str = @_;
600 push @{$self->{flags}->{DEBUG_messages}}, @str; 634 push @{$self->{flags}->{DEBUG_messages}}, @str;
601} 635}

Legend:
Removed from v.6850  
changed lines
  Added in v.6851

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9