<?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 Question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275017#M688422</link>
    <description>Hi Radhika,&lt;BR /&gt;&lt;BR /&gt;as Merijn already wrote,&lt;BR /&gt;the only need to assign to these Perl special variables was if you wanted to drop privileges in an e.g. forked off child process.&lt;BR /&gt;Your assignments would slice off the 2nd element of the lists returned from getgrnam() for a group 'vsm' and getpwnam() for a user 'postgres', which as you can find out by "perldoc -f getpwent" should return the gid and the uid respectively.&lt;BR /&gt;Besides, the slicing looks redundant anyway because getgrnam() would return the gid, and getpwnam() the uid if both were used in scalar context, as in your example.</description>
    <pubDate>Wed, 24 Sep 2008 10:14:35 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2008-09-24T10:14:35Z</dc:date>
    <item>
      <title>Perl Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275015#M688420</link>
      <description>Hi I am using &lt;BR /&gt;1) $)=(getgrnam('vsm'))[2];&lt;BR /&gt;2) $&amp;gt;=(getpwnam('postgres'))[2];&lt;BR /&gt;in my application.&lt;BR /&gt;Can anyone help me understand these two statements</description>
      <pubDate>Wed, 24 Sep 2008 08:10:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275015#M688420</guid>
      <dc:creator>RadhikaHemanth</dc:creator>
      <dc:date>2008-09-24T08:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275016#M688421</link>
      <description>don't assign to $) and $&amp;gt; as they are predefined magic variables&lt;BR /&gt;&lt;BR /&gt;$ man perlvar&lt;BR /&gt;:&lt;BR /&gt;       $)      The effective gid of this process.  If you are on a machine&lt;BR /&gt;               that supports membership in multiple groups simultaneously,&lt;BR /&gt;               gives a space separated list of groups you are in.  The first&lt;BR /&gt;               number is the one returned by getegid (), and the subsequent&lt;BR /&gt;               ones by getgroups (), one of which may be the same as the first&lt;BR /&gt;               number.&lt;BR /&gt;&lt;BR /&gt;               Similarly, a value assigned to $) must also be a space-&lt;BR /&gt;               separated list of numbers.  The first number sets the effective&lt;BR /&gt;               gid, and the rest (if any) are passed to setgroups ().  To get&lt;BR /&gt;               the effect of an empty list for setgroups (), just repeat the&lt;BR /&gt;               new effective gid; that is, to force an effective gid of 5 and&lt;BR /&gt;               an effectively empty setgroups () list, say " $) = "5 5" ".&lt;BR /&gt;&lt;BR /&gt;               You can change both the effective gid and the real gid at the&lt;BR /&gt;               same time by using POSIX::setgid () (use only a single numeric&lt;BR /&gt;               argument).  Changes to $) require a check to $! to detect any&lt;BR /&gt;               possible errors after an attempted change.&lt;BR /&gt;&lt;BR /&gt;               (Mnemonic: parentheses are used to group things.  The effective&lt;BR /&gt;               gid is the group that's right for you, if you're running&lt;BR /&gt;               setgid.)&lt;BR /&gt;&lt;BR /&gt;               $&amp;lt;, $&amp;gt;, $( and $) can be set only on machines that support the&lt;BR /&gt;               corresponding set[re][ug]id() routine.  $( and $) can be&lt;BR /&gt;               swapped only on machines supporting setregid ().&lt;BR /&gt;:&lt;BR /&gt;       $&amp;gt;      The effective uid of this process.  Example:&lt;BR /&gt;&lt;BR /&gt;                   $&amp;lt; = $&amp;gt;;            # set real to effective uid&lt;BR /&gt;                   ($&amp;lt;,$&amp;gt;) = ($&amp;gt;,$&amp;lt;);  # swap real and effective uid&lt;BR /&gt;&lt;BR /&gt;               You can change both the effective uid and the real uid at the&lt;BR /&gt;               same time by using POSIX::setuid ().  Changes to $&amp;gt; require a&lt;BR /&gt;               check to $!  to detect any possible errors after an attempted&lt;BR /&gt;               change.&lt;BR /&gt;&lt;BR /&gt;               (Mnemonic: it's the uid you went to, if you're running setuid.)&lt;BR /&gt;               $&amp;lt; and $&amp;gt; can be swapped only on machines supporting&lt;BR /&gt;               setreuid ().&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 24 Sep 2008 08:57:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275016#M688421</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2008-09-24T08:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275017#M688422</link>
      <description>Hi Radhika,&lt;BR /&gt;&lt;BR /&gt;as Merijn already wrote,&lt;BR /&gt;the only need to assign to these Perl special variables was if you wanted to drop privileges in an e.g. forked off child process.&lt;BR /&gt;Your assignments would slice off the 2nd element of the lists returned from getgrnam() for a group 'vsm' and getpwnam() for a user 'postgres', which as you can find out by "perldoc -f getpwent" should return the gid and the uid respectively.&lt;BR /&gt;Besides, the slicing looks redundant anyway because getgrnam() would return the gid, and getpwnam() the uid if both were used in scalar context, as in your example.</description>
      <pubDate>Wed, 24 Sep 2008 10:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275017#M688422</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-09-24T10:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275018#M688423</link>
      <description>Hi &lt;BR /&gt;Thanks for that detailed information but I wanted to know the use of these statements in short I dont much understand about effective uid setreid and all .&lt;BR /&gt;Can you simply tell what are these statements meant for</description>
      <pubDate>Thu, 25 Sep 2008 08:27:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275018#M688423</guid>
      <dc:creator>RadhikaHemanth</dc:creator>
      <dc:date>2008-09-25T08:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275019#M688424</link>
      <description>As I have understood is it used for setting the group name and user name to vsm and postgres respectively whenever it is required</description>
      <pubDate>Thu, 25 Sep 2008 08:30:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-question/m-p/4275019#M688424</guid>
      <dc:creator>RadhikaHemanth</dc:creator>
      <dc:date>2008-09-25T08:30:02Z</dc:date>
    </item>
  </channel>
</rss>

