[8733] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2350 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 17 14:07:29 1998

Date: Fri, 17 Apr 98 11:00:36 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 17 Apr 1998     Volume: 8 Number: 2350

Today's topics:
    Re: .= so why not =. ? <upsetter@shore.net>
    Re: Array / List question <jdf@pobox.com>
    Re: Array / List question <danboo@negia.net>
    Re: Can someone give me an example of rounding! (susan cassidy)
    Re: commenting a whole block? <johnnie@holly.colostate.edu>
    Re: Content-Length with mailx <dbcoder@juno.com>
        DBI::ODBC, Win32 Access97 and Data Types <julianje@iname.com>
    Re: How can i see if a proc/prog is running <andrewf@cp.pathfinder.com>
    Re: How to get only 2 decimal notation? (tony)
    Re: how to remove blanks? <johnnie@holly.colostate.edu>
    Re: how to remove blanks? <samiss@cc.tut.fi>
    Re: launching external program on W95 <dtbaker_@flash.net>
    Re: Multi-tasking/threading <zenin@archive.rhps.org>
    Re: Multi-tasking/threading <bsugars@canoe.ca>
    Re: Multi-tasking/threading <zenin@archive.rhps.org>
    Re: MULTIPLICITY crash: HELP!!! <bsugars@canoe.ca>
    Re: Perl Oddity <grinch@whoville.com>
    Re: Problem executing without using: Perl foo.pl <jdf@pobox.com>
    Re: shorten array <johnnie@holly.colostate.edu>
        Snobby news group <dbcoder@juno.com>
        srand and rand fx <marco@nbnet.nb.ca>
        Using Win32::NetAdmin:UserCreate <Scott_LeWarne@BigFoot.com>
    Re: Using Win32::NetAdmin:UserCreate <Scott_LeWarne@BigFoot.com>
        What does "Illegal modulus zero" mean? <ian@lynagh.demon.co.uk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 17 Apr 1998 15:48:30 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: .= so why not =. ?
Message-Id: <6h7tke$kd5@fridge.shore.net>

Abigail <abigail@fnx.com> wrote:

: Uh, if foobar offends you, perhaps you shouldn't play with the grownups.

Thanks for that helpful contribution to the discussion.

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

Date: 17 Apr 1998 11:58:56 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Array / List question
Message-Id: <soncz8of.fsf@mailhost.panix.com>

"Kevan Granat" <kevan@nol.net> writes:

> to modify all elements of an array w/o a loop, the camel book (1st ed,
> p221)
> suggests:
> 
> grep($_ *= 2, @Array) ;

The use of grep in void context is now officially considered harmful.
Please use foreach instead.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Fri, 17 Apr 1998 11:31:46 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Array / List question
Message-Id: <353775E2.CC008638@negia.net>

Kevan Granat wrote:
> 
> I'm not sure if this option was posted yet...
> to modify all elements of an array w/o a loop, the camel book (1st ed,
> p221)
> suggests:
> 
> grep($_ *= 2, @Array) ;
> 
> which is quite handy, I think, for s/// operations...
> 
> grep(s/this/that/g, @Array) ;
> 
> Note that @Array only includes the elements that had a successful
> substitution, though.  Sometimes you have to use:
> 
> grep(s/this/that/g || 1, @Array) ;
> 
[SNIP]

huh? this:

@foo = qw( potato monkey rutabaga hat );
@bar = grep(s/a/z/g, @foo);
print "foo: @foo\n";
print "bar: @bar\n";

prints:

foo: potzto monkey rutzbzgz hzt
bar: potzto rutzbzgz hzt

i think your confusing things with the return list of grep. grep will
_alter_ the elements in the source list, but it doesn't remove those
that don't pass the test. elements are dropped from the _return list_
if the substitution fails.

hope this clarifies,

-- 
dan boorstein


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

Date: 17 Apr 1998 06:17:12 -0700
From: susanc@news.SanDiegoCA.ncr.COM (susan cassidy)
Subject: Re: Can someone give me an example of rounding!
Message-Id: <6h7koo$1iq@ssd3450.SanDiegoCA.NCR.COM>

