[25685] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7926 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 30 06:05:41 2005

Date: Wed, 30 Mar 2005 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 30 Mar 2005     Volume: 10 Number: 7926

Today's topics:
    Re: function privileges <No_4@dsl.pipex.com>
    Re: How to access Windows IIS User Info with Perl <No_4@dsl.pipex.com>
    Re: How to access Windows IIS User Info with Perl <page.nix@gmail.com>
    Re: How to access Windows IIS User Info with Perl <1usa@llenroc.ude.invalid>
    Re: How to access Windows IIS User Info with Perl <ThomasKratz@REMOVEwebCAPS.de>
        I was an asshole. I apologize. <infos@leocharre.com>
        launching a Perl script .... <wdflannery@aol.com>
    Re: launching a Perl script .... <jurgenex@hotmail.com>
    Re: launching a Perl script .... <andrew@bryson.co.nz>
    Re: Log files in a Date / Time Stamped Directory <joe@inwap.com>
    Re: problem with old version of (Active) Perl xhoster@gmail.com
        Pulling hair out with pattern matching <dillon@SpamMinuSaccessdenied.darktech.org>
    Re: Pulling hair out with pattern matching <notvalid@email.com>
    Re: Pulling hair out with pattern matching <dillon@SpamMinuSaccessdenied.darktech.org>
        regexp compilation alythh@netscape.net
    Re: Subroutine paramater question <ebohlman@omsdev.com>
    Re: Using a for() statement to create a variable?? <lawshouse.public@btconnect.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Mar 2005 00:28:06 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: function privileges
Message-Id: <IMudnf2MDJAfedTfRVnyrw@pipex.net>

Mr Bob wrote:
 >
> Hi, I'm wanting a user script to use Net::Ping to send an icmp packet but 
> can't because of privileges, is there anyway I can get around this?. 

1) run as root
2) use UDP instead.  You should get back an ICMP unreachable packet if the 
target is down, but whether that works depends on the route betweeen target 
and host - try it and see.


-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


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

Date: Wed, 30 Mar 2005 00:39:36 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: How to access Windows IIS User Info with Perl
Message-Id: <9bmdndY7E6ypetTfRVnyuA@pipex.net>

BigNin wrote:
 >
> In our IT department's infinite wisdom, they have moved us to a Windows
> 2003 server running IIS.  I've made the modifications to my script so
> that it runs, but the IIS server is configured for Windows
> Authentication.

    You think MS Windows would allow any choice?

>                 The IT department states that this allows users to
> login into the network when they first turn on their PC and then the
> users don't have to enter any additional usernames or passwords to
> authenticate with IIS and my script.

    So they login, walk away and anyone else walking past has full access 
to all Web sites as them.   Odd why some people see single sign-on as secure...

> My administrators gave me some ASP code that supposedly can do what I
> want, but that doesn't really help me do it in perl. 

    Can you get the login id?  If you can, then you shoudl be abel to query 
ActiveDirectory using the Net::LDAP modules to look up group membership.
But until you get the login id then you can't do anything.  I suppose its 
too much to expect IIS to set an environment variable?  (That is part of 
the CGI standard, but no idea whether MS adhere to any standards here).

>         de.Password =
> Configuration.ConfigurationSettings.AppSettings("Pass")

    The Web server allows you to read users MS passwords???



-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


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

Date: 29 Mar 2005 17:31:25 -0800
From: "BigNin" <page.nix@gmail.com>
Subject: Re: How to access Windows IIS User Info with Perl
Message-Id: <1112146285.087096.206560@z14g2000cwz.googlegroups.com>


Big and Blue wrote:
> BigNin wrote:
>  >
> > In our IT department's infinite wisdom, they have moved us to a
Windows
> > 2003 server running IIS.  I've made the modifications to my script
so
> > that it runs, but the IIS server is configured for Windows
> > Authentication.
>
>     You think MS Windows would allow any choice?

I'm certainly not an IIS expert, in fact, I've only played around with
it now for 2 days, but I did notice under the security options that it
allowed for Basic Authentication, Windows Authentication (or whatever
they called it), and one or two other options.  It looks like our
administrators are not giving us any options though.  We must use the
Windows based one.

