[debugger] Add ability to assign to registers
[parrot.git] / config / init / hints.pm
blobd230090c44ec46165073e728d1c10f451e9ef1f4
1 # Copyright (C) 2001-2003, Parrot Foundation.
2 # $Id$
4 =head1 NAME
6 config/init/hints.pm - Platform Hints
8 =head1 DESCRIPTION
10 Loads the platform and local hints files, modifying the defaults set up in
11 F<config/init/default.pm>.
13 =cut
15 package init::hints;
17 use strict;
18 use warnings;
20 use File::Spec::Functions qw/catfile/;
21 use base qw(Parrot::Configure::Step);
23 sub _init {
24 my $self = shift;
25 my %data;
26 $data{description} = q{Load platform and local hints files};
27 $data{result} = q{};
28 return \%data;
31 sub runstep {
32 my ( $self, $conf ) = @_;
34 my $verbose = $conf->options->get('verbose');
35 print "\n[ " if $verbose;
37 my $hints_used = 0;
39 my $osname = lc( $conf->data->get_p5('OSNAME') );
40 $osname = 'linux' if ($osname eq 'gnukfreebsd');
41 my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
42 if ( -f $hints_file ) {
43 my $hints_pkg = "init::hints::" . $osname;
45 print "$hints_pkg " if $verbose;
47 eval "use $hints_pkg";
48 die $@ if $@;
50 # Call the runstep method if it exists.
51 # Otherwise the step must have done its work when it was loaded.
52 $hints_pkg->runstep( $conf, @_ ) if $hints_pkg->can('runstep');
53 $hints_used++;
55 $hints_pkg = "init::hints::local";
56 print "$hints_pkg " if $verbose;
57 eval "use $hints_pkg";
59 unless ($@) {
60 $hints_pkg->runstep( $conf, @_ ) if $hints_pkg->can('runstep');
61 $hints_used++;
64 else {
65 print "No $hints_file found. " if $verbose;
68 if ( $hints_used == 0 and $verbose ) {
69 print "(no hints) ";
72 print "]" if $verbose;
74 return 1;
79 # Local Variables:
80 # mode: cperl
81 # cperl-indent-level: 4
82 # fill-column: 100
83 # End:
84 # vim: expandtab shiftwidth=4: