[13177] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 587 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 19 11:12:56 1999

Date: Thu, 19 Aug 1999 08:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 19 Aug 1999     Volume: 9 Number: 587

Today's topics:
        Python to Perl Conversions <tchrist@mox.perl.com>
        Q: How to get file contents from client jizhang123@my-deja.com
    Re: Question about date <sjohns17@uic.edu>
    Re: Question about date (Larry Rosler)
    Re: Renaming Windows NT domain users (elephant)
    Re: shell script translation <argyrodes@sympatico.ca>
    Re: shell script translation (Donovan Rebbechi)
        Testing if a module is installed <toby@venice.cas.utk.edu>
        Thanks for the answers to -- autoresponder, BUT.... <nicholasbarnaby@home.com>
        Unix NT differences <xxx.geoffs@inc.co.uk>
    Re: Wacky Programming Tales (Mark W. Schumann)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 19 Aug 1999 08:14:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Python to Perl Conversions
Message-Id: <37bc1142@cs.colorado.edu>

                        +-----------------------+
                        | Operations on numbers |
                        +-----------------------+

Python Construct                Perl Equivalent
===========================================================================
x + y                           + for numbers, . for strings, and
                                interopolation for arrays (@a, @b)
                                and hashes (%a, %b)

x - y                           same

x * y                           * for numbers, x for strings and lists.

x / y                           Same for floats, but Perl doesn't do
                                integer division here usually.  Python
                                things 3/4 is 0 (and false), but 3.0/4.0 is 0.75

x % y                           same; Perl and Python use the same
                                definition of modulus, even though this
                                differs from that of C with respectd to
                                negative operands.

abs(x)                          same

int(x)                          same, except perl only requires it for
                                truncation toward zero, and python
                                needs it all over the place, since
                                strings aren't numbers, nor are they
                                autoconverted.

long(x)                         These are bignums, not C longs, so:
                                    use Math::BigInt;
                                    $n = Math::BigInt->new(expr);

float(x)                        not applicable

divmod(x,y)                     no direct equiv; same as
                                    ( int($x / $y), $x % y )

pow(x,y)                        x ** y

x | y, x ^ y, x & y             same, although python's only work on ints
                                and its bignum longs and blow up
                                on floats, and perl's don't work on
                                Math::BigInts, but do work on strings in
                                a very different way, and truncate floats.

x << n, x >> n                  same, although Perl works differently if
                                you go over 31 bits:  Python keeps giving 
                                you 0, whereas Perl wraps.  1<<34 is 0 in 
                                python but 4 in perl.

~x                              same-ish, but see |&^ above for details.
                                In particular, you can't negate bitstrings
                                in python.

===========================================================================

                            +----------------------------+
                            | Operations on dictionaries |
                            +----------------------------+

Python Construct                Perl Equivalent
===========================================================================

len(d)                          keys %d, in a scalar context; e.g.:
                                    $count = keys %ENV;

d[k]                            "same": $h{$k} as a real %hash, and
                                $hr->{$k} as a reference

d[k] = x                        "same": 
                                    $h{$k} = x;         # real %hash
                                    $href->{$k} = x;    # as reference
                                Note that Python doesn't support hash
                                slices, which in Perl are simple:
                                    @hash{k1,k2,k3} = (v1, v2, v3)

del d[k]                        delete $h{$k}, but Python can't do more
                                than one at a time on a hash, as in Perl's
                                    delete @hash{k1,k2,k3}

d.items()                       Just use %hash in list context to get all
                                the key/value pairs as a flat list.

d.keys()                        keys %hash

d.values()                      values %hash

d.hash_key(k)                   exists $hash{k}

===========================================================================

            +--------------------------------------------------+
            | Operations on sequences (strings, tuples, lists) |
            +--------------------------------------------------+

x in s                          No built-ins, must use grep or loop.
                                    Lists/arrays: grep { $x == $_ } @s
                                    Strings: index($s, $x) != 0

x not in s                      See previous entry.
                                    Lists/arrays: !grep { $x == $_ } @s
                                    Strings: index($s, $x) < 0

