<?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 Re: Perl unitialized variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672841#M723063</link>
    <description>The path is the same on both servers - /opt/perl5/bin.  I did a "perl -V" on both machines, and compared the output:&lt;BR /&gt;$ ls -al perl*&lt;BR /&gt;-rw-r--r--   1 nsandhar   cmsi          1723 Feb 27 10:50 perl.V.out&lt;BR /&gt;-rw-r--r--   1 nsandhar   cmsi          1723 Feb 27 10:50 perl.V.out.atlas&lt;BR /&gt;$ diff perl.V.out perl.V.out.atlas&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;The output file is exactly the same.  It also shows the version as 5.6.1:&lt;BR /&gt;&lt;BR /&gt;Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 27 Feb 2002 18:54:23 GMT</pubDate>
    <dc:creator>Nishan Sandhar</dc:creator>
    <dc:date>2002-02-27T18:54:23Z</dc:date>
    <item>
      <title>Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672839#M723061</link>
      <description>A perl script that USED to work all of a sudden stopped working recently (no known changes involved), with an "uninitialized variable" error message.  Even the following fails:&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl5/bin/perl -w&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;$userid = getlogin;&lt;BR /&gt;print $userid;&lt;BR /&gt;&lt;BR /&gt;HOWEVER, the exact same script works on OTHER servers, with the same version of Perl installed (ver. 5.6.1).</description>
      <pubDate>Wed, 27 Feb 2002 18:08:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672839#M723061</guid>
      <dc:creator>Nishan Sandhar</dc:creator>
      <dc:date>2002-02-27T18:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672840#M723062</link>
      <description>My guess is that on the other system, /opt/perl5/bin/perl isn't really perl version 5 or is a lower version of perl5.  &lt;BR /&gt;&lt;BR /&gt;Try a perl -V on both systems and compare the version.&lt;BR /&gt;&lt;BR /&gt;I was able to reproduce this using my perl5 install (which is perl 5.03) to run your test program.  Perl 5.03 worked fine.  When I switched to /usr/contrib/bin/perl (version 4.something) I got the exact message you did.&lt;BR /&gt;&lt;BR /&gt;It's possible that the getlogin wasn't implemented in 4.0 (I couldn't find a man page to validate this).</description>
      <pubDate>Wed, 27 Feb 2002 18:39:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672840#M723062</guid>
      <dc:creator>Eric Ladner</dc:creator>
      <dc:date>2002-02-27T18:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672841#M723063</link>
      <description>The path is the same on both servers - /opt/perl5/bin.  I did a "perl -V" on both machines, and compared the output:&lt;BR /&gt;$ ls -al perl*&lt;BR /&gt;-rw-r--r--   1 nsandhar   cmsi          1723 Feb 27 10:50 perl.V.out&lt;BR /&gt;-rw-r--r--   1 nsandhar   cmsi          1723 Feb 27 10:50 perl.V.out.atlas&lt;BR /&gt;$ diff perl.V.out perl.V.out.atlas&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;The output file is exactly the same.  It also shows the version as 5.6.1:&lt;BR /&gt;&lt;BR /&gt;Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Feb 2002 18:54:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672841#M723063</guid>
      <dc:creator>Nishan Sandhar</dc:creator>
      <dc:date>2002-02-27T18:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672842#M723064</link>
      <description>Although you might have the same version, it does not mean you have the same "modules" added to perl on each machine. Of course the "-w" tells perl to issue warnings for things that are normally ignored.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 27 Feb 2002 19:03:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672842#M723064</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-02-27T19:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672843#M723065</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You are not quite playing by the rules. First of all, getlogin requires that stdin be associated with a terminal device. Secondly, getlogin returns the current login name from /etc/utmp, it returns a null value if that fails and you should then use the getpwuid function.&lt;BR /&gt;&lt;BR /&gt;This should work:&lt;BR /&gt;&lt;BR /&gt;$userid = getlogin || getpwuid($&amp;lt;) || "Unknown";&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Wed, 27 Feb 2002 19:08:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672843#M723065</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-27T19:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672844#M723066</link>
      <description>Nice catch Clay!</description>
      <pubDate>Wed, 27 Feb 2002 20:13:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672844#M723066</guid>
      <dc:creator>Eric Ladner</dc:creator>
      <dc:date>2002-02-27T20:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672845#M723067</link>
      <description>HOWEVER - why would the same code work on some systems, but not others.&lt;BR /&gt;&lt;BR /&gt;Additionally, I've found that I cannot execute the passwd command - the response is "Usage: passwd [ -F file ] [ name ]".&lt;BR /&gt;&lt;BR /&gt;The perl code mentioned in the original query above works properly if executed from a Telnet window, but fails if executed from an hpterm Xwindow created via a Rexec in Hummingbird eXceed product.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Feb 2002 22:04:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672845#M723067</guid>
      <dc:creator>Nishan Sandhar</dc:creator>
      <dc:date>2002-02-27T22:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672846#M723068</link>
      <description>The getlogin Perl function relies on the underlying getlogin() libc function. It depends upon the build of the code and the platform that it's running on. The real answer (though you are not going to like it) is that your Perl was working by accident. You really have to assume that getlogin will fail and act accordingly. By the way, this is exactly what you should do in C as well. Call getlogin() first, it that fails, call getpwuid(). That is how I knew the answer as soon as I saw your post.&lt;BR /&gt;&lt;BR /&gt;As to your ExCeed problem, I don't know but I avoid PC based X-emulators like the plague. I find that they work 'almost perfectly' and that is the worst kind of problem to fight. I suspect that passwd is failing because it can't set echo to off.&lt;BR /&gt;&lt;BR /&gt;Food for thought, Clay&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Feb 2002 22:15:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672846#M723068</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-27T22:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Perl unitialized variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672847#M723069</link>
      <description>Just an aside to Clay's solution.&lt;BR /&gt;Nishan could have found this if he only would have RTFM or in Perl-speach the POD&lt;BR /&gt;Nishan, at the shell prompt simply issue the following:&lt;BR /&gt;&lt;BR /&gt;perldoc -f getlogin&lt;BR /&gt;perldoc -f getpwuid&lt;BR /&gt;perldoc perlvar&lt;BR /&gt;&lt;BR /&gt;Clay has given a thorough explanation.&lt;BR /&gt;Maybe just to add,&lt;BR /&gt;$&amp;gt; is Perl's eff. UID, $&amp;lt; real UID, $) eff. GID, $( real GID  (consult POD above)&lt;BR /&gt;&lt;BR /&gt;getpwuid $&amp;lt;&lt;BR /&gt;returns a list of entries in /etc/passwd for the passed UID.&lt;BR /&gt;In scalar context however, as in the POD's or Clay's example, it only returns the first field of the matching entry in /etc/passwd.&lt;BR /&gt;This could also be accomplished by taking a slice&lt;BR /&gt;(getpwuid $&amp;lt;)[0]&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Feb 2002 09:55:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-unitialized-variable/m-p/2672847#M723069</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2002-02-28T09:55:36Z</dc:date>
    </item>
  </channel>
</rss>

