Browse files

Got rid of strict and warnings in the same line.

Cleaned up the loaded pragmas otherwise.
  • Loading branch information...
1 parent 449b0f8 commit 6f49cae0f4a8fe8150b782c163241dcacc130135 @shlomif committed Oct 31, 2011
View
8 lib/Devel/Trepan/DB/Eval.pm
@@ -1,11 +1,15 @@
# Eval part of Perl's Core DB.pm library and perl5db.pl with modification.
+# TODO : Shouldn't this use lib be removed?
use lib '../..';
package DB;
-use warnings; use strict;
-use English qw( -no_match_vars );
+
+use warnings;
+use strict;
use feature 'switch';
+
+use English qw( -no_match_vars );
use vars qw($eval_result @eval_result %eval_result
$eval_str $eval_opts $event $return_type );
View
6 lib/Devel/Trepan/IO/Input.pm
@@ -5,12 +5,14 @@
# input or GNU Readline.
#
-use warnings; use strict;
+package Devel::Trepan::IO::Input;
+use warnings;
+use strict;
use Exporter;
use Term::ReadLine;
-package Devel::Trepan::IO::Input;
+# TODO : Shouldn't this use lib be removed?
use lib '../../..';
use Devel::Trepan::Util qw(hash_merge);
use Devel::Trepan::IO;
View
5 lib/Devel/Trepan/IO/StringArray.pm
@@ -4,8 +4,11 @@
# Simulate I/O using lists of strings.
package Devel::Trepan::IO::StringArrayInput;
-use warnings; use strict;
+use warnings;
+use strict;
+
+# TODO : Shouldn't this use lib be removed?
use lib '../../..';
use Devel::Trepan::IO;
View
8 lib/Devel/Trepan/Interface/Script.pm
@@ -2,12 +2,16 @@
# Copyright (C) 2011 Rocky Bernstein <rocky@cpan.org>
# Module for reading debugger scripts
+package Devel::Trepan::Interface::Script;
+
+use strict;
+use warnings;
+no warnings 'redefine';
-use warnings; no warnings 'redefine'; use strict;
use Exporter;
use IO::File;
-package Devel::Trepan::Interface::Script;
+# TODO : Shouldn't this use lib be removed?
use lib '../../..';
use Devel::Trepan::Interface;
use Devel::Trepan::IO::Input;
View
9 lib/Devel/Trepan/Interface/User.pm
@@ -3,10 +3,15 @@
# Interface when communicating with the user.
-use warnings; no warnings 'once'; use strict;
+package Devel::Trepan::Interface::User;
+
+use strict;
+use warnings;
+no warnings 'once';
+
use Exporter;
-package Devel::Trepan::Interface::User;
+# TODO : Shouldn't this use lib be removed?
use lib '../../..';
use vars qw(@EXPORT @ISA $HAVE_READLINE);
@ISA = qw(Devel::Trepan::Interface Exporter);
View
8 t/20test-autolist.t
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
-use warnings; use strict;
-use File::Basename; use File::Spec;
+
+use warnings;
+use strict;
+
+use File::Basename;
+use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
use Helper;
View
5 t/20test-break.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Spec;
use File::Basename qw(dirname);
use lib dirname(__FILE__);
View
5 t/20test-display.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Spec;
use File::Basename qw(dirname);
use lib dirname(__FILE__);
View
8 t/20test-eval.t
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
-use warnings; use strict;
-use File::Basename; use File::Spec;
+
+use warnings;
+use strict;
+
+use File::Basename;
+use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
use Helper;
View
5 t/20test-list1.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Basename; use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
View
5 t/20test-list2.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Basename; use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
View
5 t/20test-list3.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Basename; use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
View
5 t/20test-next.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Basename; use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
View
5 t/20test-seq1.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Spec;
use File::Basename qw(dirname);
use lib dirname(__FILE__);
View
8 t/20test-step.t
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
-use warnings; use strict;
-use File::Basename; use File::Spec;
+
+use warnings;
+use strict;
+
+use File::Basename;
+use File::Spec;
use Test::More 'no_plan';
use lib dirname(__FILE__);
use Helper;
View
5 t/20test-trace.t
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
-use warnings; use strict;
+
+use warnings;
+use strict;
+
use File::Spec;
use File::Basename qw(dirname);
use lib dirname(__FILE__);
View
5 t/20test-trepanpl-opts.t
@@ -1,7 +1,10 @@
#!/usr/bin/env perl
+
use strict;
-use warnings; use strict;
+use warnings;
+
use English qw( -no_match_vars );
+
use File::Basename;
use File::Spec;
my $trepanpl = File::Spec->catfile(dirname(__FILE__), qw(.. bin trepanpl));