for n in x                      for $n (@array)                 # arrays
                                for $c (split //, $string)      # strings

s + s                           $s . $s

s * n, n * s                    $s x $n for strings and lists/arrays, but 
                                must be in that order in Perl.  Python
                                allows the number in either place.

s[i]                            $array[i] for arrays, but
                                substr($s, $i, 1) for strings

s[i:j]                          @array[ $i .. ($j - 1) ]  for arrays, but
                                substr($s, $i, $j - 1) for strings.  Yes, 
                                slices in python don't include the
                                termination point.

len(s)                          @array in a scalar context for arrays, e.g.
                                        $count = @array;
                                but length($s) for strings.

min(s), max(s)                  no equivalent in core perl, so you'd need a
                                loop,  although the CPAN module builtin.pm
                                provides these in fast C code.

===========================================================================

                    +---------------------+
                    | Operations on lists |
                    +---------------------+

s[i] = x                        $a[i] = expr, but Perl can do this even if
                                the array isn't long enough yet, and Python
                                can't.  You have to grow it with the append
                                method below.  

s[i:j] = x                      @a[ i .. (j - 1) = list_expression
                                but see above.  Also, Perl's slices needn't
                                be contiguous, and Python's must.  Yes, slices
                                don't include endpoint in Python.

del s[i]                        splice(@a, i, 1)

del s[i:j]                      splice(@a, i, j - 1) for values of i and j.
                                Yes, slices don't include endpoint in Python.

s.append(x)                     push(@array, listexpr)

s.count(x)                      grep { $_ == expr } @array (for numbers)
                                grep { $_ eq expr } @array (for strings)
                                grep {  /expr/    } @array (for patterns)

s.index(x)                      no direct equivalent, need loop:
                                    $found = undef;
                                    for $i ( 0 .. $#array ) {
                                        if ($array[$i] == expr) { # numeric
                                            $found = $i;
                                            last;
                                        }
                                    } 

s.insert(i,x)                   splice(@array, $i, 0) = x;  

s.remove(x)                     this deletes the first x in s, and has no
                                direct equivalent.  the simple
                                    @a = grep { !/x/ } @a
                                deletes all of them, but as a pattern.  For
                                the first, you'd need a loop or extra
                                variable, because grep doesn't shortcircuit.  
                                    $found = 0;
                                    @a = grep { !/x/ || !$found++) } @a;
                                or as a string
                                    $found = 0;
                                    @a = grep { $_ ne x || !$found++ } @a;

s.reverse                       @a = reverse @a; note that python's reverse
                                is in-place *only*, and doesn't work on
                                character strings.

s.sort(cmp?)                    Noting that Python's sort is in-place only, use
                                    @a = sort @a; 
                                    @a = sort some_cmp @a;


===========================================================================

                            +--------------------+
                            | built-in functions |
                            +--------------------+

apply(fn,args)                  &fn(@args) will skip prototype checks that
                                fn(@args) would normally enforce.  In
                                general, perl doesn't need this at all,
                                because indirect function calls don't do 
                                prototype checks.
                                    $name = "fn";   # or \&fn
                                    $name->(@arglist)

callable(x)                     n/a or else UNIVERSAL::isa($x, "CODE") 

chr(i)                          same

cmp(x,y)                        x cmp y

coerce(x,y)                     n/a!

compile(string,label,kind)      $coderef = eval "sub { $string }"

delattr(object,name)            n/a?  "delete named attribute from object".
                                I suppose this might be
                                        delete $obj->{name}
                                but that's pretty uncool to do it without 
                                asking the object.

dir(object)                     n/a for most.  returns a list of attribute
                                names in object or the caller's local scope.
                                for modules, you can do 
                                        keys %module::
                                and for hash-based objects, 
                                        keys %$obj
                                But you can't get the local (lexical
                                my variables) names in Perl without
                                resorting to C code.

eval(code)                      Same as Perl, but Perl's handles
                                statements, and python's only handles
                                expressions.  Also, python hurls an
                                exception if it doesn't like you,
                                whereas Perl sets $@.  People use this
                                to convert string to numbers.  This is
                                a terrible security hazard.

exec(code)                      eval(code);  plus see previous entry.

execfile(file)                  do 'file';  plus see anteprevious entry.

filter(func,list)               grep { func($_) } list

getattr(obj,name)               n/a?  maybe just $obj->{$name}.  I don't
                                understand why this exits.  Oh heck, yes I
                                do.  Because you can say
                                    name = "widget_count"
                                    obj.name
                                Because there's no interpolation and
                                otherwise it will look up name.  Oh my.
                                This is like the apply() mess.

