Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] freemail code -- unfinished

Expand Messages
  • Charles K. Clarkson
    ... When I first run the code I get these messages: Assuming require Tk::Table; at C: freemail.pl line 58 Assuming require Tk::HList; at C: freemail.pl
    Message 1 of 3 , Jul 29, 2006
    • 0 Attachment
      Robin wrote:

      : #!/usr/bin/perl
      : package main;
      : my $m = new freemail;
      : $m -> mail ();


      When I first run the code I get these messages:

      Assuming 'require Tk::Table;' at C:\freemail.pl line 58
      Assuming 'require Tk::HList;' at C:\freemail.pl line 74
      Assuming 'require Tk::Dialog;' at C:\freemail.pl line 83

      "use" these in the code.


      : package freemail;
      :
      : require Exporter;

      freemail looks like an object. It may not need to export
      anything into the caller's namespace.


      : use Tk;
      : require Tk;

      You did this in the flatland code also. Why "use" and
      "require" the same module? Read the docs on what "require" does
      different from "use". Using both shows a lack of understanding.


      : use Net::POP3;
      : use Net::SMTP;
      : use strict;
      :
      : our @ISA = qw (Exporter);
      : our @EXPORt = qw (new);

      That's a typo. Exporter isn't doing much in this module. It
      certainly isn't exporting new().

      This

      my $m = new freemail;

      Is another way to write this.

      my $m = freemail->new();

      It is not another way to write this.

      my $m = new( 'freemail' );

      There's no need to import new() into main::.


      The beginning of this object might better be written like
      this.

      package freemail;

      use strict;
      use warnings;

      # GUI
      use Tk;
      use Tk::Table;
      use Tk::HList;
      use Tk::Dialog;

      # Mail
      use Net::POP3;
      use Net::SMTP;



      Have you considered using a separate module for the GUI and
      the mail handler? These seem like two very distinct portions of an
      application.

      package freemail;

      use strict;
      use warnings;

      # Mail
      use Net::POP3;
      use Net::SMTP;

      .
      .
      .


      package freemail_GUI;

      use strict;
      use warnings;

      # GUI
      use Tk;
      use Tk::Table;
      use Tk::HList;
      use Tk::Dialog;

      .
      .
      .


      HTH,

      Charles K. Clarkson
      --
      Mobile Homes Specialist
      Free Market Advocate
      Web Programmer

      254 968-8328

      Don't tread on my bandwidth. Trim your posts.
    Your message has been successfully submitted and would be delivered to recipients shortly.