[14008] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1418 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 18 18:12:08 1999

Date: Thu, 18 Nov 1999 15:10:54 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942966653-v9-i1418@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 18 Nov 1999     Volume: 9 Number: 1418

Today's topics:
        CArray: XS, TIEARRAY and OO considerations (Reini Urban)
    Re: Clarification of threads and locking <bbense+comp.lang.perl.misc.Nov.18.99@telemark.stanford.edu>
        Deleting or Unlinking a file help <lakesoft@skypoint.com>
    Re: Deleting or Unlinking a file help <asd@ds.aw>
    Re: Deleting or Unlinking a file help <uri@sysarch.com>
        Determining user groups. <frans.jonkers@ict.nl>
    Re: Determining user groups. (Martien Verbruggen)
        Encryption <Andrew_Longworth@bigfoot.com>
    Re: Encryption <gellyfish@gellyfish.com>
        environment vars <cpcollin@wam.umd.edu>
    Re: environment vars <asd@ds.aw>
    Re: environment vars <gellyfish@gellyfish.com>
    Re: environment vars <gellyfish@gellyfish.com>
    Re: environment vars <asd@ds.aw>
    Re: environment vars <uri@sysarch.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 18 Nov 1999 21:26:31 GMT
From: rurban@xarch.tu-graz.ac.at (Reini Urban)
Subject: CArray: XS, TIEARRAY and OO considerations
Message-Id: <3834644e.36172743@judy>

I'm trying to provide a useful XS object, which is a plain C Array
(double *) eg. I need it for some computional geometry modules which
deal with large external C data (>200.000 double[3] per call). All this
data should not be converted to perl data if possible. (Similar to a
DB_file tie)

I tried several approaches (swig, h2xs, handwritten), and looked through
some handy modules, but got not really clever on certain aspects.
Let me first briefly describe it:

A raw ptr to the object should be something fast, let's say a ref to a
lightweight 'CDoublePtr' class.
This is the name provided by SWIG's 'array.i' and also by h2xs when I
use the typemap  double *   T_PTROBJ.
This is for speed, holds only the pointer and does no range checks.
  use CArray qw (CDoublePtr);
  my $size=200000;
  $rawptr = new (CDoublePtr, $size);
  set($rawptr,$size-1,0.0);

I named the better object with size info and range checks
'CDoubleArray'. I derive it from CDoublePtr and also from Tie::Array and
can tie it now as well. Fine. (Convenient but slow perl operations like
sort or splice if necessary)

  use CArray::CDoubleArray qw (CDoubleArray)
  $array = new (CDoubleArray, $size);
  $array->[ $array->size()-1 ] = 0.0;

