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

Re: How best to modularise with strict

Expand Messages
  • kenshail2003
    ... email suggests. ... name of your module must go beneath it. ... qw($dbh, $url, say_hey);@EXPORT_OK = qw();use strict;use CGI;use CGI::Carp
    Message 1 of 8 , May 21, 2007
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, essential quint
      <quintessential1@...> wrote:
      >
      >
      > Well, I would put them into a module, like the subject line to your
      email suggests.
      >
      > First, create a modules directory, and then in your script create a
      module call. You have to use two module for this:
      >
      > use lib '/home/ete.etc.etc./modules';use db_mod;
      >
      > You can use the 'pwd' unix command to get an accurate lib path; the
      name of your module must go beneath it.
      >
      > Next build your module. Here's a module template:
      >
      > package db_mod;require Exporter;@ISA = qw(Exporter);@EXPORT =
      qw($dbh, $url, say_hey);@EXPORT_OK = qw();use strict;use CGI;use
      CGI::Carp qw(warningsToBrowser fatalsToBrowser);
      >
      > our $dbh =
      DBI->connect('DBI:mysql:insert_db_name:localhost','insert_username','insert_password');
      >
      > our $url = 'www.whatever.com';
      >
      > sub say_hey { print "Hello World!\n"; }
      >
      > 1;
      > A few notes on the module (in no particular order). 1.) The @EXPORT
      line must list all the variables and subs you wish to export, 2.)
      CHMOD it to 644, as it doesnt need to be executable, just readable;
      3.) The CGI::Carp line is in there only for development purposes, so
      take it out when you have finished your app; 4.) the package line
      contains the name of the module, which must be reflected in the
      script; 5.) The module must end with a 1, i.e. it must return a 1
      value, or it will fail.
      >
      > You should protect your modules directory with an .htaccess file.
      The following code works:
      >
      > <FilesMatch "\.pm$">Order deny,allow Deny from all</FilesMatch>
      >
      > Just c&p it into a notepad file, title it .htaccess and upload it.
      >
      > There may be some typos in the above scripts, as I just woke up, but
      I think they should work.
      >
      > Good luck.
      > HTH,
      >
      > q
      >
      Thanks for such a comprehensive and helful reply.
    • Dukelow, Don
      The commands aren t working for me. I think I m telneted into the cell server and all I can get is. /opt/omni # omnicellinfo -cell |grep host
      Message 2 of 8 , May 21, 2007
      • 0 Attachment
        The commands aren't working for me. I think I'm telneted into the cell
        server and all I can get is.

        /opt/omni # omnicellinfo -cell |grep host
        host="mafis003.mat.delcoelect.com"
        host="mafis002.mat.delcoelect.com"
        host="mafis001.mat.delcoelect.com"
        host="ddmfis01.mat.delcoelect.com"
        host="mamts001.mxtampsmat1.northamerica.delphiauto.net"
        host="mafisdr1.mxtampsmat1.northamerica.delphiauto.net"
        6 configured host[s].
        root@mafis003:


        and

        root@mafis003:
        /opt/omni # /opt/omni/bin/omnirpt -report list_sessions -timeframe 24
        24
        List of Backup Sessions

        Cell Manager: mafis003.mat.delcoelect.com
        Creation Date: 05/21/07 14:07:16

        Backup Specification Status Mode Start Time
        Queuing Duration GB Written # Media # Errors # Warnings # Files
        Success Session ID
        ________________________________________________________________________
        ________________________________________________________________________
        ____________________
        WeeklyFull Completed incr 05/21/07 03:15:01
        0:00 0:34 6.40 1 0 110 70734
        100% 2007/05/21-1

        root@mafis003:

        if I run omnidb -session -last 1 all I get is a usage message.

        Don Dukelow

        ________________________________

        From: perl-beginner@yahoogroups.com
        [mailto:perl-beginner@yahoogroups.com] On Behalf Of kenshail2003
        Sent: Monday, May 21, 2007 3:00 PM
        To: perl-beginner@yahoogroups.com
        Subject: Re: [PBML] How best to modularise with strict



        --- In perl-beginner@yahoogroups.com
        <mailto:perl-beginner%40yahoogroups.com> , "Lou Hernsen"
        <lhernsen1015@...>
        wrote:
        >
        > are the teh variables $'s or @'s or %'s ?
        >
        They are all three plus references to same.






        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.