In article <6h3avu$gfb$1@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>susan cassidy (susanc@news.SanDiegoCA.ncr.COM) wrote on MDCLXXXVIII
>September MCMXCIII in <URL: news:6h2b3h$qth@ssd3450.SanDiegoCA.NCR.COM>:
>++ 
>++ Just a caveat, I have seen many postings in this news group recommending
>++ that people use sprintf/printf to round numbers.  Sprintf/printf will not,
>++ by themselves round anything.  They will truncate, which is entirely 
>++ different.  Normally you have to add half of the rightmost decimal 
>++ position to round to one less position.  E.g. if you have a number like
>++ 12.16, and you want to round to 12.2, you have to add .005 before
>++ truncating to 1 position after the decimal.
>
>
>Did you actually *try* this out?
>
>You are wrong, twice.
>
>Observe:
>
>     $ perl -we 'printf "%3.1f\n", 12.16'
>     12.2
>     $ echo "12.16 + 0.005" | bc -l
>     12.165
>
>Abigail

Yes, I made a mistake.  First, as I told Tom, I was thinking of
another language that does not round.  Second, I did not explain
what I meant to say correctly, and also wrote .005, instead
of .05.  I did test my solution, but it worked because perl did the
truncation.

I guess I was having a bad day.  Sorry.

-- 
Susan Cassidy
Remove xxx in replyto address when replying.


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

Date: Fri, 17 Apr 1998 10:11:30 -0600
From: John Blanco <johnnie@holly.colostate.edu>
To: Ji Huang <jonhuang@romulus.rutgers.edu>
Subject: Re: commenting a whole block?
Message-Id: <35377F32.B62B2DE2@holly.colostate.edu>

Ji Huang wrote:

> , but in perl i have to put # sign at the beginning of each line of
> the
> block.
>
> Is there any easier way for me to do it?

Like this...

print "I am the ";
print "original code!\n";

make it:

if(0) {
print "I am the ";
print "original code!\n";
}




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

Date: Fri, 17 Apr 1998 10:02:07 -0700
From: "Database Coder" <dbcoder@juno.com>
Subject: Re: Content-Length with mailx
Message-Id: <6h8249$67q$1@news.scruz.net>

Thanks for your help!

>What does this have to do with perl?
>
>Your question would be more appropriate in rec.furniture; after all,
>you are likely to sit on a chair while coding. And if your computer has
>a mouse, don't forget to crosspost to rec.pets.rodents.
>
>
>
>Abigail
>--
>perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'




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

Date: Fri, 17 Apr 1998 16:09:25 GMT
From: "Jere C. Julian" <julianje@iname.com>
Subject: DBI::ODBC, Win32 Access97 and Data Types
Message-Id: <35377E48.D1F85099@iname.com>

I am reading fixed record info ftp'd from another machine and updating an
Access DB.  I get the following error on updates to an Access97 Table.  The
problem in in the LINENO field which Access has as an integer.  I can insert
records but updates fail.  Please help!  Is there an attribute I need to set
somewhere?

