NOTE: before telling me how terrible and wrong what I'm trying to do here is, know that I am aware of this and you can see NOTE2 at the bottom of this post for the reasons I'm doing it this way. I know DBI. I know this is bad form. There are reasons...

ah...

Is it possible to use packages/modules all in one file? something like this:

#!/usr/bin/perl -w use strict; package try; use Exporter; use vars qw(@ISA @EXPORT_OK); @ISA = qw(Exporter); @EXPORT_OK = qw($sql); my $sql = 'select name from v$database;'; 1; system("echo \'$try::sql\' | sqlplus -s system/manager");
As you've guessed, that doesn't work. I've tried it without the Exporter stuff, after the call, using the OO syntax, putting in a use try; and some other dumber things. Am I barking up the wrong tree? Do you ABSOLUTELY have to have modules in different files?

We speak the way we breathe. --Fugazi

NOTE2: the reason for this is I am trying to sneak something in the back door simply to prove it can be done. I tried installing DBI in my own directory (This is *NIX) but it was a no go b/c I don't even have access to compilers, make, etc., etc. The reason for wanting it all in one file is for "perception of ease" on the part of some of those who are anti my idea. If I can just drop in one file, show what we need done getting done, then that proves the point soundly. The reason for the packges is that there will be different version of the SQL for different situations, which could be differentiated by calling $mod1::sql vs $mod2::sql. I would knee-jerk hate all this too, but I'm backed in a corner...


In reply to packages / modules in the same file by jptxs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.