globals()                       keys %{ __PACKAGE__ . "::" }

hasattr(obj,name)               exists $obj->{$name}

hash(x)                         huh?  "returns the hash value of the object,
                                if any"

hex(n)                          sprintf("%#x", n)
                                Perl's hex() function is the opposite.
                                It converts 22 into 37.  Python's hex
                                function converts 37 into 0x22.  Oh my!

id(obj)                         Just use $obj in numeric context. "returns
                                the unique id for the object, its addr in memory"

input(prompt?)                  n/a.  This reads and evals the input
                                stream!  Needed because otherwise you can't
                                read a number.  Or you could read the
                                string and convert it.  Ick.  Security
                                hazard waiting to happen.

locals()                        n/a.  We can't get our block's lexicals
                                without resorting to C.  And even if
                                we hand them, we can't symbolically
                                dereference they're names, since the
                                package (module's global) symbol table
                                is completely separate from that of the
                                lexicals' (local) one, and sym deref
                                only does the former.

map(fn, list)                   map(fn($_), list) # or written
                                map { fn($_) } list
                                Except Perl's map won't parallelize, as in
                                    map(fn, [1,2,3], [4,5,6])
                                will call fn() thrice, as in
                                        fn(1,4)
                                        fn(2,5)
                                        fn(3,6)
                                Note that Perl's map doesn't have to be
                                function; it can just be a code block.
                                    @trips = map { 3 * $_ } @singles;

oct(n)                          sprintf("%#o", $n)
                                Like hex, Python has this completely
                                backwards.  Python's oct(44) returns 054,
                                but Perl's oct(44) return 36.  UG!

open(path,mode)                 Perl's open function works very differently.
                                    $success = open(FH, mode . path)

ord(c)                          same

range(start?, end, step?)       Either use a range operator, but be careful
                                of the end point:
                                    @nums = $start .. ($end - 1) 
                                or a for() loop
                                    for ($i = $start; $i < $end; $i += $step)
                                or even 
                                    for $i ( $start .. ($end - 1) ) 

raw_input(prompt?)              print "prompt";
                                $line = <STDIN>;
                                chomp($line);    # but perl groks RS

reload(module)                  First delete from %INC, then require the
                                module again, as in:
                                    delete $INC{"Module.pm"}
                                    require Module;
                                Note that Python doesn't directly support
                                nested modules as in
                                    require Dir1::Dir2::Dir3::Module;
                                except via a disgustingly named hackaround
                                module.

repr(x)                         "$x".  Python also use `x` for this.

setattr(obj,name,value)         $obj->{$name} = $value;
                                Interpolation wins again.  See getattr.

str(x)                          I thought this was the same as repr().

tuple(seq)                      n/a.  This is a nasty hack to deal with the
                                fact that (1,2,3) is different from [1,2,3].
                                Hm... maybe it's like this:
                                    $aref = [1,2,3]; 
                                    @list = @$aref;

type(obj)                       ref($obj) returns its string type

vars(obj)                       n/a, maybe.  keys %$obj, but not really
                                anything for the locals.

xrange ...                      Like range, but avoids generating all at
                                once as Python's
                                    for i in range(100000):
                                would.  Perl's solution was to fix 
                                    for $i (1 .. 99999)
                                instead to do lazy evaluation.

===========================================================================

                    +--------------+
                    | file methods |
                    +--------------+

s = file.read(size?)            $bytes_read = read(FH, $s, $size)
                                Perl's read() doesn't let you leave
                                off the last argument to mean "read all".
                                Usually, you undefined your input record
                                separator and use readline for that.

file.readline()                 $s = readline(*FH)
                                    or more commonly
                                $s = <FH>

file.readlines()                @a = readline(*FH)
                                    or more commonly
                                @a = <FH>

file.write(string)              print FH "string"

file.writelines(list)           print FH @array_of_lines

file.close()                    close(FH)

file.tell()                     tell(FH)

file.seek(offset,whence)        seek(FH, offset, whence)

file.isatty()                   -t FH

file.flush()                    Either FH->autoflush(1) if you're using the
                                aliasing modules, or else the klunky but
                                fast:
                                    $old_fh = select(FH);
                                    $| = 1;
                                    select($old_fh);
                                Note that this just sets autoflushing
                                on each subsequent output on that handle.

===========================================================================

    +------------------------------------------------------------+
    | sys library.  There aren't there unless you have imported  |
    | the library module via "import sys".                       |
    +------------------------------------------------------------+

sys.argv                        @ARGV but sys.argv[1] in Python 
                                is $ARGV[0] in Perl, and sys.argv[1]
                                in Python is $0 in Perl, which is mutable.

sys.builtin_module_names        You either recursively go through %main::,
                                or look at %INC.  But these only show what
                                was loaded, not what was built in.

sys.exc_type                    n/a or $@.   Perl doesn't have even
                                loosely typed exceptions, just strings.
                                There is support for exception objects,
                                but people don't use them.

sys.exc_value                   The $@ variable, mostly.  See previous
                                entry.

sys.exc_traceback               n/a or $@.  We have no exception
                                traceback object.  Traceback gets appended
                                to value.

sys.exit(status)                exit(status) and no import is bloody
                                necessary just to leave the program.
                                But that Python does this by raising
                                a SystemExit exception.  Perl can use
                                END{} handlers to catch these and do
                                at-exit processing, and Python doesn't.
                                You have to roll your own.

sys.exitfunc                    This is one function to call on normal exit
                                (not exception exits, unlike perl).
                                It would have to manage all the handlers
                                in your roll-your-own scheme.  Very ugly.

sys.getrefcount(object)         This isn't exposed in Perl, save through the
                                standard Devel::Peek module.

sys.last_type                   n/a.  Type of last unhandled exception.

sys.last_value                  n/a.  Value of last unhandled exception.

sys.last_traceback              n/a.  Traceback of last unhandled
                                exception.

sys.modules                     %INC

sys.path                        @INC

sys.platform                    $^O  # that's a ^ and an O
                                You can use the $OSNAME alias from the
                                std English module if you like.

sys.ps1, sys.ps2                n/a.  interactive prompts.

sys.setcheckinterval(reps)      n/a.  This is some event hook processing
                                thing.

sys.settrace(fn)                n/a. set system traceback function.  I
                                guess you could play with the Carp module.

sys.setprofile                  n/a;  the profiler is separate in perl

sys.stdin                       STDIN

sys.stdout                      STDOUT

sys.stderr                      STDERR

sys.tracebacklimit              n/a

===========================================================================

    +---------------------------------------------------------------+
    | string library.  There aren't there unless you have imported  |
    | the library module via "import string".                       |
    +---------------------------------------------------------------+

string.atof(s)                  n/a - Perl doesn't need this.  Just use
                                the string as a float, and it is one.

string.atoi(s)                  n/a - Perl doesn't need this.  Just use
                                the string as a int, and it is one.

string.atol(s)                  Perl doesn't have built-in bignums.
                                    use Math::BigInt;
                                    $n = Math::BigInt->new($s)

string.expandtabs(s,tabsize)    From a module:
                                use Text::Tabs;
                                $tabstop = 4; 
                                @without_tabs = expand(@with_tabs); 

string.find(s,sub,start?)       index(s,sub,start?)     # no import

string.rfind(s,sub,start?)      rindex(s,sub,start?)    # no import

string.index(s,sub,st)          if (index(s,sub,st) < 0) {die "ValueError"}

string.rindex(s,sub,st)         if (rindex(s,sub,st) < 0) {die "ValueError"}

count(s, sub, start?)           You use a loop or a pattern match:
                                    $count = 0;
                                    $start = 0;
                                    while (($pos=index($s, $sub, $start) >= 0){
                                        $count++;
                                        $start += $pos;
                                    }
                                Or with regex:
                                    @matches = $s =~ /sub/g;
                                    $count = @matches;  # get scalar count
                                Or shorter:
                                    $count = () = $s =~ /sub/g;
                                If you don't want regex magic chars, use
                                    $count = () = $s =~ /\Qsub/g;

string.split(s)                 @a = split(' ', $s)     # no import

string.splitfields(s,sep)       @a = split(/sep/, $s)   # no import
                                If you don't want regex magic chars:
                                @a = split(/\Qsep/, $s) 

string.join(x)                  $s = join(" ", @x);     # no import

string.joinfields(x, sep)       $s = join($sep, @x);    # no import

string.strip(s)                 Use two substs: 
                                    $string =~ s/^\s+//;
                                    $string =~ s/\s+$//;
                                Or combined for legibility and
                                extensibility:
                                    for ($string) {
                                        s/^\s+//;
                                        s/\s+$//;
                                    }

string.swapcase(s)              $s =~ tr[a-zA-Z][A-Za-z]
                                Except this isn't locale-aware.

string.upper(s)                 uc($s)      # no import

string.lower(s)                 lc($s)      # no import

string.ljust(s,width)           sprintf("%*s", -$width, $s)
                                (no import), or use printf(), or use
                                format and write statements.

string.rjust(s,width)           sprintf("%*s", $width, $s)
                                (no import), or use printf(), or use
                                format and write statements.

string.center(s,width)          Easiest with format and write.  Could
                                hack up a (s)printf otherwise.

string.zfill(s,width)           sprintf("%0${width}d", $s)

===========================================================================

        +-------------------------------------------------------------+
        | POSIX library.  These aren't there unless you have imported |
        | the library module via "import posix".                      |
        +-------------------------------------------------------------+

posix.environ                           The %ENV hash; no import needed in Perl.  
                                        However, assignment doesn't appear
                                        to propagate to unborn children as
                                        it does in Perl.

posix.error                             This might be Perl's $! errno
                                        variable, but I'm dubious.
                                        Failed syscalls in python always
                                        raise an exception.

posix.chdir(path)                       chdir(path)     # no import in Perl
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.chmod(path, mode)                 chmod(path, mode)  # no import in Perl
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.chown(path,uid,gid)               chown(path,uid,gid) # no import in Perl
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.close(fd)                         POSIX::close(fd);  # real int, not stdio 
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.dup(fd)                           POSIX::dup(fd), or just use open as
                                        shown below

posix.dup2(fd, fd2)                     POSIX::dup2(fd, fd2), or just use the
                                        basic open with its funky dup syntax:
                                            open(HANDLE2, "<&$fd")

posix.execv(path,args)                  exec path, args;  # no import in Perl

posix.execve(path,args, env)            Just set your %ENV and then exec().

_exit(n)                                POSIX::_exit(n)

fdopen ....                             Use POSIX::fdopen or funky open:
                                            open(HANDLE2, "<&=$fd")

posix.fork()                            fork()  # no import
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.fstat()                           stat(HANDLE)    # no import

posix.getcwd()                          use Cwd;  $here = getcwd();
                                        but most folks use `pwd` in perl

posix.getegid                           $)      # not a typo

posix.getpid()                          $$      # not a typo

posix.kill(pid,sig)                     kill(sig,pid)   # no import
                                        In perl, a string is ok
                                            kill("TERM", $$);  # suicide
                                        Or multipids
                                            kill("HUP", $him, $her, @them)
                                        Return value is success in Perl --
                                        no exception raised on failure.

posix.link(src,dst)                     link($src,$dst)  # no import
                                        Return value is success in Perl --
                                        no exception raised on failure.
                                        I'll stop saying this now.

posix.listdir(path)                     opendir(DH, path);
                                        readdir(DH);            # no import

posix.lseek(fd,pos,how)                 seek(HANDLE, pos, how)  # stdio
                                        sysseek(HANDLE, pos, how)  # no stdio
                                        If you only have an fd, use
                                        POSIX::seek() or fdopen it

posix.lstat(path)                       lstat(path)             # no import

mkdir(path,mode)                        mkdir(path,mode)        # no import

open(path,flags,mode)                   sysopen(HANDLE,path,flags,mode)
                                        no import of posix needed except
                                        for flags.  use Fcntl is more
                                        widely supported for this.

(f1,f2) = posix.pipe()                  pipe(FH1, FH2)          # no import

fd = posix.popen(cmd,mod,bufsiz)        No import.  Just use regular open.
                                            open(FH, "| cmd")   # writing
                                            open(FH, "cmd | ")  # reading

posix.read(fd,n)                        POSIX::read or sysread() or usually
                                        just regular read()

posix.readlink(path)                    readline(path)          # no import

posix.rename(src,dst)                   rename(src,dst)         # no import

posix.rmdir(path)                       rmdir(path)             # no import

posix.setgid(id)                        $) = id         # not a typo

