Procházet zdrojové kódy

Use a more clean approach to pass in arguments to new constructor, also stop
including modules_dir to @INC, it's not needed here.

Morten Brix Pedersen před 25 roky
rodič
revize
a8b205e334
1 změnil soubory, kde provedl 9 přidání a 11 odebrání
  1. 9 11
      modules/Pisg/HTMLGenerator.pm

+ 9 - 11
modules/Pisg/HTMLGenerator.pm

@@ -9,18 +9,16 @@ $^W = 1;
 sub new
 {
     my $type = shift;
-    my $self = { };
-
     my %args = @_;
-
-    $self->{cfg} = $args{cfg};
-    $self->{debug} = $args{debug};
-    $self->{stats} = $args{stats};
-    $self->{users} = $args{users};
-    $self->{tmps} = $args{tmps};
-
-    # Load the Common module from wherever it's configured to be.
-    push(@INC, $self->{cfg}->{modules_dir});
+    my $self = {
+        cfg => $args{cfg},
+        debug => $args{debug},
+        stats => $args{stats},
+        users => $args{users},
+        tmps => $args{tmps}
+    };
+
+    # Import common functions in Pisg::Common
     require Pisg::Common;
     Pisg::Common->import();