Error as follows:
[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria
expression. (SQL-22005)(DBD: st_execute/SQLExecute err=-1) at mk.bat line 29,
<DATA> chunk 1.


Perl Code:
require 5.004;
use DBI 0.89;
open(DATA, "<phone1") || die "Can't open input file\n";
$dbh = DBI->connect('dbi:ODBC:IVR_phone1', '', '', { RaiseError => 1 });

###### Does Not Work ######
$updateh = $dbh->prepare("UPDATE OrderStatus SET SOLDTO = ?, CPYCDE = ?, STATCD
= ?, DTEPRM = ?, WONUM = ?, SHPDTE = ?, UPDTDTE = ?, UPDTTIM = ? WHERE LINENO =
? and ordnbr = ?");

###### Works ######
$updateh = $dbh->prepare("UPDATE OrderStatus SET SOLDTO = ?, CPYCDE = ?, STATCD
= ?, DTEPRM = ?, WONUM = ?, SHPDTE = ?, UPDTDTE = ?, UPDTTIM = ? WHERE LINENO =
2 and ordnbr = ?");

$inserth = $dbh->prepare("INSERT INTO OrderStatus (ORDNBR, LINENO, SOLDTO,
CPYCDE, STATCD, DTEPRM, WONUM, SHPDTE, UPDTDTE, UPDTTIM) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?)");

while (<DATA>) {
 chop;
 undef @field;
  @field = unpack("A10 A2 A6 A2 A1 A10 A8 A10 A10 A8", $_);
###### Tried both below... neither helps. ######
#  $field[1] = int($field[1]);
  $field[6] = int($field[6]);
#### Line 29 below ####
 $updateh->execute($field[2], $field[3], $field[4], $field[5], $field[6],
$field[7], $field[8], $field[9], $field[1], $field[0]);
 if ($updateh->rows == 0) {
  $inserth->execute($field[0], $field[1], $field[2], $field[3], $field[4],
$field[5], $field[6], $field[7], $field[8], $field[9]);
 }
}

--
   +----------------------------------------------------------------------+
   | Jere C Julian          PO Box 100, 166 Teague Town Rd.  828-495-2304 |
   | Network Administrator  Hickory, NC 28601           Fax: 828-495-2260 |
   | LADD Upholstery Group: Barclay-Clayton Marcus-Pennsylvania House     |
   | mailto:julianje@iname.com              http://www.laddfurniture.com/ |
   +----------------------------------------------------------------------+




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

Date: Fri, 17 Apr 1998 12:58:24 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: How can i see if a proc/prog is running
Message-Id: <Pine.GSO.3.95.980417125527.20815B-100000@cp.pathfinder.com>

On Fri, 17 Apr 1998, Torfinn K=E5ringen wrote:

> Hy
> How can i see if an process is running on an Win95/NT, something like
>=20
> ps -ef | grep process_to_look_for

There are Cygnus Unix-like tools at www.cygnus.com.

Otherwise, this question is best posted in an NT newsgroup since they'd
better be able to help you.

-------------------------------------------------------------
Andrew F. Lee                 |                              |
Software Engineer             |  parenttime.com              |
email: andrewf@pathfinder.com |  1271 Avenue of the Americas |
Phone: (212) 522-2769         |  New York, N.Y. 10020        |
-------------------------------------------------------------
        When I say, "Ignore the man behind the curtain."  =20
        That is because there is no man behind the curtain.



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

Date: Sat, 18 Apr 1998 02:51:52 +1000
From: td@lavalink.com.au (tony)
Subject: Re: How to get only 2 decimal notation?
Message-Id: <td-1804980251520001@mtterror.lavalink.com.au>


> 
> Huh?  Sprintf does round:
> 
> perl -e 'print sprintf("%.2f\n", 1.249)'
> 1.25
> perl -e 'print sprintf("%.2f\n", 1.241)'
> 1.24
> 

Any ideas of what to use if your number has leading zeros?

perl -e 'print sprintf("%.2f\n", 00.000)'
0.00
perl -e 'print sprintf("%.2f\n", 01.000)'
10.00
perl -e 'print sprintf("%.2f\n", 01.999)'
1999.00
perl -e 'print sprintf("%.2f\n", 10.999)'
11.00


Tony D.


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

Date: Fri, 17 Apr 1998 10:18:30 -0600
From: John Blanco <johnnie@holly.colostate.edu>
To: akogan <akogan@radiology.nwu.edu>
Subject: Re: how to remove blanks?
Message-Id: <353780D6.E89D98B5@holly.colostate.edu>

akogan wrote:

> Hi!
> Can anyone tell me how to remove preceding and trailing spaces in a
> string variable?

$string = "       damn spaces!      ";
($string) = ($string =~ /^\s*(.*?)\s*$/);

With this, spaces on the end and beginning are matched, with the minimal
text in the middle captures. (with the ?)  I suspect their might be an
easier way.

   - Johnnie B



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

Date: 17 Apr 1998 20:04:40 +0300
From: Sami Sandqvist <samiss@cc.tut.fi>
Subject: Re: how to remove blanks?
Message-Id: <m3hg3swf9z.fsf@ehdo.ton.tut.fi>

John Blanco <johnnie@holly.colostate.edu> writes:

> akogan wrote:
> 
> > Hi!
> > Can anyone tell me how to remove preceding and trailing spaces in a
> > string variable?
> 
> $string = "       damn spaces!      ";
> ($string) = ($string =~ /^\s*(.*?)\s*$/);
> 
> With this, spaces on the end and beginning are matched, with the minimal
> text in the middle captures. (with the ?)  I suspect their might be an
> easier way.

Yes, there is. You seem to be unfamiliar with the s///-operator.

Also, this is a FAQ. The easiest way is
	$string =~ s/^\s*(.*?)\s*$/$1/;
but doing
	$string =~ s/^\s+//;
	$string =~ s/\s+$//;
is faster.

The FAQ can be found at http://www.perl.com/CPAN/

Sami
-- 
#!/bin/perl -w
$_="17601114363329121422010036040100073622335669010008"; $a=q #Magic?#;
grep/Perl!/,sort("J".."h");print"Sami Sandqvist - samiss@cc.tut.fi";s/k/u/g;
@b=split//,$a; s/(\d\d)/$b[$1]/eg;print"$_\n";


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

Date: Fri, 17 Apr 1998 11:04:30 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: launching external program on W95
Message-Id: <35378B9E.C36@flash.net>

Petter Bergman wrote:
> 
> Hi,
> I am downgrading a build script from UNIX to windows. A fundamental
> problem is how to start an external program, e.g. a compiler, from a
> perl script. DOS commands work fine, but that's all. Is there a perhaps
> a DOS command for running a program?
-----------
well, I'm not *sure* it would work, but there was a post yesterday that
a paint program for eaxmple could be run and even fed args with a call
like this:

# fire up paint, and open a particular file
system ('c:\\somedir\\mspaint.exe c:\\somedir\\somefile.bmp');

Dan


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

Date: 17 Apr 1998 16:07:27 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Multi-tasking/threading
Message-Id: <892829677.177258@thrush.omix.com>

Benjamin Sugars <bsugars@canoe.ca> wrote:
: Without a threaded Perl, you can't properly embed in a multi-threaded
: environment at all.

	Hmm, you sure about that?  If need be a new interpreter could be
	used for each thread, which would be lame, but would "work".  But
	that's not the real point.

	Remember that thread enabled and thread safe are two *vary*
	different things.  I don't know if perl is thread safe or not,
	however as is has been embedded into Netscape web servers (all of
	which are fully threaded applications) I would gather that it is,
	or at least is simple to make thread safe.  Any comments from those
	that wrote the NSAPI perl glue or p5p people?

: All the calls out to the Perl runtime need to be serialised, which hoses
: the multi-threaded application.

	Not if perl is thread safe.  Writing thread safe code can be done
	with anything, without either enabling or using threads at all.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Fri, 17 Apr 1998 16:31:57 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
To: Zenin <zenin@archive.rhps.org>
Subject: Re: Multi-tasking/threading
Message-Id: <3537841A.7A62@canoe.ca>

[ ...posted and mailed ... ]

Zenin wrote:

> Remember that thread enabled and thread safe are two *vary*
> different things.  I don't know if perl is thread safe or not,
> however as is has been embedded into Netscape web servers (all of
> which are fully threaded applications) I would gather that it is,
> or at least is simple to make thread safe.  Any comments from those
> that wrote the NSAPI perl glue or p5p people?

Actually I'm the primary author of the nsapi_perl code :-) With
non-threaded Perl, the NSAPI calls into the Perl runtime are indeed
serialised.

It works fine if your Perl callouts don't take long.  But if they're
time consuming - or if one hangs - it will start to bottleneck the
server.

> : All the calls out to the Perl runtime need to be serialised,
> : which hoses the multi-threaded application.
> 
> Not if perl is thread safe.  Writing thread safe code can be done
> with anything, without either enabling or using threads at all.

Yes, the problem is that non-threaded Perl is not thread safe.  For
instance, there's only one argument stack so multiple threads
manipulating the stack concurrently causes problems.

The tactic for threaded nsapi_perl is to create one Perl thread for
each server thread.  When the server calls out to Perl, the calling
thread is assigned to a Perl thread and concurrent processing can
safely occur (each thread having its own argument stack among other
things).

-Ben

--
Ben Sugars <bsugars@canoe.ca>
Senior Webmaster,
CANOE Canadian Online Explorer,
http://www.canoe.ca/


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

Date: 17 Apr 1998 16:52:09 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Multi-tasking/threading
Message-Id: <892832358.746870@thrush.omix.com>

Benjamin Sugars <bsugars@canoe.ca> wrote:
	>snip<
: Actually I'm the primary author of the nsapi_perl code :-)

	<grin>

: With non-threaded Perl, the NSAPI calls into the Perl runtime
: are indeed serialised.
:
: It works fine if your Perl callouts don't take long.  But if they're
: time consuming - or if one hangs - it will start to bottleneck the
: server.

	Duh!  :-)

	I never liked the fact Netscape used threads in lue of processes
	myself.  I always felt the Apache model was much cleaner, the
	above reasons being only one of many.

: Yes, the problem is that non-threaded Perl is not thread safe.

	Ah, ok.  Then we are both a bit right.  Perl can not be
	used without serialization or an instance per thread, however
	a fully threaded and thread enabled perl isn't required,
	in theory anyway.  The second part of course would require
	that someone write a non-threaded but thread safe version
	of perl, which I don't think would be likely if the threaded
	version will be thread safe (I would hope so <grin>).

: For
: instance, there's only one argument stack so multiple threads
: manipulating the stack concurrently causes problems.

	You say this like a stock broker might say a 400 pint drop
	in the stock market causes problems. :-)

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Fri, 17 Apr 1998 17:21:32 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
Subject: Re: MULTIPLICITY crash: HELP!!!
Message-Id: <35378FBA.3839@canoe.ca>