or when tied:
  tie (@array, 'CDoubleArray', $size);
  $array[ $#array-1 ] = 0.0;

  # oops, this will be quite slow and need ~2*n additional memory
  sort(@array);	

Because I have CStringArray, CDoubleArray and CIntArray I want an
abstract class CArray (e.g. as parent) which holds also the Type (i.e.
the name of the class). 

  use CArray;  # just the base class, not a tree with 3 children
  tie (@array, 'CDoubleArray, $size);

Now my design question:
How should I lay out the class tree?
I want to try to keep everything in one CArray.pm module and create the
several packages from within this module, partially (the CtypePtr) from
the XS side, the rest from perl.
Is there an example out there which creates a lot of sub-packages on the
fly, as in my case?

The Tie example uses children per type: Tie::Array, Tie::Scalar, ...

I don't want to maintain 4 packages (CArray, CArray::CDoubleArray,
CArray::CStringArray, CArray::CIntArray) with all the XS libs. Just one
CArray.pm and CArray.xs should be enough for all the 1+3+3 types.

When providing the needed TIE methods do I have to repeat all the
methods for all classes, or is it advisable to generate and eval them on
the fly through a handy loop? Any samples for this out there?
I'm not OO proficient enough.
The Tie::Array module simply defines everything in terms of SPLICE. But
in my case it is not that easy.

The TIEARRAY XS methods are considered [will chang soon] in the docs. Is
it stable enough now?

Thanks in advance for any hints. 

FYI: My Geometry modules are doing well. Soon I'll have most of the
computional geometry problems as perl XS modules, which is fine for
writing CAD or Game converters or GIS processors. 
(meshes, polygons, map overlays, trapdec, triang, boolean, hulls,
location problems, intersections, ...)
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html


------------------------------

Date: 18 Nov 1999 15:06:10 GMT
From: <bbense+comp.lang.perl.misc.Nov.18.99@telemark.stanford.edu> ;
Subject: Re: Clarification of threads and locking
Message-Id: <8114l2$jod$1@nntp.Stanford.EDU>



In article <3831136C.CCEBFD69@ihug.co.nz>,
Grant McLean  <sisl@ihug.co.nz> wrote:
>Thank you Abigail for a lucid explanation.  Looks like I've got some
>more work to do.
>
>Regards
>Grant
>

- - You might be rushing the process a bit. From my reading of 
perl5-porters, the state of threads now is not what they will
be in 5.6. You'll likely put in alot of work to only find that
it all needs to be redone in 5.6. Threads are EXPERIMENTAL,
that means that there's no guarantee that they will have any
backward compatiblity (or even be included in future versions[1]).
You use them at your own risk.  

- - The current thread model is hair's width from being trashed.
While reading p5p is a difficult task for a busy person, there
is an excellent summary service available at : 

	  http://www.perl.com/pub/q/archivep5p

- - I think this is pretty much required reading for any module
developer. 

- - Booker C. Bense 


[1] I'm pretty sure there will be thread support in 5.6 and I'm
pretty sure it will look nothing like the current model, but that's
just my opinion. 


Version: 2.6.2

iQCVAwUBODQV3wD83u1ILnWNAQHioQP+Mx0M45QxmmWpP8UkVo71lCTlP6GZp3xB
ML4RIOt4Wdi2OabnZXdYzvXT22HtgxfZMdYVeHri6fSJPODCyFt7/93LZyaYxeTL
uHe07kVD/acULMFqURLQs10Y9s41zlQt0KlGhMDjth+B4LHl+Vx1X4vYz1Y4a2Ev
UZrgVNYDo88=
=oIkB
-----END PGP SIGNATURE-----


------------------------------

Date: Wed, 17 Nov 1999 21:20:10 -0600
From: "Jonathan A. Laub" <lakesoft@skypoint.com>
Subject: Deleting or Unlinking a file help
Message-Id: <80vrf9$2dl$1@shadow.skypoint.net>

This is a multi-part message in MIME format.

------=_NextPart_000_0007_01BF3141.87983E00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am unable to delete this file using this (275.inp,276.inp,etc...) =
code... any ideas??? =20


      if (open(newfile,"$xCOUNT.INP")){     -->a numerically incremented =
file name nnn.inp
         print("<br>");
         $line =3D <newfile>;
         while ($line ne "") {
               print ($line,"<br>");
               $line =3D <newfile> };
               print("<BR>");
               }
       # Check for a Return Link
        if ($CONFIG{'return_link_url'} =3D~ /http\:\/\/.*\..*/ && =
$CONFIG{'retur
           print "<ul>\n";
           print "<li><a =
href=3D\"$CONFIG{'return_link_url'}\">$CONFIG{'return_l
           print "</ul>\n";
           }
#
### this does not want to delete the file... however it will work when I =
hardcode the file name.
       print("$KOUNTR.INP\n");
       print "</body>\n</html>\n";
       close(newfile);
       # does not work...why???
       unlink($KOUNTR.INP)
       # works
       unlink("75.inp")
   }

}
Thanks,
Jon