posix.stat(path)                        stat(path)      # no import
                                        But if the list return is icky, you
                                        can use the File::stat module to
                                        get by-name object values.

posix.symlink(src,dst)                  symlink(src,dst)    # no import

posix.system(cmd)                       system(cmdstr)      # no import
                                        Perl also a shell-safe version:
                                        system(arglist)

posix.times()                           times()             # no import

posix.umask(mask)                       umask(mask)         # no import

posix.uname()                           POSIX::uname()

posix.unlink(path)                      unlink(path)        # no import
                                        perl also allows a list
                                        unlink(f1,f2,f3)

posix.utime ...                         utime...            # no import

posix.wait()                            wait()              # no import

posix.waitpid(...)                      waitpid(...)        # no import

posix.write(fd,str)                     use syswrite() normally, 
                                        or maybe POSIX::write


===========================================================================
-- 
		"So much mail, so little time."  


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

Date: Thu, 19 Aug 1999 13:58:53 GMT
From: jizhang123@my-deja.com
Subject: Q: How to get file contents from client
Message-Id: <7ph2ik$sa1$1@nnrp1.deja.com>



I do not know if this is a right newsgroup for this question.

Some browsers support <Form> <Input Type=file Name=usr_attach>
after visitor clicked submit button,
how can I get the contents of the file from the client
through CGI interface on  NCSA httpd server ?