igor@everyware.com wrote:

> I've embedded Perl into a multithreaded app. Everything's by the book, and
> everything works, as long as there is exactly 1 (one) interpretor running.
> In any other case I crash. =I NEED YOUR HELP=. It was painful enough to
> convince the suits to add Perl to the app. Now, I'm loosing big.
> 
> It is not a problem with MT, rather with running multiple interpreters.
> And no, I cannot wait for 5.05. I badly need some workaround now.

Even with -DMULTIPLICITY, Perl 5.004 is not thread-safe, AFAIK.  You
will have to serialise your calls into Perl using some kind of mutex.

-Ben

--
Ben Sugars <bsugars@canoe.ca>
Senior Webmaster,
CANOE Canadian Online Explorer,
http://www.canoe.ca/


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

Date: Fri, 17 Apr 1998 12:06:30 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: Perl Oddity
Message-Id: <6h7trm$s7u@fridge.shore.net>

Mark-Jason Dominus wrote in message <6h7rkv$pfp$1@monet.op.net>...
>
>My program, `py', writes yacc-style parser programs in Perl.


No need to keep posting over and over... We get the idea.

-grinch

--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: 17 Apr 1998 12:00:34 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Problem executing without using: Perl foo.pl
Message-Id: <ra2wz8lp.fsf@mailhost.panix.com>

Stephanie Sante' <ssante@concentric.net> writes:

> We are running perl on Solaris 2.5.1. Although my 1st line in the script
> is: #!/usr/local/bin/perl5.00 -w

Are you *quite* sure that the file

  /usr/local/bin/perl5.00

really exists and is executable?

> However, when I use: perl foo.pl things execute just fine.

What does it say when you type
 
   $ perl -v

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Fri, 17 Apr 1998 10:24:37 -0600
From: John Blanco <johnnie@holly.colostate.edu>
To: star@sonic.net
Subject: Re: shorten array
Message-Id: <35378245.47D4A995@holly.colostate.edu>

~arthur wrote:

> Hi,
>
> I have a Perl program (thanks David Black) that picks a random word in
> a
> game. If you play the game more than once in a row you may get the
> same
> word. Is there a way that once the word is used it taken out of the
> array?

@words = ('lets', 'go', 'mets');

srand;
while(@words) {
   $random_word = splice(@words, rand $#words, 1);
   print "$random_word\n";
}

What this does is not only chooses the random word but removes it at the
same time.
You'll want to make an original copy of your array so that when all the
words are chosen, you can reset it.

   - Johnnie B



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

Date: Fri, 17 Apr 1998 10:09:11 -0700
From: "Database Coder" <dbcoder@juno.com>
Subject: Snobby news group
Message-Id: <6h82ft$69c$1@news.scruz.net>

Why is this such a snobby unhelpful news group. I have posted in many other
news groups and always recieved polite and helpful responses. This news
group is the exception. The amount of time you people spend asking people if
they read the FAQ or bought a good book on PERL could have been spent
helping the person.





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

Date: Fri, 17 Apr 1998 12:59:59 -0300
From: "Marco Shaw" <marco@nbnet.nb.ca>
Subject: srand and rand fx
Message-Id: <6h7u88$981$1@garnet.nbnet.nb.ca>

I was trying to develop a secure Perl script for creating random passwords.
It uses the perl function 'rand', but I've noticed that there is a pattern
to it after all.  I don't quite understand how I can use 'srand' to increase
the 'randomness'.  Do I just declare 'srand(time|$$), for example, and
continue using rand in the next lines?

Any ideas?

Marco




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

Date: Fri, 17 Apr 1998 09:11:21 -0700
From: "Scott LeWarne" <Scott_LeWarne@BigFoot.com>
Subject: Using Win32::NetAdmin:UserCreate
Message-Id: <6h7vvf$av3@news.or.intel.com>

Does anyone have any experience with using this function with Perl for
Win32?  I have not been able to get it to work and can't figure out why.
I'm using IIS 4.0 and most of my script works fine and does not return any
errors, but it's not creating the user.

Here is my code:
****************************************************************
use Win32;
use Win32::NetAdmin;

require "cgi-lib.pl";    # This file needs to be in the same directory as
the script

# Configurable Variables #
$reglist="regtest.txt"; # this is what the output file will be called
$server = KENNY;   # name of the server
$response = "Thank you for applying. You should recieve a response within 7
business days. .";
$link = "../index.html>Click here to go the Start page";
$passwordage = 1;
$privilege = USER_PRIV_USER;
$homedir = 'c:\\';
$flags = UF_NORMAL_ACCOUNT;
$scriptpath = 'c:\\';

MAIN:
{

# Read in all the variables set by the form

if ($ENV{'QUERY_STRING'} ne "") {
@inputargs = split(/\&/,$ENV{'QUERY_STRING'});
#$inputargs[0] =~ s/\+/\ /g;
$firstname = substr($inputargs[0],18);
$lastname = substr($inputargs[1],17);
$title = substr($inputargs[2],14);
$company = substr($inputargs[3],21);
$street = substr($inputargs[4],22);
$street2 = substr($inputargs[5],17);
$city = substr($iputargs[6],13);
$state = substr($inputargs[7],14);
$zip = substr($inputargs[8],16);
$country = substr($inputargs[9],16);
$workphone = substr($inputargs[10],18);
$fax = substr($inputargs[11],12);
$email = substr($inputargs[12],14);
$intelname = substr($inputargs[13],20);
$inteltitle = substr($inputargs[14],17);
$intellocation = substr($inputargs[15],24);
$intelworkphone = substr($inputargs[16],21);
$intelaltphone = substr($inputargs[17],15);
$intelemail = substr($inputargs[18],17);
$username = substr($inputargs[19],17);
$password = substr($inputargs[20],17);
$password2 = substr($inputargs[21],24);
$challenge = substr($inputargs[22],10);
$comment = $company."  (".$email.")";

$debug="$username $password $flags";
}

# Check to see if this username already exists
# If it does, quit to the page output and have the user go back and try
again
Win32::LookupAccountName ($server, $username, $Domain, $SID, $SIDType);
if ($SID ne "") {
   $response = "The username you have chosen is already in use.  Please go
back and choose a different one.";
   $link = "";
   goto PRINTHTML; #Quit so they can try again
}

# Make sure that both passwords entered match
if ($password ne $password2) {
   $response = "The confirmation password that you entered does not match
your password.  Please go back and try again.";
   $link = "";
   goto PRINTHTML; #Quit so they can try again
}

# Add the new user to the system
#Win32::NetAdmin::UserCreate ('', billy, 123, 0, USER_PRIV_USER, c, test,
UF_NORMAL_ACCOUNT, c);
Win32::NetAdmin::UserCreate ('', $username, $password, $passwordage,
$privilege, $homedir, $comment, UF_NORMAL_ACCOUNT, $scriptpath);

**********************************************************
Am I doing something wrong?   I have gotten some examples from several
sources and it appears that I am doing it correctly, but the user is never
created.

Any help would be greatly appreciated.

Thanks
Scott LeWarne
Scott_LeWarne@BigFoot.com




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

Date: Fri, 17 Apr 1998 09:54:23 -0700
From: "Scott LeWarne" <Scott_LeWarne@BigFoot.com>
Subject: Re: Using Win32::NetAdmin:UserCreate
Message-Id: <6h82g5$d05@news.or.intel.com>

It appears now that it did work, however it took several hours before the
user showed up.

Any ideas?

Thanks
Scott LeWarne


Scott LeWarne wrote in message <6h7vvf$av3@news.or.intel.com>...
>Does anyone have any experience with using this function with Perl for
>Win32?  I have not been able to get it to work and can't figure out why.
>I'm using IIS 4.0 and most of my script works fine and does not return any
>errors, but it's not creating the user.
>
>Here is my code:
>****************************************************************
>use Win32;
>use Win32::NetAdmin;
>
>require "cgi-lib.pl";    # This file needs to be in the same directory as
>the script
>
># Configurable Variables #
>$reglist="regtest.txt"; # this is what the output file will be called
>$server = KENNY;   # name of the server
>$response = "Thank you for applying. You should recieve a response within 7
>business days. .";
>$link = "../index.html>Click here to go the Start page";
>$passwordage = 1;
>$privilege = USER_PRIV_USER;
>$homedir = 'c:\\';
>$flags = UF_NORMAL_ACCOUNT;
>$scriptpath = 'c:\\';
>
>MAIN:
>{
>
># Read in all the variables set by the form
>
>if ($ENV{'QUERY_STRING'} ne "") {
>@inputargs = split(/\&/,$ENV{'QUERY_STRING'});
>#$inputargs[0] =~ s/\+/\ /g;
>$firstname = substr($inputargs[0],18);
>$lastname = substr($inputargs[1],17);
>$title = substr($inputargs[2],14);
>$company = substr($inputargs[3],21);
>$street = substr($inputargs[4],22);
>$street2 = substr($inputargs[5],17);
>$city = substr($iputargs[6],13);
>$state = substr($inputargs[7],14);
>$zip = substr($inputargs[8],16);
>$country = substr($inputargs[9],16);
>$workphone = substr($inputargs[10],18);
>$fax = substr($inputargs[11],12);
>$email = substr($inputargs[12],14);
>$intelname = substr($inputargs[13],20);
>$inteltitle = substr($inputargs[14],17);
>$intellocation = substr($inputargs[15],24);
>$intelworkphone = substr($inputargs[16],21);
>$intelaltphone = substr($inputargs[17],15);
>$intelemail = substr($inputargs[18],17);
>$username = substr($inputargs[19],17);
>$password = substr($inputargs[20],17);
>$password2 = substr($inputargs[21],24);
>$challenge = substr($inputargs[22],10);
>$comment = $company."  (".$email.")";
>
>$debug="$username $password $flags";
>}
>
># Check to see if this username already exists
># If it does, quit to the page output and have the user go back and try
>again
>Win32::LookupAccountName ($server, $username, $Domain, $SID, $SIDType);
>if ($SID ne "") {
>   $response = "The username you have chosen is already in use.  Please go
>back and choose a different one.";
>   $link = "";
>   goto PRINTHTML; #Quit so they can try again
>}
>
># Make sure that both passwords entered match
>if ($password ne $password2) {
>   $response = "The confirmation password that you entered does not match
>your password.  Please go back and try again.";
>   $link = "";
>   goto PRINTHTML; #Quit so they can try again
>}
>
># Add the new user to the system
>#Win32::NetAdmin::UserCreate ('', billy, 123, 0, USER_PRIV_USER, c, test,
>UF_NORMAL_ACCOUNT, c);
>Win32::NetAdmin::UserCreate ('', $username, $password, $passwordage,
>$privilege, $homedir, $comment, UF_NORMAL_ACCOUNT, $scriptpath);
>
>**********************************************************
>Am I doing something wrong?   I have gotten some examples from several
>sources and it appears that I am doing it correctly, but the user is never
>created.
>
>Any help would be greatly appreciated.
>
>Thanks
>Scott LeWarne
>Scott_LeWarne@BigFoot.com
>
>




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

Date: Fri, 17 Apr 1998 14:37:11 +0100
From: Ian Lynagh <ian@lynagh.demon.co.uk>
Subject: What does "Illegal modulus zero" mean?
Message-Id: <4y5L2AAHs1N1EwR+@lynagh.demon.co.uk>


Can anyone explain the following?

  DB<6> p 9862777291 % 4294967296
Illegal modulus zero at (eval 11) line 2, <IN> chunk 9.


Thanks
Ian
-- 
Ian Lynagh - ian@lynagh.demon.co.uk
http://home.sn.no/~balchen/igloo/

It is easier to fight for one's principles than to live up to them.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2350
**************************************

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