------=_NextPart_000_0007_01BF3141.87983E00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#789898>
<DIV><FONT color=3D#000000 size=3D2>I am unable to delete this file =
using this=20
(275.inp,276.inp,etc...) code... any ideas???&nbsp; </FONT></DIV>
<DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
(open(newfile,&quot;$xCOUNT.INP&quot;)){&nbsp;&nbsp;&nbsp;&nbsp; --&gt;a =

numerically incremented file name=20
nnn.inp<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
print(&quot;&lt;br&gt;&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
$line =3D =
&lt;newfile&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
while ($line ne &quot;&quot;)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
print=20
($line,&quot;&lt;br&gt;&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
$line =3D &lt;newfile&gt;=20
};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
print(&quot;&lt;BR&gt;&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR></FONT></FONT></FONT><FONT color=3D#000000><FONT face=3D"Courier =
New"><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Check for a Return=20
Link<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
($CONFIG{'return_link_url'} =3D~ /http\:\/\/.*\..*/ &amp;&amp;=20
$CONFIG{'retur<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
print=20
&quot;&lt;ul&gt;\n&quot;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
print &quot;&lt;li&gt;&lt;a=20
href=3D\&quot;$CONFIG{'return_link_url'}\&quot;&gt;$CONFIG{'return_l<BR>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
print=20
&quot;&lt;/ul&gt;\n&quot;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
}</FONT></FONT></FONT><FONT size=3D2><FONT face=3D"Courier =
New"></FONT></FONT></DIV>
<DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
size=3D2></FONT></FONT></FONT><FONT size=3D2><FONT=20
face=3D"Courier New"></FONT></FONT><FONT color=3D#000000 =
size=3D2>#</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>### this does =
not want to=20
delete the file... however it will work when I hardcode the file=20
name.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"Courier New"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
print(&quot;$KOUNTR.INP\n&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 print=20
&quot;&lt;/body&gt;\n&lt;/html&gt;\n&quot;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
close(newfile);</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"Courier New"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # does not=20
work...why???<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
unlink($KOUNTR.INP)</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"Courier New" size=3D2></FONT><FONT=20
face=3D"Courier New" size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #=20
works</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"Courier New"=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
unlink(&quot;75.inp&quot;)<BR>&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>}<BR>Thanks,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>Jon</FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01BF3141.87983E00--



------------------------------

Date: Thu, 18 Nov 1999 17:19:22 +0100
From: "Jakob" <asd@ds.aw>
Subject: Re: Deleting or Unlinking a file help
Message-Id: <8119dk$jek@sdaw04.seinf.abb.se>

This is a multi-part message in MIME format.

------=_NextPart_000_0440_01BF31E9.0E518DF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Do like this (atleast it worked for me)

#!/usr/local/bin/perl -w

$name=3D"HI";

unlink("$name.10");

/ J
  Jonathan A. Laub <lakesoft@skypoint.com> wrote in message =
news:80vrf9$2dl$1@shadow.skypoint.net...
  I am unable to delete this file using this (275.inp,276.inp,etc...) =
code... any ideas??? =20
  =20
  =20
        if (open(newfile,"$xCOUNT.INP")){     -->a numerically =
incremented file name nnn.inp
           print("<br>");
           $line =3D <newfile>;
           while ($line ne "") {
                 print ($line,"<br>");
                 $line =3D <newfile> };
                 print("<BR>");
                 }
         # Check for a Return Link
          if ($CONFIG{'return_link_url'} =3D~ /http\:\/\/.*\..*/ && =
$CONFIG{'retur
             print "<ul>\n";
             print "<li><a =
href=3D\"$CONFIG{'return_link_url'}\">$CONFIG{'return_l
             print "</ul>\n";
             }
  #
  ### this does not want to delete the file... however it will work when =
I hardcode the file name.
         print("$KOUNTR.INP\n");
         print "</body>\n</html>\n";
         close(newfile);
         # does not work...why???
         unlink($KOUNTR.INP)
         # works
         unlink("75.inp")
     }
  =20
  }
  Thanks,
  Jon

------=_NextPart_000_0440_01BF31E9.0E518DF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#789898>
<DIV><FONT face=3DArial size=3D2>Do like this (atleast it worked for=20
me)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#!/usr/local/bin/perl -w</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>$name=3D"HI";</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>unlink("$name.10");<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/ J</DIV></FONT>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV>Jonathan A. Laub &lt;<A=20
  href=3D"mailto:lakesoft@skypoint.com">lakesoft@skypoint.com</A>&gt; =
wrote in=20
  message <A=20
  =
href=3D"news:80vrf9$2dl$1@shadow.skypoint.net">news:80vrf9$2dl$1@shadow.s=
kypoint.net</A>...</DIV>
  <DIV><FONT color=3D#000000 size=3D2>I am unable to delete this file =
using this=20
  (275.inp,276.inp,etc...) code... any ideas???&nbsp; </FONT></DIV>
  <DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
  size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
  size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
  (open(newfile,"$xCOUNT.INP")){&nbsp;&nbsp;&nbsp;&nbsp; --&gt;a =
numerically=20
  incremented file name=20
  nnn.inp<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
print("&lt;br&gt;");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
$line=20
  =3D =
&lt;newfile&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
while=20
  ($line ne "")=20
  =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
  print=20
  =
($line,"&lt;br&gt;");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  $line =3D &lt;newfile&gt;=20
  =
};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
  =
print("&lt;BR&gt;");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR></FONT></FONT></FONT><FONT color=3D#000000><FONT face=3D"Courier =
New"><FONT=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Check for a Return=20
  Link<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
  ($CONFIG{'return_link_url'} =3D~ /http\:\/\/.*\..*/ &amp;&amp;=20
  =
$CONFIG{'retur<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
  print=20
  =
"&lt;ul&gt;\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
  print "&lt;li&gt;&lt;a=20
  =
href=3D\"$CONFIG{'return_link_url'}\"&gt;$CONFIG{'return_l<BR>&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  print=20
  =
"&lt;/ul&gt;\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
  }</FONT></FONT></FONT><FONT size=3D2><FONT=20
  face=3D"Courier New"></FONT></FONT></DIV>
  <DIV><FONT color=3D#000000><FONT face=3D"Courier New"><FONT=20
  size=3D2></FONT></FONT></FONT><FONT size=3D2><FONT=20
  face=3D"Courier New"></FONT></FONT><FONT color=3D#000000 =
size=3D2>#</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>### this =
does not want to=20
  delete the file... however it will work when I hardcode the file=20
  name.</FONT></DIV>
  <DIV><FONT color=3D#000000 face=3D"Courier New"=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  print("$KOUNTR.INP\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print=20
  =
"&lt;/body&gt;\n&lt;/html&gt;\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
  close(newfile);</FONT></DIV>
  <DIV><FONT color=3D#000000 face=3D"Courier New"=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # does not=20
  work...why???<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  unlink($KOUNTR.INP)</FONT></DIV>
  <DIV><FONT color=3D#000000 face=3D"Courier New" size=3D2></FONT><FONT=20
  face=3D"Courier New" size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #=20
  works</FONT></DIV>
  <DIV><FONT color=3D#000000 face=3D"Courier New"=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
unlink("75.inp")<BR>&nbsp;&nbsp;=20
  }</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>}<BR>Thanks,</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>Jon</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0440_01BF31E9.0E518DF0--



------------------------------

Date: 18 Nov 1999 12:16:20 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Deleting or Unlinking a file help
Message-Id: <x7emdnsot7.fsf@home.sysarch.com>

>>>>> "J" == Jakob  <asd@ds.aw> writes:

  J> This is a multi-part message in MIME format.

don't post in MIME nor HTML. it is noisy and not needed nor wanted here.

and your email address is bogus. how nice to hide while you complain
about this group.

and don't post jeopardy style with 2 (count'em 2!) copies of the
original post. how effective is that for answering stuff.

  J> Do like this (atleast it worked for me)

  J> #!/usr/local/bin/perl -w

  J> $name=3D"HI";

your post has that crappy 3D shit that redmondware likes to put
in. learn how to post properly or don't post here.

  J> unlink("$name.10");

oh, the great answerer helps out here! that is the same thing he did so
why would it answer anything? strike one for the flaming twit who claims
to be able to answer stuff better than the regulars. you are losing the
dare quickly.

  J> I hardcode the file name.
  J>          print("$KOUNTR.INP\n");
  J>          print "</body>\n</html>\n";
  J>          close(newfile);
  J>          # does not work...why???
  J>          unlink($KOUNTR.INP)
  J>          # works
  J>          unlink("75.inp")

first, put this after the broken (and all) unlinks
	unlink($KOUNTR.INP) or warn "can't unlink $KOUNTR.INP $!" ;

second, the suffix in the broken is INP while the hardcoded one is inp?
could that be the problem? it would definitely fail on any real
operating system. 

<snip of massive usenet diarrhea>

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Thu, 18 Nov 1999 11:30:41 +0100
From: "Frans" <frans.jonkers@ict.nl>
Subject: Determining user groups.
Message-Id: <810k9l$uoe$1@tasmania.dev.ict.nl>

For the Intranet site I'm currently working on, I want to identify to what
group the user that is logged in belongs. I want to use that information to
determine what information should be shown.

I know how to determine users and have already made a CGI script that
generates pages dynamically depending on the user name. However, to do this
for all possible users, is not only a lot of overhead, but very inflexible
as well, as users can change often.

If I could use groups instead I would not have these problems. The question
thus is: How can I do that? I didn't find any environment variables I could
check, but I might have overlooked something. Any solutions?

Kind regards,

Frans





------------------------------

Date: 18 Nov 1999 11:42:02 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Determining user groups.
Message-Id: <slrn837pha.1qp.mgjv@wobbie.heliotrope.home>

On Thu, 18 Nov 1999 11:30:41 +0100,
	Frans <frans.jonkers@ict.nl> wrote:
> For the Intranet site I'm currently working on, I want to identify to
> what group the user that is logged in belongs. I want to use that
> information to determine what information should be shown.
> 
> I know how to determine users and have already made a CGI script that

If you know how to 'determine' users, I suppose you know about the
getpwent functions?

# perldoc -f getpwent
[snip]
    ($name,$passwd,$uid,$gid,
                        ^^^^^
	       $quota,$comment,$gcos,$dir,$shell,$expire) = getpw*
[snip]

> generates pages dynamically depending on the user name. However, to do
> this for all possible users, is not only a lot of overhead, but very
> inflexible as well, as users can change often.

You are talking about real users, aren't you? As in people who have an
entry somewhere in NIS or the passwd file?

> If I could use groups instead I would not have these problems. The
> question thus is: How can I do that? I didn't find any environment
> variables I could check, but I might have overlooked something. Any
> solutions?

*dawn*

It looks like you aren't. You're talking about some protected CGI
script. Right?

This is not a perl issue at all. There is nothing perl specific about
that question. User authentication and group authentication on web
servers are an issue for the web server , the protocol and interfaces
and the specification alone. Not of any of the programming languages
that would need to interface with them.

You should probably ask this on one of the comp.infosystems.www.*
groups.

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd.   | later I can ask him what he meant -
NSW, Australia                  | Steven Wright


------------------------------

Date: Thu, 18 Nov 1999 11:20:23 +0100
From: "Andrew Longworth" <Andrew_Longworth@bigfoot.com>
Subject: Encryption
Message-Id: <3833d2ea@isoit370.bbn.hp.com>

Is there any sort of encryption available for perl?
If there is how secure is it?




------------------------------

Date: 18 Nov 1999 10:42:10 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Encryption
Message-Id: <3833d802_1@newsread3.dircon.co.uk>

Andrew Longworth <Andrew_Longworth@bigfoot.com> wrote:
> Is there any sort of encryption available for perl?
> If there is how secure is it?

I would take a look at the variety of implementations that are available
as modules from CPAN <http://www.cpan.org>

/J\
-- 
"How much fun can a girl have with a rabbit?" - Channel 4 Continuity
Announcer


------------------------------

Date: Thu, 18 Nov 1999 02:19:31 -0500
From: "Chris Collins" <cpcollin@wam.umd.edu>
Subject: environment vars
Message-Id: <8114fp$9b3$1@hecate.umd.edu>

I'm a sort of novice perl programmer.

I'm running a script to connect to Oracle through the web.  I believe I need
to set my ORACLE_SID and ORACLE_HOME environment variables in my perl script
because I believe when it's executed via the browser, the program is
actually run in some kind of pseudo shell and therefore my .cshrc is not
executed.  Is there a special way to set environment variables?  here's a
small version of my script:  It works when run straight, however it never
gets to the test message after the DB connect.

you can contact me at cpcollin@wam.umd.edu
thanks


#!/usr/bin/perl

use DBI;
use Env;
use Env qw(WWW_myquery);


$dbname = 'NAME';
$user = 'USER';
$password = 'PASS';
$dbd = 'Oracle';

        print("content-type: text/html\n\n");
        print("<head>\n");
        print("<title>Fantasy Football testing</title></head>\n");
        print("<body bgcolor=\"white\">");
        print ("The query is $WWW_myquery<hr>");

$dbh = DBI->connect ($dbname, $user, $password, $dbd);
if (!$dbh) {
        print "Error connecting to database; $DBI::errstr\n";
}
printf ("Made it here.<br>");

$cur = $dbh->prepare('select Fname, Lname from Kicker');
$cur->execute();
die "Prepare error: $DBI::errstr" if $DBI::err;
while (($Fname, $Lname) = $cur->fetchrow) {
        print "First Name: $Fname, Last Name: $Lname <br>";
}
$cur->finish();

        print("</body></html>");





------------------------------

Date: Thu, 18 Nov 1999 17:05:33 +0100
From: "Jakob" <asd@ds.aw>
Subject: Re: environment vars
Message-Id: <8118jj$p9c@sdaw04.seinf.abb.se>

Or you might be a nice guy and tell him.

I use it in a couple of my scripts ...

Go like :

$ENV{SYBASE}="/opt/sybase/SQL/current/";

there you go, not that hard ey ?


Rgrds



Jakob

>
> Read about the global hash %ENV in the perlvar manpage.  Alternatively
> your web server may have some way of setting environment variables for
> its child processes but you will need to take that up with the
> documentation for web server.
>
> /J\
> --
> "Philippa Forrester, presenter and would-be Smurf" - Howard Stableford,
> Tomorrow's World




------------------------------

Date: 18 Nov 1999 15:25:55 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: environment vars
Message-Id: <38341a83_2@newsread3.dircon.co.uk>

Chris Collins <cpcollin@wam.umd.edu> wrote:
> I'm a sort of novice perl programmer.
> 
> I'm running a script to connect to Oracle through the web.  I believe I need
> to set my ORACLE_SID and ORACLE_HOME environment variables in my perl script
> because I believe when it's executed via the browser, the program is
> actually run in some kind of pseudo shell and therefore my .cshrc is not
> executed.  Is there a special way to set environment variables?  here's a
> small version of my script:  It works when run straight, however it never
> gets to the test message after the DB connect.
> 
> you can contact me at cpcollin@wam.umd.edu
> thanks
> 
> 

Read about the global hash %ENV in the perlvar manpage.  Alternatively
your web server may have some way of setting environment variables for
its child processes but you will need to take that up with the
documentation for web server.

/J\
-- 
"Philippa Forrester, presenter and would-be Smurf" - Howard Stableford,
Tomorrow's World


------------------------------

Date: 18 Nov 1999 16:12:03 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: environment vars
Message-Id: <38342553_1@newsread3.dircon.co.uk>

Jakob <asd@ds.aw> wrote:
> Or you might be a nice guy and tell him.
> 

I did.

> I use it in a couple of my scripts ...
> 
> Go like :
> 
> $ENV{SYBASE}="/opt/sybase/SQL/current/";
> 

But he wasnt talking about $ENV{SYBASE}

> there you go, not that hard ey ?
> 

What does that achieve. He cut and paste that from here and it doesnt work
because it isnt the variable he wants to set he comes back and asks again.

He reads about the %ENV hash in perlvar and he then understands it and
will be able to solve further problems when they arise ..

*plonk*

/J\
-- 
"I must call a man in - I want to get felt laid down in the loft" -
Graham Norton


------------------------------

Date: Thu, 18 Nov 1999 17:15:46 +0100
From: "Jakob" <asd@ds.aw>
Subject: Re: environment vars
Message-Id: <81196o$jee@sdaw04.seinf.abb.se>

Or he has a brain of his own, my point is, instead of doing what everbody
seems to do in this forum redirect the poor bastards to some FAQ or
something
like that, give him a hint AND inform him about where he can read more about
it.

/ J
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:38342553_1@newsread3.dircon.co.uk...
> Jakob <asd@ds.aw> wrote:
> > Or you might be a nice guy and tell him.
> >
>
> I did.
>
> > I use it in a couple of my scripts ...
> >
> > Go like :
> >
> > $ENV{SYBASE}="/opt/sybase/SQL/current/";
> >
>
> But he wasnt talking about $ENV{SYBASE}
>
> > there you go, not that hard ey ?
> >
>
> What does that achieve. He cut and paste that from here and it doesnt work
> because it isnt the variable he wants to set he comes back and asks again.
>
> He reads about the %ENV hash in perlvar and he then understands it and
> will be able to solve further problems when they arise ..
>
> *plonk*
>
> /J\
> --
> "I must call a man in - I want to get felt laid down in the loft" -
> Graham Norton




------------------------------

Date: 18 Nov 1999 11:57:45 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: environment vars
Message-Id: <x7iu2zspo6.fsf@home.sysarch.com>

>>>>> "J" == Jakob  <asd@ds.aw> writes:

  J> Or he has a brain of his own, my point is, instead of doing what
  J> everbody seems to do in this forum redirect the poor bastards to
  J> some FAQ or something like that, give him a hint AND inform him
  J> about where he can read more about it.

because it has been proven that most newbies will only do the cut and
paste and won't grok what is being done. you are new here and are
already generating killfile entries. like all others before you who have
tried to do this and failed you don't get the dymamics of this group. i
challenge you to answer each newbie question (especially ALL FAQs) with
the correct answer as well as leads to the appropriate documentation.

i triple dog dare you to do it!! chicken!!! ha hah ha ha!! i bet you
won't last a microsecond.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1418
**************************************


home help back first fref pref prev next nref lref last post