This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlrecharclass.pod: Add caveat about multi-char sequences
[perl5.git] / lib / diagnostics.pm
CommitLineData
4633a7c4 1package diagnostics;
4633a7c4
LW
2
3=head1 NAME
4
c7bcd97d 5diagnostics, splain - produce verbose warning diagnostics
4633a7c4
LW
6
7=head1 SYNOPSIS
8
c7bcd97d 9Using the C<diagnostics> pragma:
4633a7c4
LW
10
11 use diagnostics;
12 use diagnostics -verbose;
13
14 enable diagnostics;
15 disable diagnostics;
16
c7bcd97d 17Using the C<splain> standalone filter program:
4633a7c4
LW
18
19 perl program 2>diag.out
20 splain [-v] [-p] diag.out
21
58618f23
FD
22Using diagnostics to get stack traces from a misbehaving script:
23
24 perl -Mdiagnostics=-traceonly my_script.pl
25
4633a7c4
LW
26=head1 DESCRIPTION
27
28=head2 The C<diagnostics> Pragma
29
30This module extends the terse diagnostics normally emitted by both the
c411974d
SP
31perl compiler and the perl interpreter (from running perl with a -w
32switch or C<use warnings>), augmenting them with the more
4633a7c4 33explicative and endearing descriptions found in L<perldiag>. Like the
1fef88e7 34other pragmata, it affects the compilation phase of your program rather
4633a7c4
LW
35than merely the execution phase.
36
37To use in your program as a pragma, merely invoke
38
39 use diagnostics;
40
41at the start (or near the start) of your program. (Note
42that this I<does> enable perl's B<-w> flag.) Your whole
43compilation will then be subject(ed :-) to the enhanced diagnostics.
44These still go out B<STDERR>.
45
ae2c041d 46Due to the interaction between runtime and compiletime issues,
4633a7c4 47and because it's probably not a very good idea anyway,
ae2c041d 48you may not use C<no diagnostics> to turn them off at compiletime.
3d0ae7ba 49However, you may control their behaviour at runtime using the
4633a7c4
LW
50disable() and enable() methods to turn them off and on respectively.
51
52The B<-verbose> flag first prints out the L<perldiag> introduction before
1fef88e7
JM
53any other diagnostics. The $diagnostics::PRETTY variable can generate nicer
54escape sequences for pagers.
4633a7c4 55
097b73fc
BB
56Warnings dispatched from perl itself (or more accurately, those that match
57descriptions found in L<perldiag>) are only displayed once (no duplicate
49704364 58descriptions). User code generated warnings a la warn() are unaffected,
097b73fc
BB
59allowing duplicate user messages to be displayed.
60
58618f23
FD
61This module also adds a stack trace to the error message when perl dies.
62This is useful for pinpointing what caused the death. The B<-traceonly> (or
3c4b39be 63just B<-t>) flag turns off the explanations of warning messages leaving just
58618f23
FD
64the stack traces. So if your script is dieing, run it again with
65
66 perl -Mdiagnostics=-traceonly my_bad_script
67
68to see the call stack at the time of death. By supplying the B<-warntrace>
69(or just B<-w>) flag, any warnings emitted will also come with a stack
70trace.
71
4633a7c4
LW
72=head2 The I<splain> Program
73
74While apparently a whole nuther program, I<splain> is actually nothing
75more than a link to the (executable) F<diagnostics.pm> module, as well as
76a link to the F<diagnostics.pod> documentation. The B<-v> flag is like
77the C<use diagnostics -verbose> directive.
78The B<-p> flag is like the
79$diagnostics::PRETTY variable. Since you're post-processing with
80I<splain>, there's no sense in being able to enable() or disable() processing.
81
82Output from I<splain> is directed to B<STDOUT>, unlike the pragma.
83
84=head1 EXAMPLES
85
86The following file is certain to trigger a few errors at both
ae2c041d 87runtime and compiletime:
4633a7c4
LW
88
89 use diagnostics;
90 print NOWHERE "nothing\n";
91 print STDERR "\n\tThis message should be unadorned.\n";
92 warn "\tThis is a user warning";
93 print "\nDIAGNOSTIC TESTER: Please enter a <CR> here: ";
94 my $a, $b = scalar <STDIN>;
95 print "\n";
96 print $x/$y;
97
98If you prefer to run your program first and look at its problem
99afterwards, do this:
100
101 perl -w test.pl 2>test.out
102 ./splain < test.out
103
104Note that this is not in general possible in shells of more dubious heritage,
1fef88e7 105as the theoretical
4633a7c4
LW
106
107 (perl -w test.pl >/dev/tty) >& test.out
108 ./splain < test.out
109
110Because you just moved the existing B<stdout> to somewhere else.
111
112If you don't want to modify your source code, but still have on-the-fly
113warnings, do this:
114
115 exec 3>&1; perl -w test.pl 2>&1 1>&3 3>&- | splain 1>&2 3>&-
116
117Nifty, eh?
118
119If you want to control warnings on the fly, do something like this.
120Make sure you do the C<use> first, or you won't be able to get
121at the enable() or disable() methods.
122
123 use diagnostics; # checks entire compilation phase
124 print "\ntime for 1st bogus diags: SQUAWKINGS\n";
125 print BOGUS1 'nada';
126 print "done with 1st bogus\n";
127
128 disable diagnostics; # only turns off runtime warnings
129 print "\ntime for 2nd bogus: (squelched)\n";
130 print BOGUS2 'nada';
131 print "done with 2nd bogus\n";
132
133 enable diagnostics; # turns back on runtime warnings
134 print "\ntime for 3rd bogus: SQUAWKINGS\n";
135 print BOGUS3 'nada';
136 print "done with 3rd bogus\n";
137
138 disable diagnostics;
139 print "\ntime for 4th bogus: (squelched)\n";
140 print BOGUS4 'nada';
141 print "done with 4th bogus\n";
142
143=head1 INTERNALS
144
145Diagnostic messages derive from the F<perldiag.pod> file when available at
146runtime. Otherwise, they may be embedded in the file itself when the
147splain package is built. See the F<Makefile> for details.
148
149If an extant $SIG{__WARN__} handler is discovered, it will continue
1fef88e7 150to be honored, but only after the diagnostics::splainthis() function
4633a7c4
LW
151(the module's $SIG{__WARN__} interceptor) has had its way with your
152warnings.
153
154There is a $diagnostics::DEBUG variable you may set if you're desperately
155curious what sorts of things are being intercepted.
156
157 BEGIN { $diagnostics::DEBUG = 1 }
158
159
160=head1 BUGS
161
162Not being able to say "no diagnostics" is annoying, but may not be
163insurmountable.
164
165The C<-pretty> directive is called too late to affect matters.
864e1151 166You have to do this instead, and I<before> you load the module.
4633a7c4
LW
167
168 BEGIN { $diagnostics::PRETTY = 1 }
169
170I could start up faster by delaying compilation until it should be
a6006777 171needed, but this gets a "panic: top_level" when using the pragma form
172in Perl 5.001e.
4633a7c4
LW
173
174While it's true that this documentation is somewhat subserious, if you use
175a program named I<splain>, you should expect a bit of whimsy.
176
177=head1 AUTHOR
178
352854fa 179Tom Christiansen <F<tchrist@mox.perl.com>>, 25 June 1995.
4633a7c4
LW
180
181=cut
182
7a4340ed 183use strict;
d923656e 184use 5.009001;
5f05dabc 185use Carp;
58618f23 186$Carp::Internal{__PACKAGE__.""}++;
5f05dabc 187
f64e7edf 188our $VERSION = '1.20';
7a4340ed
GS
189our $DEBUG;
190our $VERBOSE;
191our $PRETTY;
58618f23
FD
192our $TRACEONLY = 0;
193our $WARNTRACE = 0;
1e4e2d84 194
5f05dabc 195use Config;
7a4340ed 196my($privlib, $archlib) = @Config{qw(privlibexp archlibexp)};
5f05dabc 197if ($^O eq 'VMS') {
91a06757
CS
198 require VMS::Filespec;
199 $privlib = VMS::Filespec::unixify($privlib);
200 $archlib = VMS::Filespec::unixify($archlib);
5f05dabc 201}
7a4340ed 202my @trypod = (
7ec2cea4 203 "$archlib/pod/perldiag.pod",
0ff3fa1a 204 "$privlib/pod/perldiag-$Config{version}.pod",
5459498c 205 "$privlib/pod/perldiag.pod",
7ec2cea4 206 "$archlib/pods/perldiag.pod",
0ff3fa1a 207 "$privlib/pods/perldiag-$Config{version}.pod",
5459498c 208 "$privlib/pods/perldiag.pod",
7ec2cea4 209 );
fb73857a 210# handy for development testing of new warnings etc
211unshift @trypod, "./pod/perldiag.pod" if -e "pod/perldiag.pod";
7a4340ed 212(my $PODFILE) = ((grep { -e } @trypod), $trypod[$#trypod])[0];
5f05dabc 213
4633a7c4
LW
214$DEBUG ||= 0;
215my $WHOAMI = ref bless []; # nobody's business, prolly not even mine
216
7a4340ed 217local $| = 1;
d923656e 218my $_;
412147f6 219local $.;
4633a7c4 220
7a4340ed
GS
221my $standalone;
222my(%HTML_2_Troff, %HTML_2_Latin_1, %HTML_2_ASCII_7);
223
4633a7c4 224CONFIG: {
7a4340ed 225 our $opt_p = our $opt_d = our $opt_v = our $opt_f = '';
4633a7c4 226
7a4340ed 227 unless (caller) {
4633a7c4
LW
228 $standalone++;
229 require Getopt::Std;
91a06757
CS
230 Getopt::Std::getopts('pdvf:')
231 or die "Usage: $0 [-v] [-p] [-f splainpod]";
4633a7c4
LW
232 $PODFILE = $opt_f if $opt_f;
233 $DEBUG = 2 if $opt_d;
234 $VERBOSE = $opt_v;
235 $PRETTY = $opt_p;
7a4340ed 236 }
4633a7c4
LW
237
238 if (open(POD_DIAG, $PODFILE)) {
239 warn "Happy happy podfile from real $PODFILE\n" if $DEBUG;
240 last CONFIG;
241 }
242
243 if (caller) {
244 INCPATH: {
7a4340ed 245 for my $file ( (map { "$_/$WHOAMI.pm" } @INC), $0) {
4633a7c4
LW
246 warn "Checking $file\n" if $DEBUG;
247 if (open(POD_DIAG, $file)) {
248 while (<POD_DIAG>) {
7a4340ed
GS
249 next unless
250 /^__END__\s*# wish diag dbase were more accessible/;
4633a7c4
LW
251 print STDERR "podfile is $file\n" if $DEBUG;
252 last INCPATH;
253 }
254 }
255 }
256 }
257 } else {
258 print STDERR "podfile is <DATA>\n" if $DEBUG;
259 *POD_DIAG = *main::DATA;
260 }
261}
262if (eof(POD_DIAG)) {
263 die "couldn't find diagnostic data in $PODFILE @INC $0";
264}
265
266
267%HTML_2_Troff = (
268 'amp' => '&', # ampersand
269 'lt' => '<', # left chevron, less-than
270 'gt' => '>', # right chevron, greater-than
271 'quot' => '"', # double quote
272
273 "Aacute" => "A\\*'", # capital A, acute accent
274 # etc
275
276);
277
278%HTML_2_Latin_1 = (
279 'amp' => '&', # ampersand
280 'lt' => '<', # left chevron, less-than
281 'gt' => '>', # right chevron, greater-than
282 'quot' => '"', # double quote
283
284 "Aacute" => "\xC1" # capital A, acute accent
285
286 # etc
287);
288
289%HTML_2_ASCII_7 = (
290 'amp' => '&', # ampersand
291 'lt' => '<', # left chevron, less-than
292 'gt' => '>', # right chevron, greater-than
293 'quot' => '"', # double quote
294
295 "Aacute" => "A" # capital A, acute accent
296 # etc
297);
298
7a4340ed 299our %HTML_Escapes;
4633a7c4
LW
300*HTML_Escapes = do {
301 if ($standalone) {
302 $PRETTY ? \%HTML_2_Latin_1 : \%HTML_2_ASCII_7;
303 } else {
304 \%HTML_2_Latin_1;
305 }
306};
307
308*THITHER = $standalone ? *STDOUT : *STDERR;
309
49704364 310my %transfmt = ();
7a4340ed 311my $transmo = <<EOFUNC;
4633a7c4 312sub transmo {
599cee73 313 #local \$^W = 0; # recursive warnings we do NOT need!
4633a7c4
LW
314 study;
315EOFUNC
316
7a4340ed
GS
317my %msg;
318{
4633a7c4 319 print STDERR "FINISHING COMPILATION for $_\n" if $DEBUG;
7a4340ed 320 local $/ = '';
7a4340ed
GS
321 my $header;
322 my $for_item;
4633a7c4 323 while (<POD_DIAG>) {
4633a7c4
LW
324
325 unescape();
326 if ($PRETTY) {
327 sub noop { return $_[0] } # spensive for a noop
328 sub bold { my $str =$_[0]; $str =~ s/(.)/$1\b$1/g; return $str; }
329 sub italic { my $str = $_[0]; $str =~ s/(.)/_\b$1/g; return $str; }
67612b68 330 s/C<<< (.*?) >>>|C<< (.*?) >>|[BC]<(.*?)>/bold($+)/ges;
4633a7c4
LW
331 s/[LIF]<(.*?)>/italic($1)/ges;
332 } else {
67612b68 333 s/C<<< (.*?) >>>|C<< (.*?) >>|[BC]<(.*?)>/$+/gs;
4633a7c4
LW
334 s/[LIF]<(.*?)>/$1/gs;
335 }
336 unless (/^=/) {
337 if (defined $header) {
338 if ( $header eq 'DESCRIPTION' &&
339 ( /Optional warnings are enabled/
340 || /Some of these messages are generic./
341 ) )
342 {
343 next;
49704364 344 }
4633a7c4
LW
345 s/^/ /gm;
346 $msg{$header} .= $_;
7a4340ed 347 undef $for_item;
4633a7c4
LW
348 }
349 next;
350 }
7a4340ed 351 unless ( s/=item (.*?)\s*\z//) {
4633a7c4
LW
352
353 if ( s/=head1\sDESCRIPTION//) {
354 $msg{$header = 'DESCRIPTION'} = '';
7a4340ed 355 undef $for_item;
4633a7c4 356 }
7a4340ed
GS
357 elsif( s/^=for\s+diagnostics\s*\n(.*?)\s*\z// ) {
358 $for_item = $1;
359 }
4633a7c4
LW
360 next;
361 }
4fdae800 362
5cd5c422
RB
363 if( $for_item ) { $header = $for_item; undef $for_item }
364 else {
365 $header = $1;
366 while( $header =~ /[;,]\z/ ) {
367 <POD_DIAG> =~ /^\s*(.*?)\s*\z/;
368 $header .= ' '.$1;
369 }
370 }
371
49704364 372 # strip formatting directives from =item line
7a4340ed 373 $header =~ s/[A-Z]<(.*?)>/$1/g;
4633a7c4 374
8b56d6ff 375 my @toks = split( /(%l?[dx]|%c|%(?:\.\d+)?[fs])/, $header );
49704364
WL
376 if (@toks > 1) {
377 my $conlen = 0;
378 for my $i (0..$#toks){
379 if( $i % 2 ){
380 if( $toks[$i] eq '%c' ){
381 $toks[$i] = '.';
382 } elsif( $toks[$i] eq '%d' ){
383 $toks[$i] = '\d+';
8b56d6ff 384 } elsif( $toks[$i] =~ '^%(?:s|.*f)$' ){
49704364
WL
385 $toks[$i] = $i == $#toks ? '.*' : '.*?';
386 } elsif( $toks[$i] =~ '%.(\d+)s' ){
387 $toks[$i] = ".{$1}";
388 } elsif( $toks[$i] =~ '^%l*x$' ){
389 $toks[$i] = '[\da-f]+';
390 }
391 } elsif( length( $toks[$i] ) ){
8ec7363a 392 $toks[$i] = quotemeta $toks[$i];
49704364
WL
393 $conlen += length( $toks[$i] );
394 }
395 }
396 my $lhs = join( '', @toks );
397 $transfmt{$header}{pat} =
398 " s{^$lhs}\n {\Q$header\E}s\n\t&& return 1;\n";
399 $transfmt{$header}{len} = $conlen;
4633a7c4 400 } else {
49704364
WL
401 $transfmt{$header}{pat} =
402 " m{^\Q$header\E} && return 1;\n";
403 $transfmt{$header}{len} = length( $header );
4633a7c4
LW
404 }
405
eff9c6e2
CS
406 print STDERR "$WHOAMI: Duplicate entry: \"$header\"\n"
407 if $msg{$header};
4633a7c4
LW
408
409 $msg{$header} = '';
410 }
411
412
413 close POD_DIAG unless *main::DATA eq *POD_DIAG;
414
415 die "No diagnostics?" unless %msg;
416
49704364
WL
417 # Apply patterns in order of decreasing sum of lengths of fixed parts
418 # Seems the best way of hitting the right one.
419 for my $hdr ( sort { $transfmt{$b}{len} <=> $transfmt{$a}{len} }
420 keys %transfmt ){
421 $transmo .= $transfmt{$hdr}{pat};
422 }
4633a7c4
LW
423 $transmo .= " return 0;\n}\n";
424 print STDERR $transmo if $DEBUG;
425 eval $transmo;
426 die $@ if $@;
7a4340ed 427}
4633a7c4
LW
428
429if ($standalone) {
430 if (!@ARGV and -t STDIN) { print STDERR "$0: Reading from STDIN\n" }
7a4340ed 431 while (defined (my $error = <>)) {
4633a7c4
LW
432 splainthis($error) || print THITHER $error;
433 }
434 exit;
7a4340ed
GS
435}
436
437my $olddie;
438my $oldwarn;
4633a7c4
LW
439
440sub import {
441 shift;
7a4340ed
GS
442 $^W = 1; # yup, clobbered the global variable;
443 # tough, if you want diags, you want diags.
0dc02ca5 444 return if defined $SIG{__WARN__} && ($SIG{__WARN__} eq \&warn_trap);
4633a7c4
LW
445
446 for (@_) {
447
448 /^-d(ebug)?$/ && do {
449 $DEBUG++;
450 next;
451 };
452
453 /^-v(erbose)?$/ && do {
454 $VERBOSE++;
455 next;
456 };
457
458 /^-p(retty)?$/ && do {
459 print STDERR "$0: I'm afraid it's too late for prettiness.\n";
460 $PRETTY++;
461 next;
462 };
b4e8c6dd
FD
463 # matches trace and traceonly for legacy doc mixup reasons
464 /^-t(race(only)?)?$/ && do {
58618f23
FD
465 $TRACEONLY++;
466 next;
467 };
b4e8c6dd 468 /^-w(arntrace)?$/ && do {
58618f23
FD
469 $WARNTRACE++;
470 next;
471 };
472
4633a7c4
LW
473 warn "Unknown flag: $_";
474 }
475
476 $oldwarn = $SIG{__WARN__};
477 $olddie = $SIG{__DIE__};
478 $SIG{__WARN__} = \&warn_trap;
479 $SIG{__DIE__} = \&death_trap;
480}
481
482sub enable { &import }
483
484sub disable {
485 shift;
4633a7c4 486 return unless $SIG{__WARN__} eq \&warn_trap;
3d0ae7ba
GS
487 $SIG{__WARN__} = $oldwarn || '';
488 $SIG{__DIE__} = $olddie || '';
4633a7c4
LW
489}
490
491sub warn_trap {
492 my $warning = $_[0];
493 if (caller eq $WHOAMI or !splainthis($warning)) {
58618f23
FD
494 if ($WARNTRACE) {
495 print STDERR Carp::longmess($warning);
496 } else {
497 print STDERR $warning;
498 }
4633a7c4 499 }
58618f23 500 goto &$oldwarn if defined $oldwarn and $oldwarn and $oldwarn ne \&warn_trap;
4633a7c4
LW
501};
502
503sub death_trap {
504 my $exception = $_[0];
55497cff 505
506 # See if we are coming from anywhere within an eval. If so we don't
507 # want to explain the exception because it's going to get caught.
508 my $in_eval = 0;
509 my $i = 0;
58618f23 510 while (my $caller = (caller($i++))[3]) {
55497cff 511 if ($caller eq '(eval)') {
512 $in_eval = 1;
513 last;
514 }
515 }
516
517 splainthis($exception) unless $in_eval;
4633a7c4 518 if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; }
37120919 519 &$olddie if defined $olddie and $olddie and $olddie ne \&death_trap;
55497cff 520
d23f0205
MS
521 return if $in_eval;
522
55497cff 523 # We don't want to unset these if we're coming from an eval because
d23f0205
MS
524 # then we've turned off diagnostics.
525
526 # Switch off our die/warn handlers so we don't wind up in our own
527 # traps.
528 $SIG{__DIE__} = $SIG{__WARN__} = '';
529
530 # Have carp skip over death_trap() when showing the stack trace.
6f48387a 531 local($Carp::CarpLevel) = 1;
d23f0205 532
6f48387a 533 confess "Uncaught exception from user code:\n\t$exception";
4633a7c4
LW
534 # up we go; where we stop, nobody knows, but i think we die now
535 # but i'm deeply afraid of the &$olddie guy reraising and us getting
536 # into an indirect recursion loop
537};
538
7a4340ed
GS
539my %exact_duplicate;
540my %old_diag;
541my $count;
542my $wantspace;
4633a7c4 543sub splainthis {
58618f23 544 return 0 if $TRACEONLY;
d923656e 545 $_ = shift;
5025c45a 546 local $\;
2a6a970f 547 local $!;
4633a7c4
LW
548 ### &finish_compilation unless %msg;
549 s/\.?\n+$//;
550 my $orig = $_;
551 # return unless defined;
49704364
WL
552
553 # get rid of the where-are-we-in-input part
4633a7c4 554 s/, <.*?> (?:line|chunk).*$//;
49704364
WL
555
556 # Discard 1st " at <file> line <no>" and all text beyond
557 # but be aware of messsages containing " at this-or-that"
558 my $real = 0;
559 my @secs = split( / at / );
18d238e4 560 return unless @secs;
49704364
WL
561 $_ = $secs[0];
562 for my $i ( 1..$#secs ){
563 if( $secs[$i] =~ /.+? (?:line|chunk) \d+/ ){
564 $real = 1;
565 last;
566 } else {
567 $_ .= ' at ' . $secs[$i];
568 }
569 }
570
571 # remove parenthesis occurring at the end of some messages
4633a7c4 572 s/^\((.*)\)$/$1/;
49704364 573
097b73fc
BB
574 if ($exact_duplicate{$orig}++) {
575 return &transmo;
49704364 576 } else {
097b73fc
BB
577 return 0 unless &transmo;
578 }
49704364 579
4633a7c4
LW
580 $orig = shorten($orig);
581 if ($old_diag{$_}) {
582 autodescribe();
583 print THITHER "$orig (#$old_diag{$_})\n";
584 $wantspace = 1;
585 } else {
586 autodescribe();
587 $old_diag{$_} = ++$count;
588 print THITHER "\n" if $wantspace;
589 $wantspace = 0;
590 print THITHER "$orig (#$old_diag{$_})\n";
591 if ($msg{$_}) {
592 print THITHER $msg{$_};
593 } else {
594 if (0 and $standalone) {
595 print THITHER " **** Error #$old_diag{$_} ",
596 ($real ? "is" : "appears to be"),
597 " an unknown diagnostic message.\n\n";
598 }
599 return 0;
600 }
601 }
602 return 1;
603}
604
605sub autodescribe {
606 if ($VERBOSE and not $count) {
607 print THITHER &{$PRETTY ? \&bold : \&noop}("DESCRIPTION OF DIAGNOSTICS"),
608 "\n$msg{DESCRIPTION}\n";
609 }
610}
611
612sub unescape {
613 s {
614 E<
615 ( [A-Za-z]+ )
616 >
617 } {
618 do {
619 exists $HTML_Escapes{$1}
620 ? do { $HTML_Escapes{$1} }
621 : do {
f02a87df 622 warn "Unknown escape: E<$1> in $_";
4633a7c4
LW
623 "E<$1>";
624 }
625 }
626 }egx;
627}
628
629sub shorten {
630 my $line = $_[0];
774d564b 631 if (length($line) > 79 and index($line, "\n") == -1) {
4633a7c4
LW
632 my $space_place = rindex($line, ' ', 79);
633 if ($space_place != -1) {
634 substr($line, $space_place, 1) = "\n\t";
635 }
636 }
637 return $line;
638}
639
640
4633a7c4
LW
6411 unless $standalone; # or it'll complain about itself
642__END__ # wish diag dbase were more accessible