<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic using perl modules in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/using-perl-modules/m-p/3932408#M97331</link>
    <description>I am having difficulty using perl modules, I know once I start and figure this out, it would make my life simplier.&lt;BR /&gt;&lt;BR /&gt;My module is used for logging into a database.&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;package login_acdb;&lt;BR /&gt;&lt;BR /&gt;my $file = "/etc/accesscare/$ENV{'ORACLE_SID'}/voice/ac.login";&lt;BR /&gt;open LOGINID, "&amp;lt; $file" or die  "Could not open $file: $!";&lt;BR /&gt;my $oraLoginId = &lt;LOGINID&gt;;&lt;BR /&gt;chomp $oraLoginId;&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;The file looks like:  oracle/oracle321&lt;BR /&gt;&lt;BR /&gt;I have added it to my PERL5LIB environment so it is in the @INC path.&lt;BR /&gt;&lt;BR /&gt;But now I am having problems with how to call it.&lt;BR /&gt;&lt;BR /&gt;Here is where I call it in my script:&lt;BR /&gt;sub doSqlSelect {&lt;BR /&gt;        my @buffer = qx { sqlplus -S $login_acdb::oraLoginId &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;        set heading off&lt;BR /&gt;        set pagesize 0&lt;BR /&gt;        set feedback off&lt;BR /&gt;        SELECT feature||','||description&lt;BR /&gt;        FROM vt_feature&lt;BR /&gt;        ORDER by 1;&lt;BR /&gt;        EOF&lt;BR /&gt;        };&lt;BR /&gt;&lt;BR /&gt;Yes, I know it would be really easy to use the DBI, but I have tried to no success to have 32 bit oracle, with 32 or 64 bit perl, on HP 11.00 RISC. Spent a week on that one.&lt;BR /&gt;DBI goes in nice, but DBD::ORACLE cacks out every time&lt;/LOGINID&gt;</description>
    <pubDate>Wed, 24 Jan 2007 16:21:15 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2007-01-24T16:21:15Z</dc:date>
    <item>
      <title>using perl modules</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-perl-modules/m-p/3932408#M97331</link>
      <description>I am having difficulty using perl modules, I know once I start and figure this out, it would make my life simplier.&lt;BR /&gt;&lt;BR /&gt;My module is used for logging into a database.&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;package login_acdb;&lt;BR /&gt;&lt;BR /&gt;my $file = "/etc/accesscare/$ENV{'ORACLE_SID'}/voice/ac.login";&lt;BR /&gt;open LOGINID, "&amp;lt; $file" or die  "Could not open $file: $!";&lt;BR /&gt;my $oraLoginId = &lt;LOGINID&gt;;&lt;BR /&gt;chomp $oraLoginId;&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;The file looks like:  oracle/oracle321&lt;BR /&gt;&lt;BR /&gt;I have added it to my PERL5LIB environment so it is in the @INC path.&lt;BR /&gt;&lt;BR /&gt;But now I am having problems with how to call it.&lt;BR /&gt;&lt;BR /&gt;Here is where I call it in my script:&lt;BR /&gt;sub doSqlSelect {&lt;BR /&gt;        my @buffer = qx { sqlplus -S $login_acdb::oraLoginId &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;        set heading off&lt;BR /&gt;        set pagesize 0&lt;BR /&gt;        set feedback off&lt;BR /&gt;        SELECT feature||','||description&lt;BR /&gt;        FROM vt_feature&lt;BR /&gt;        ORDER by 1;&lt;BR /&gt;        EOF&lt;BR /&gt;        };&lt;BR /&gt;&lt;BR /&gt;Yes, I know it would be really easy to use the DBI, but I have tried to no success to have 32 bit oracle, with 32 or 64 bit perl, on HP 11.00 RISC. Spent a week on that one.&lt;BR /&gt;DBI goes in nice, but DBD::ORACLE cacks out every time&lt;/LOGINID&gt;</description>
      <pubDate>Wed, 24 Jan 2007 16:21:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-perl-modules/m-p/3932408#M97331</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2007-01-24T16:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: using perl modules</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-perl-modules/m-p/3932409#M97332</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;The problem seems to be that the variable $oraLoginID that you defined in your package login_acdb was declared as lexical (by my).&lt;BR /&gt;You can never access lexical variables once they are out of scope (especially from a different package, viz. the importing one).&lt;BR /&gt;Although this is usually the wished behavior in order to prevent name collisions, in you case it isn't.&lt;BR /&gt;Thus, you must declare it as a package global.&lt;BR /&gt;Only then does it appear in the symbol table,&lt;BR /&gt;and can always be accessed by its full qualified name (i.e. prepending the package that defined it).&lt;BR /&gt;This takes usually place for *every* variable that you introduce without explicit declaration unless you use the strict pragma.&lt;BR /&gt;But we usually want to remain under strict vars (to avoid name collisions).&lt;BR /&gt;Therefore declare it as "our" instead of "my".&lt;BR /&gt;In the importing package you could then access it by $login_acdb::ora_LoginId.&lt;BR /&gt;If this gets too clumsy you could also "alias" the variable by using the glob reference notation whithin a short block where you relinquish the strict refs pragma by "no strict 'refs';".&lt;BR /&gt;This should be the only circumstance where the use of the so called symbolic refs is "approved" by style guides.&lt;BR /&gt;Please, see the examples in "perldoc perlref" for details.&lt;BR /&gt;Alternatively you could use the Exporter module and declare the variables that you want to "alias" in the @EXPORT array (which causes automatic, but mostly deprecated import into the using name space), or better yet in the @EXPORT_OK array (where the importer has to explicitly declare what he wishes to be imported, usually in an appended qw() list).&lt;BR /&gt;More or less the Exporter module is doing the messing with the symbol table behind the scenes for the user.&lt;BR /&gt;See "perldoc Exporter" for details.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Jan 2007 06:48:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-perl-modules/m-p/3932409#M97332</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-01-25T06:48:26Z</dc:date>
    </item>
  </channel>
</rss>