>
> >                 The IT department states that this allows users to
> > login into the network when they first turn on their PC and then
the
> > users don't have to enter any additional usernames or passwords to
> > authenticate with IIS and my script.
>
>     So they login, walk away and anyone else walking past has full
access
> to all Web sites as them.   Odd why some people see single sign-on as
secure...

You're preaching to the choir here.  We've been through this before.
It is the general opinion here that all users are supposed to lock
their workstations when they leave them and in fact the machines lock
themselves after 15 min of inactivity.  Albeit flawed, this is the best
option available to us for a few reasons.  For starters, most users
tell their browser to remember their username and password anyway, so
it wouldn't matter if they logged out of the application.  But more
importantly, the data viewed through this application is data that can
be obtained via a printed report that many people receive.  This means
that if I really wanted to steal the information, I just need to walk
up to someone's desk when they aren't there and grab the report, so
security in the case of this application is more for logging of who is
reading what and when and not so much a matter of keeping someone out.

>     Can you get the login id?  If you can, then you shoudl be abel to
query
> ActiveDirectory using the Net::LDAP modules to look up group
membership.
> But until you get the login id then you can't do anything.  I suppose
its
> too much to expect IIS to set an environment variable?  (That is part
of
> the CGI standard, but no idea whether MS adhere to any standards
here).

Thanks.  I'll do some testing and look into grabbing the id.  I'm
hoping that the REMOTE_USER variable is indeed available.  I'm
unfamiliar with the Net::LDAP modules, so I'll have to read up on those
and see how they work.  Do you know if they are part of a standard
ActiveState Perl install?  If not, I'll have to get the admins to
install it.

>
> >         de.Password =
> > Configuration.ConfigurationSettings.AppSettings("Pass")
>
>     The Web server allows you to read users MS passwords???
>

It looks that way from the code, but I sure hope not.  The ASP code
that I included was emailed to me from one of the admins and I haven't
tested it.  It wasn't intended for me to necessarily run it... more as
a guideline to help me figure out how I would accomplish the same thing
in perl.



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

Date: Wed, 30 Mar 2005 02:27:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to access Windows IIS User Info with Perl
Message-Id: <Xns9628DA5D37F88asu1cornelledu@127.0.0.1>

"BigNin" <page.nix@gmail.com> wrote in
news:1112146285.087096.206560@z14g2000cwz.googlegroups.com: 

> I'm unfamiliar with the Net::LDAP modules, so I'll have to read 
> up on those and see how they work.  Do you know if they are part 
> of a standard ActiveState Perl install?  If not, I'll have to get 
> the admins to install it.

Well, first off, good luck.

Second, MSDN might have detailed information on what information is 
supplied to your script when running under Windows authentication.

As for module installation, the following FAQ entry might be useful:

perldoc -q lib

at least when you are testing.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Wed, 30 Mar 2005 11:06:42 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: How to access Windows IIS User Info with Perl
Message-Id: <424a6c22$0$825$bb690d87@news.main-rheiner.de>

BigNin wrote:
> I have a Perl script which runs on a Unix server with Apache as the
> http server.  With the use of an .htaccess file, only users that login
> with basic authentication are able to run the script.  This script is
> only available on the intranet so it's internal company use only.  The
> perl script compares the authenticated username with a text file which
> contains groups to which certain employees belong and serves different
> HTML depending on the user's group memberships.
> 
> In our IT department's infinite wisdom, they have moved us to a Windows
> 2003 server running IIS.  I've made the modifications to my script so
> that it runs, but the IIS server is configured for Windows
> Authentication.  The IT department states that this allows users to
> login into the network when they first turn on their PC and then the
> users don't have to enter any additional usernames or passwords to
> authenticate with IIS and my script.  My group text file has now been
> converted to Windows security groups.
> 
> I have searched HotScripts.com, ActiveState.com, and Google and I can
> not find any example of how to get perl to read Windows security groups
> and tell me which ones the user belongs to.  I'm guessing that someone
> somewhere has done this before.
> 
> My administrators gave me some ASP code that supposedly can do what I
> want, but that doesn't really help me do it in perl.  For reference, I
> have included it below:

[snipped horrable ASP code]

try this:

use strict;
use warnings;

use Win32::OLE qw/in/;
   Win32::OLE->Option(Warn => 1);

my($domain, $user) = @ARGV;

my $path = "WinNT://$domain/$user";

my $o_user = Win32::OLE->GetObject($path) or die Win32::LastErr();

foreach my $group ( in($o_user->Groups()) ) {
	print $group->Name, "\n";
}

Thomas

-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

Date: Wed, 30 Mar 2005 01:29:11 GMT
From: Jean Paul Sartre <infos@leocharre.com>
Subject: I was an asshole. I apologize.
Message-Id: <pan.2005.03.30.02.29.13.242416@leocharre.com>

I was an asshole. I apologize.
I haven't spammed before. 
I am honestly a developer/ designer. Or was until I sinned.
I'm sorry. I was an asshole.
I don't mean to offend the community, and I realize that's what I did.

ean Paul Sartre <infos [at] leocharre.com> wrote in
news:pan.2005.03.15.21.34.38.703201 [at] leocharre.com:

> I found a solution to my problem. This <a
> href="http://b3thm00n.com/scripting/index_gallery/">perl thumbnail
> automatic gallery</a> is quick and instant to install. It looks kind of
> simple though. I could work on it some more, maybe change it.
> JPS

Hi Leo:

If you want people to comment on various parts of your script, then
solicit advice openly.

If you just want to announce the availability of your script, this is not
the place to do it.

To announce it in this "stealth" manner is called spamming.

Sinan.


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

Date: 29 Mar 2005 19:06:13 -0800
From: "joesplink" <wdflannery@aol.com>
Subject: launching a Perl script ....
Message-Id: <1112151973.313753.204350@z14g2000cwz.googlegroups.com>

I can launch a Perl script when a user clicks a submit button on a
form...... and I can launch a Perl script when a user clicks on a
link..... but..... can I launch Perl script A from Perl script B ????

The reason it seems like a good idea is that script B puts up a
form.... and the form potentially needs to be brought up at various
points in a session, and I'd like to do it in one place.....


Thanks in advance,
Will



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

Date: Wed, 30 Mar 2005 04:04:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: launching a Perl script ....
Message-Id: <Jzp2e.27885$191.5298@trnddc02>

joesplink wrote:
> I can launch a Perl script when a user clicks a submit button on a
> form...... and I can launch a Perl script when a user clicks on a
> link

Well, the most ordinary way to launch a Perl script is by simply typing its 
name on the command line and hitting ENTER.

>..... but..... can I launch Perl script A from Perl script B ????

Is there anything wrong with system() or exec() or backticks?

jue 




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

Date: Wed, 30 Mar 2005 16:13:20 +1200
From: Andrew Bryson <andrew@bryson.co.nz>
Subject: Re: launching a Perl script ....
Message-Id: <424a27dd@clear.net.nz>

joesplink wrote:

> I can launch a Perl script when a user clicks a submit button on a
> form...... and I can launch a Perl script when a user clicks on a
> link..... but..... can I launch Perl script A from Perl script B ????
> 
> The reason it seems like a good idea is that script B puts up a
> form.... and the form potentially needs to be brought up at various
> points in a session, and I'd like to do it in one place.....

What I usually do in cases like this is have a library file containing all
common subroutines etc and then just load that at the beginning of each
program with require. Then you can make a subroutine that returns the form
(or at least the non-changing parts of the form) and just call it.

If doing this, make sure that your library file returns 1 when it is loaded
with require. The easiest way to do this is to ensure that the last piece
of code within it is

1;

Or if you want you can create a package :-).

Hope this helps

Andrew Bryson
http://www.bryson.co.nz




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

Date: Wed, 30 Mar 2005 01:19:31 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Log files in a Date / Time Stamped Directory
Message-Id: <GLqdnWYTIoa38tffRVn-hQ@comcast.com>

Manzoorul Hassan wrote:
> well, I was thining this would be similar to Files - if it doesn't
> exist, create it.