Please reply to Ji.Zhang@NRC.CA

Thanks

Ji Zhang


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 18 Aug 1999 21:51:55 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: Question about date
Message-Id: <Pine.A41.4.10.9908182148290.207570-100000@tigger.cc.uic.edu>

On 19 Aug 1999, Jimtaylor5 wrote:

> Can anyone tell me how I would check a date to see if two or more days have
> passed? For example I tried taking the standard date time 
> (Mon Aug 16 21:57:34 1999) splitting it, matching, and incrimenting, which of
> course doesn't work consistently.

Not that I'd use a formatted time for this, but I'd wager it's possible
to parse it in a workable manner. However, read below.

> Has anyone done this check with any of their
> programs or can show me a way to accurately check if a couple days have passed?

Read the perlfunc pod, specifically the part about "localtime." :)

-Seth Johnson
 www.pdamusic.com



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

Date: Thu, 19 Aug 1999 07:35:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question about date
Message-Id: <MPG.1225b61b4615e097989e75@nntp.hpl.hp.com>

In article <FGpqBL.FHq@csc.liv.ac.uk> on Thu, 19 Aug 1999 12:50:09 GMT, 
I.J. Garlick <ijg@connect.org.uk> says...
 ... 
> No. Use the -M unary operator (somewhere in the perlfunc man page, but I
> can't get perldoc -f to find them)

We discovered this recently:

On Unix:  perldoc -f -- -X

On Windows/DOS:  perldoc -f -X

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 20 Aug 1999 00:05:23 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Renaming Windows NT domain users
Message-Id: <MPG.1226ba2a26843a9e989c5a@news-server>

Helgi Briem writes ..
>On Thu, 19 Aug 1999 15:26:11 +1000,
>elephant@squirrelgroup.com (elephant) wrote:
>>you can't change the username from within the WindowsNT User Manager 
>>program .. that would seem to suggest that Microsoft use the username as 
>>the primary key for the user record thus making it un-changeable
>>
>Wrong.  You can change it easily within NT User Manager.
>Highlight the user
>Go to the main menu
>User - Rename - hey presto!

yes .. thank you .. I was also reminded elsewhere in this thread

>As for changing it from a script. I don't know, 
>haven't tried it.

this is also mentioned elsewhere in this thread

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Thu, 19 Aug 1999 14:13:02 GMT
From: Norman Crooks <argyrodes@sympatico.ca>
Subject: Re: shell script translation
Message-Id: <37BC1460.785F5BBE@sympatico.ca>


The shell script that I provided has to become a sub-routine within a perl
script that already exists, which is why I need it to be in perl.  Unless I
can call the shell script from perl - is there a way to pass a variable from
a perl script to a shell script?

-Norm

Donovan Rebbechi wrote:

> On Wed, 18 Aug 1999 11:22:18 GMT, Norman Crooks wrote:
> >Hello Perl Group,
> >
> >Can someone help me convert this short shell script into a perl script?
>
> You don't need to. There's nothing to stop you having a shell script
> as a CGI.
>
> --
> Donovan



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

Date: 19 Aug 1999 10:54:35 -0400
From: elflord@panix.com (Donovan Rebbechi)
Subject: Re: shell script translation
Message-Id: <slrn7ro6l8.cg.elflord@panix3.panix.com>

On Thu, 19 Aug 1999 14:13:02 GMT, Norman Crooks wrote:
>
>The shell script that I provided has to become a sub-routine within a perl
>script that already exists, which is why I need it to be in perl.  Unless I
>can call the shell script from perl - is there a way to pass a variable from
>a perl script to a shell script?

I see. It'd be a little more elegant to do it all in perl but you 
don't have to. you can just use 

system ( "script_name", $variable ) # see man perlfunc

then have the bash script start with 

variable=$1	

-- 
Donovan


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

Date: Thu, 19 Aug 1999 10:15:50 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Testing if a module is installed
Message-Id: <37BC1195.937ED177@venice.cas.utk.edu>

I am writing a program that gathers info from a user, interpolates it
into a another script and then installs the script with the
customizations. This is no problem. The generated program uses CGI to
handle a comment form. This is a problem. I don't want to pipe to
sendmail or hit sendmail with a system call for security reasons(the
whole exercise is to give our student users an alternative to Matt
Wright and Selena Sol) and general inelegance. So I want to use a module
like Mail::Mailer or Net::SMTP. These modules are not installed on our
system and the administrators do not want to install them for various
reason (some valid; some not.) I could go ahead and install the module
without checking its prior existence, but this would cause every install
of the script (for maintenance reasons or upgrades) to install the
module again. I am also planning a small suite of commonly requested CGI
junk (guestbooks, comment forms, etc). The module would reside in a
default library directory in the user's area (like /u03/tapplega/lib).

I am using this bit of code to test if a module exists:

eval("use Net::SMTP"); if ($@) { ...do something about it ... }

Is there a better way to do this? (This is straight out of the Camel) Or
is this as practical as it gets?

Toby



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

Date: Thu, 19 Aug 1999 14:09:31 GMT
From: "Nicholas Barnaby" <nicholasbarnaby@home.com>
Subject: Thanks for the answers to -- autoresponder, BUT....
Message-Id: <veUu3.5481$dr6.120894@news1.rdc2.on.home.com>

Thanks for your response to my question on the autoresponder especially
David. But I guest I should have asked, how do I write a script in perl that
knows when there is new incoming mail on Unix environment.
SYNOPSIS: If I am going away for a couple of weeks, I would like if an email
is sent to my account a response is sent back to the sender telling them
about my status.

Thanks
Nikk




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

Date: Thu, 19 Aug 1999 15:08:53 +0100
From: "Geoff Smith" <xxx.geoffs@inc.co.uk>
Subject: Unix NT differences
Message-Id: <7ph35n$k5r$1@ffx2nh3.news.uu.net>

I'd be grateful if someone could help me with a search script and my perl
knowledge is pretty much limited to cut and paste.

I was using Fluid Dynamics "Intermediate Search" quite happily on my web
site to search may pages. But then my ISP changed from Apache on Unix to ISS
on NT.

I've managed to get the script running again but it never finds any hits,
even on words I know exist in my files. I think that the script is not
finding any files to search and that it is something to do with file and/or
directory naming differences on NT compared to Unix.

Can anybody offer any assistance? If you want to see the script as it stands
at the moment let me know... I didn't think it appropriate to post it in the
newsgroup

--
Geoff Smith (remove the triple x to mail)
Nottingham Web Resources
http://www.usr.inc.co.uk/geoffs/notts/




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

Date: 19 Aug 1999 10:19:20 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Wacky Programming Tales
Message-Id: <7ph3p8$7ci@junior.apk.net>

In article <37b62939@cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>Gosh yes.  I think it was the rogue source that had something like:
>
>    #define until(expr) while(!expr)
>    #define otherwise   break; default:
>
>I don't remember whether it also had these, but I have
>seen them elsewhere:
>
>    #define forever()  for(;;)
>    #define unless(expr) if(!expr)

I've seen

#define ARBEGIN {
#define AREND   }

in Clipper (a somewhat C-ish language in this regard) code.

Eh?



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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 587
*************************************


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