| File: | lib/Parrot/Configure/Messages.pm |
| Coverage: | 97.5% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2011, Parrot Foundation. | ||||
| 2 | |||||
| 3 | package Parrot::Configure::Messages; | ||||
| 4 | |||||
| 5 | 2 2 2 | use strict; | |||
| 6 | 2 2 2 | use warnings; | |||
| 7 | 2 2 2 | use base qw( Exporter ); | |||
| 8 | our @EXPORT_OK = qw( | ||||
| 9 | print_introduction | ||||
| 10 | print_conclusion | ||||
| 11 | ); | ||||
| 12 | |||||
| 13 | ################### SUBROUTINES ################### | ||||
| 14 | |||||
| 15 | sub print_introduction { | ||||
| 16 | 2 | my $parrot_version = shift; | |||
| 17 | 2 | print <<"END"; | |||
| 18 | Parrot Version $parrot_version Configure 2.0 | ||||
| 19 | Copyright (C) 2001-2011, Parrot Foundation. | ||||
| 20 | |||||
| 21 | Hello, I'm Configure. My job is to poke and prod your system to figure out | ||||
| 22 | how to build Parrot. The process is completely automated, unless you passed in | ||||
| 23 | the `--ask' flag on the command line, in which case I'll prompt you for a few | ||||
| 24 | pieces of info. | ||||
| 25 | |||||
| 26 | Since you're running this program, you obviously have Perl 5--I'll be pulling | ||||
| 27 | some defaults from its configuration. | ||||
| 28 | END | ||||
| 29 | 2 | return 1; | |||
| 30 | } | ||||
| 31 | |||||
| 32 | sub print_conclusion { | ||||
| 33 | 4 | my ($conf, $make, $args) = @_; | |||
| 34 | 4 4 | my @failed_steps = @{ $conf->{log} }; | |||
| 35 | 4 | my @logged_failed_steps = (); | |||
| 36 | 4 | for (my $i = 1; $i <= $#failed_steps; $i++) { | |||
| 37 | 1 | if ( defined $failed_steps[$i] ) { | |||
| 38 | 1 | push @logged_failed_steps, [ $i, $conf->{log}->[$i] ]; | |||
| 39 | } | ||||
| 40 | } | ||||
| 41 | 4 | if ( scalar ( @logged_failed_steps ) ) { | |||
| 42 | 1 | print STDERR "\nDuring configuration the following steps failed:\n"; | |||
| 43 | 1 | foreach my $fail (@logged_failed_steps) { | |||
| 44 | 1 | my $msg = sprintf " %02d: %s\n", ( | |||
| 45 | $fail->[0], | ||||
| 46 | $fail->[1]->{step}, | ||||
| 47 | ); | ||||
| 48 | 1 | print STDERR $msg; | |||
| 49 | } | ||||
| 50 | 1 | print STDERR "You should diagnose and fix these errors before calling '$make'\n"; | |||
| 51 | 1 | return; | |||
| 52 | } | ||||
| 53 | else { | ||||
| 54 | 3 | unless ( $args->{silent} ) { | |||
| 55 | 2 | print <<"END"; | |||
| 56 | |||||
| 57 | Okay, we're done! | ||||
| 58 | |||||
| 59 | You can now use `$make' to build your Parrot. | ||||
| 60 | After that, you can use `$make test' to run the test suite. | ||||
| 61 | |||||
| 62 | Happy Hacking, | ||||
| 63 | The Parrot Team | ||||
| 64 | |||||
| 65 | END | ||||
| 66 | } | ||||
| 67 | 3 | return 1; | |||
| 68 | } | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | 1; | ||||
| 72 | |||||
| 73 | #################### DOCUMENTATION #################### | ||||
| 74 | |||||
| 75 - 153 | =head1 NAME
Parrot::Configure::Messages - Introduce and conclude Parrot configuration process
=head1 SYNOPSIS
use Parrot::Configure::Messages qw(
print_introduction
print_conclusion
);
print_introduction($parrot_version);
$rv = print_conclusion( $conf, $make, $args );
=head1 DESCRIPTION
Parrot::Configure::Messages exports on demand two subroutines which print
messages to STDOUT when F<Configure.pl> is run.
=head1 SUBROUTINES
=head2 C<print_introduction()>
=over 4
=item * Purpose
Print the Parrot version, the version of F<Configure.pl>, the copyright notice
and a message introducing the Parrot configuration process.
=item * Arguments
One argument: String holding the Parrot version number (currently supplied by
C<Parrot::BuildUtil::parrot_version()>).
=item * Return Value
Implicit true value when C<print> returns successfully.
=item * Comment
=back
=head2 C<print_conclusion()>
=over 4
=item * Purpose
Prints a message announcing the conclusion of the Parrot configuration process
and instructing the user to run F<make>.
=item * Arguments
$rv = print_conclusion( $conf, $make, $args );
List of three arguments: the Parrot::Configure object; the string holding the
version of F<make> located by the configuration process; and the hash
reference which is the first element in the list returned by
C<Parrot::Configure::Options::process_options()>.
=item * Return Value
Returns true value when configuration is successful and message has been
printed. Otherwise return value is undefined.
=back
=head1 NOTES
The functionality in this package was transferred from F<Configure.pl> by Jim
Keenan.
=head1 SEE ALSO
F<Configure.pl>.
=cut | ||||
| 154 | |||||
| 155 | # Local Variables: | ||||
| 156 | # mode: cperl | ||||
| 157 | # cperl-indent-level: 4 | ||||
| 158 | # fill-column: 100 | ||||
| 159 | # End: | ||||
| 160 | # vim: expandtab shiftwidth=4: | ||||