But opening a file for reading does *not* create it.
(You have to open a file for writing or appending to create it.)
Therefore opening a directory for reading is very much like
opening a file for reading - the thing being read has to exist first.

> But  I guess Directories don't work the same way :o(

Of course not - they are two different things.
	-Joe


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

Date: 29 Mar 2005 23:17:52 GMT
From: xhoster@gmail.com
Subject: Re: problem with old version of (Active) Perl
Message-Id: <20050329181752.093$1P@newsreader.com>

k9boy@hotmail.com wrote:
> I wrote the code on my local machine, which runs ActivePerl 5.8. The
> machine that will use this code runs ActivePerl 5.6. Part of the code
> opens up a large file (>85MB), substitute string values line by line,
> then writes it to another file. Surprisingly, this part of the code
> quits after reading about 10MB when running on version ActivePerl 5.6.

Any error messages?  exit status?  If you add an END block, does it get
executed before the program "quits"?  Do you need to binmode the files?

Xho

> This alone causes the problem:
>
>         $origfile = "C:\\dir\\file.a";
>         $newfile = "C:\\dir\\file.b";
>
>         open INF, $origfile or die $!;
>         open OUTF, ">$newfile" or die $!;
>         while(<INF>) {
>                 print OUTF $_;
>         }
>         close INF;
>         close OUTF;
>
> I can't get Perl upgraded without quite some difficultly, so does
> anyone know what might be causing this problem?
>
> Thanks in advance.

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 30 Mar 2005 13:49:37 +0800
From: AcCeSsDeNiEd <dillon@SpamMinuSaccessdenied.darktech.org>
Subject: Pulling hair out with pattern matching
Message-Id: <ftek41ddl3ai1f0kvtnfm3i5rj7gmq6lfe@4ax.com>

$string=qq|<ahref="/fggfd/ra/client/getPolOwnerList.do?startWith=*&selectedUnitID=5445&selectedAdvID=95456&sid=gfhfghfh"|;

	if ($string =~ m/getPolOwnerList.do?startWith=*/)  {

		print $string;

	}


This doesn't work. 
It seems anything after the '?' in the pattern match is causing problems because this works:


if ($string =~ m/getPolOwnerList.do?/)  {


Any clues to what is wrong?
I'm using perl  v5.6.1 built for MSWin32-x86-multi-thread.

Thanks



To e-mail, remove the obvious


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

Date: Wed, 30 Mar 2005 05:58:56 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: Pulling hair out with pattern matching
Message-Id: <Aer2e.4568$FN4.569@newssvr21.news.prodigy.com>

AcCeSsDeNiEd wrote:
> $string=qq|<ahref="/fggfd/ra/client/getPolOwnerList.do?startWith=*&selectedUnitID=5445&selectedAdvID=95456&sid=gfhfghfh"|;
> 
> 	if ($string =~ m/getPolOwnerList.do?startWith=*/)  {

The question mark, asterisk and dot are special in regular expressions 
and must be backslashed if you want to match them literally. Please read 
'perlre' for more information on Perl's regular expressions.

--Ala



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

Date: Wed, 30 Mar 2005 14:20:22 +0800
From: AcCeSsDeNiEd <dillon@SpamMinuSaccessdenied.darktech.org>
Subject: Re: Pulling hair out with pattern matching
Message-Id: <f6gk419sdker336uhvi5meh779r6d92a7j@4ax.com>

Ok, I don't understand why I always end up finding a solution after posting for help.

This works:

if ($string =~ m/getPolOwnerList.do\?startWith=*/)  {


add '\' in front of ?


On Wed, 30 Mar 2005 13:49:37 +0800, AcCeSsDeNiEd <dillon@SpamMinuSaccessdenied.darktech.org> wrote:

>$string=qq|<ahref="/fggfd/ra/client/getPolOwnerList.do?startWith=*&selectedUnitID=5445&selectedAdvID=95456&sid=gfhfghfh"|;
>
>	if ($string =~ m/getPolOwnerList.do?startWith=*/)  {
>
>		print $string;
>
>	}
>
>
>This doesn't work. 
>It seems anything after the '?' in the pattern match is causing problems because this works:
>
>
>if ($string =~ m/getPolOwnerList.do?/)  {
>
>
>Any clues to what is wrong?
>I'm using perl  v5.6.1 built for MSWin32-x86-multi-thread.
>
>Thanks
>
>
>
>To e-mail, remove the obvious


To e-mail, remove the obvious


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

Date: 30 Mar 2005 02:50:07 -0800
From: alythh@netscape.net
Subject: regexp compilation
Message-Id: <1112179807.727627.162020@o13g2000cwo.googlegroups.com>


hi all - I'm having some troubles, that seem related to regexp
compilation.

Trying to use the WordNet::SenseRelate module, I get a lot of errors
like the following:

Use of uninitialized value in regexp compilation at
/usr/lib/perl5/site_perl/5.6.1/WordNet/SenseRelate.pm line 1109, <SFH>
line 1.
 ...

the incriminated line is:
sub _loadStoplist
{
    my $self = shift;
    my $file = shift;
    open SFH, '<', $file or die "Cannot open stoplist $file: $!";
    $stoplist{$self} = [];
    while (my $line = <SFH>) {
        chomp $line;
        $line =~ m|/(.*)/|;
        push @{$stoplist{$self}}, qr/$1/;   # <<<<< LINE1109
    }
    close SFH;
}

 ... so $1 comes from a previous pattern match on lines read from a file
at runtime.
I'm not at all an expert in quote-like operators, so I'm not able to
debug this problem - anybody can help ?

thanks1

Alessandro Magni



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

Date: 30 Mar 2005 03:27:16 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Subroutine paramater question
Message-Id: <Xns9628DB858A035ebohlmanomsdevcom@130.133.1.4>

Jeff <Im.so.HuckinFappy@spamgourmet.com> wrote in
news:d24bs4$h6l7@xco-news.xilinx.com: 

> Then be more explicit about your parameters.  What you're doing is 
> called positional parameters, and is a fine option for simpler code.
> But when you start having multiple optional parameters, you run into 
> problems, as you have found.  What you may wish to consider is named 
> parameters, which uses a hash:
> 
> sub MyText
> {
>     my %args = @_;
>     my $message = $args{ message } || 'No Message given';
>     my $size    = $args{ size } || 'No size Given';
>     my $color   = $args{ color } || 'Red...No, Blue!'
> }

Better IMHO:

my %args=(
  message => 'No Message given',
  size => 'No size Given',
  color => 'Red...No, Blue!',
  @_
);

and then just refer to $args{whatever} rather than assigning to 
variables.  This takes advantage of the fact that when a hash is 
initialized from a list that contains duplicate keys, the last ones 
"win."



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

Date: Wed, 30 Mar 2005 08:03:25 +0100
From: Henry Law <lawshouse.public@btconnect.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <gdjk41pe3aav0akc9cmv83aggn34bvut3l@4ax.com>

On 26 Mar 2005 16:04:11 -0800, "robic0@yahoo.com" <robic0@yahoo.com>
wrote:

>I suggest you not mention "kill" as an attribute within your reply.
>Should you feel the need
>to kill someone, I suggest you consult proffessional help immediatly.
>In America, we do not
>take kindly to threats from individuals from foreign countries. Your
>time may well be better
>spent mastering english and gaining insite on American culture.

Hey, Robic0, I have to thank you for providing me with several minutes
of fun, catching up with the newsgroup this morning.  Far from
killfiling you (I guess you know what that means now) I've actually
been searching the group for your posts.  The technical ones aren't
very interesting: they're rather obscure and from the reactions of the
Perl mavens here I suspect they're not very accurate; but the
non-technical ones like this are a hoot.  

The way you assume that Google is the same as USENET, and that the
group is a "site", and that the whole thing is in some way "owned" by
the USA and that everyone with a European or Asian name is therefore a
"foreigner" and to be deprecated in some way ... you provide more and
more fun with each thread.  And the myopic pomposity you manage to get
into every post just cracks me up.  Thanks.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 7926
***************************************


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