5 comments on commit 6f49cae

@rocky

I really think this kind of change is really silly, if not bad. I string the lines across because basically each of the lines is boilerplate and I'd like to skip over all of it as much as possible. Computer displays tend to be limited in line length more than they are in column length.

Are Perl experts so rigid that one can't tolerate different styles?

@shlomif
Owner

rocky:

Well, this is the first time I've seen such putting several "use" statements on the same line. It has given me a "WTF?" moment, and I found it hard to read. Furthermore, your boilerplat is a little different every time, and I also moved package statements right at the top, which is important.

If you're so keen on keeping them out of the way, you can configure your text editor to fold these lines out of the way:

http://vim.wikia.com/wiki/Folding

(This is for Vim - other decent editors should have similar features.).

@rocky

Is this so hard to read?

    $x = 1;  $y = 2; $z = 3; 

that you go around splitting this on several lines? And if it is

     $x = $y = $z = 0;

do you write that as:

     $x = 
     $y = 
     $z = 0;

? Or split this into 3 separate assignment statements?

Do you try to line up the = sign in:

    $first  = 1;
    $second  = 2;
    $third = 3;

?

because this is easier to read? I guess part of the point I am trying to make is that I doubt that just putting stuff on more lines in of itself makes things readable.

The thing about style is it is largely a matter of what one is used to. At one time I preferred indentation to be two spaces because again it is the minimum amount that gets the point across clearly. In some programming languages folks want 2 spaces, in some 4, and in some something different. After a while, I found I could just get used to any. So although I could get used to the multiple line thing, I think it silly and sad I can't write in the way I find the most logical and suits me the best.

When I say boilerplate, part of what I mean is that this stuff is uninteresting. Uninteresting to the point that if you totally skipped those lines and never read them, it wouldn't impact one iota the essentials of the program - the organization of classes, the algorithms, the fundamentals of what this program does and so on.

I know how to elide blocks of code, and I don't see a need to customize my Editor to elide this stuff. I want to write code in this way. The fact that you haven't seen it doesn't in of itself mean that this is a bad thing to do. Try it and live with it for a bit. If after trying it you can elucidate why it is so hard to read and why it is so important for you to be able read this, then let's discuss.

Also sad to me is that were spending this amount of time over things like this rather than:

  • adding watchpoints
  • adding out-of-process debugging
  • adding signal handlers like gdb's "handle" command
  • figuring out how to remove the globalness of the debugger to allow say profiing and debugging to be totally independent
  • finishing and removing some of the weirdnesses of tab ReadLine completion

These to me are the more important issues.

@rocky

One other thing I had meant to mention. You said that the boilerplate is different and that puts you off. In some cases I have "strict" before "warnings" and some the other way around. But when you split into several lines, you kept this irregularity in some cases. But again, I think this is all irrelevant; if you are spending time looking at this stuff and making sure strict comes before warnings (or vice versa) then I think you are concerned with the parts of the program that are the least important.

@shlomif
Owner

By different boilerplate, I did not mean "strict" before "warnings" or vice-versa (which makes little difference). Instead, I meant stuff like "no warnings $something" which are also there sometimes (and are placed on the same line).

In any case, I'm likely to run into such style issues first when starting to work on your code, and it will likely give other Perl developers besides me some "WTF?" moments. I've introduced some more meaningful changes like the "use English qw( -no_match_vars ) ;" cleanup and the t/Helper.pm cleanup, and I'm still waiting for input on why there are so many "use lib '../../../'" statements in the code (which like I said might prove to be a security breach).

Please sign in to comment.