[7429] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1054 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 20 13:17:13 1997

Date: Sat, 20 Sep 97 10:00:34 -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           Sat, 20 Sep 1997     Volume: 8 Number: 1054

Today's topics:
     ANNOUNCE: PGP::Sign 0.08 <rra@stanford.edu>
     ANNOUNCE: Protect v1.0 <jduncan@epitome.hawk.igs.net>
     ANNOUNCE: Text::BibTeX 0.2 (Greg Ward)
     Re: Bad syntax check with perl -c (Tim Gim Yee)
     Re: Calculating the week number <dankogai@dan.co.jp>
     Re: Can I specify fonts? <rootbeer@teleport.com>
     Re: Capitalizing the first letter via regex (Tom Grydeland)
     Re: Copying files (Jeremy D. Zawodny)
     Re: dates and other oddities of time <rootbeer@teleport.com>
     Re: entering debugger programmatically? (Ilya Zakharevich)
     Re: formatting number to 6 figures <dankogai@dan.co.jp>
     Getting next array element in a foreach <nospam.gibsonc@aztec.asu.edu>
     Laola: Perl 5 release <schwartz@cs.tu-berlin.de>
     Re: locking files over NFS (Icarus Sparry)
     Re: locking files over NFS <allanw@cscragroup.slv.co.uk>
     Re: Newbie Question <flavell@mail.cern.ch>
     Re: No Sys::Syslog (perl5.004, Solaris 2.5.1) <mdorman@viper.law.miami.edu>
     Re: out on a limb ... Re: homogenous/nonhomogenous list <rootbeer@teleport.com>
     Re: Perl CGI Script Invoking Expect Script (Philippe Levan)
     Re: Perl CGI Script Invoking Expect Script (Jason Gloudon)
     Pre-Announce: Bit::Vector 5.0 (Steffen Beyer)
     Training in Bay Area <ali@cybercash.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 20 Sep 1997 14:16:16 GMT
From: Russ Allbery <rra@stanford.edu>
Subject: ANNOUNCE: PGP::Sign 0.08
Message-Id: <600lrg$6f5$1@nadine.teleport.com>

PGP::Sign 0.08 is now available from CPAN, or from ftp.eyrie.org in
/pub/software/modules (actually, it has been for a while, but this is the
formal announcement).  From the README:


                          PGP::Sign version 0.08
                (Create detached PGP signatures for data)

INTRODUCTION

  One important thing to clear up right away:

                     THIS IS NOT A GENERAL PGP MODULE

  For wonderful general PGP modules that will encrypt, decrypt, manage key
  rings, slice, dice, fold, spindle, and mutilate your data, see the PGP
  by-module directory at your local CPAN mirror.  This module sprung out
  of a need to do one thing and one thing only, do it securely, and do it
  well.  This module creates and checks detached signatures for data.
  That's it.  If you want to do anything else that PGP lets you do, look
  elsewhere.

  The original purpose of this module was to factor out common code in a
  News::Article class written by Andrew Gierth that did PGPMoose
  signatures and signed control messages.  It should now be possible to
  reimplement PGPMoose, signcontrol, and pgpverify using this module, and
  the second and parts of the first have already been done.

  So much for the "one thing only" part.  For the "do it securely" part,
  this module uses a pipe and PGPPASSFD to pass the secret key password to
  PGP, rather than a command line flag or an environment variable as seen
  in other modules.  Both of those are subject to snooping by other users;
  this approach isn't.

  For the "do it well" part, the interface to this module takes every form
  of data known to man.  Scalars and arrays are no problem, of course, but
  if you give it a reference to an array, it'll walk the array to avoid
  making a copy of a potentially large data structure.  You can also give
  it an open file (in the form of a glob, a reference to a glob, a
  FileHandle object, an IO::Handle object, or anything derived from
  either) and it'll walk that too.  Or you can give it a reference to a
  scalar if you really want to and it's cool with that.  Or, if you want
  to get really exciting, you can give it a reference to a sub and it'll
  call the sub repeatedly to get more data until the sub returns undef.
  Perfect for walking some complex data structure you don't want to make
  an internal copy of.  And if there's any other interesting data
  structure you want to throw at it, tell me about it, and the next
  version will probably support that too.

  See the documentation for all the gory details, which really aren't that
  gory.  At least yet.

Bug reports to the above address.  Share and enjoy!

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print




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

Date: 20 Sep 1997 14:17:59 GMT
From: James Duncan <jduncan@epitome.hawk.igs.net>
Subject: ANNOUNCE: Protect v1.0
Message-Id: <600lun$6ir$1@nadine.teleport.com>


  Protect allows you to set perl subroutines into one of three modes, public,
member, or private.

  In private mode, only code within the package in which the subroutine 
exists can call the subroutine.

  In member mode, only members with the package can call the subroutine.

  In public mode, any(one||thing) can call the subroutine.

  Protect, unfortunatly, does not work at compile time, only in run time.
Changing this would require some pretty hefty changes to the perl core, and
while they are supposed to be coming, I thought I'd write a quick solution
myself.  It got a little out of hand (this seems to happen frequently)

  The distribution archive can be found at:
	ftp://epitome.hawk.igs.net/pub/modules/Protect/Protect-1.00a.tar.gz

 Any comments/questions appreciated.
  James Duncan <jduncan@hawk.igs.net>
 

--
James Duncan || jduncan@hawk.igs.net
IGS Hawkesbury Systems Administrator
Phone 613-632-4075  Fax 613-632-8137
web http://www.hawk.igs.net/~jduncan






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

Date: 20 Sep 1997 14:14:01 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: ANNOUNCE: Text::BibTeX 0.2
Message-Id: <600ln9$6as$1@nadine.teleport.com>

                              Text::BibTeX
                              version 0.2
                   Greg Ward (greg@bic.mni.mcgill.ca)

Text::BibTeX is a Perl module (with a couple of helper modules) for
reading, parsing, and writing BibTeX files.  The distribution includes
the Text::BibTeX, Text::BibTeX::File, and Text::BibTeX::Entry modules;
most of the hard work is done by a C library called btparse (which must
be downloaded separately from the Text::BibTeX modules).

The C library, btparse, is also a fully functional (and partially
documented) interface to BibTeX files.  If you demand the utmost in
efficiency, or want to write an interface to BibTeX for some other
high-level language, btparse might be for you.

Features provided by the modules include:

   * robust, efficient lexical scanning and parsing of BibTeX files
   * excellent error detection, reporting, and recovery in the parser
   * full processing of BibTeX strings (macros expanded, whitespace
     collapsed, strings concatenated)
   * handles all common entry types (@comment, @preamble, @string,
     and "everything else) with ease, and gives you full access to
     the contents of all entry types
   * support for processing author names identically to BibTeX
   * preliminary support for imposing/enforcing a particular database
     structure

btparse provides all of the above features, plus it is much more
flexibile with regards to the amount of processing done to strings.  You
can turn off macro expansion, whitespace collapsing, and token pasting
at will.  (Eventually, these features will migrate to the Perl code.)

The home ftp site for Text::BibTeX and btparse is

   ftp://ftp.bic.mni.mcgill.ca/pub/users/greg/

and they're both available on CPAN in modules/by-authors/Greg_Ward.

--
Greg Ward - Research Assistant                     greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201)           http://www.bic.mni.mcgill.ca/~greg
Montreal Neurological Institute           voice: (514) 398-4965 (or 1996)
Montreal, Quebec, Canada  H3A 2B4           fax: (514) 398-8948




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

Date: Sat, 20 Sep 1997 11:10:49 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: Bad syntax check with perl -c
Message-Id: <3423a567.328659436@news.oz.net>

On Thu, 18 Sep 1997 17:31:49 -0500, Brett Denner
<Brett.W.Denner@lmtas.lmco.com> wrote:

>I checked the syntax (with perl -c) of the following script:
>
>    $DIGITS = '\d+';
>    / $DIGITS (?!a/;   
>
>and the syntax was okay.  The following script
>
>    / \d+ (?!a/;      
>
>however, produces this error: 'unmatched () in regexp'.
>
>It looks like there should be unmatched parentheses errors in both
>cases, because the (?! is not balanced by a ).  Is this a bug in perl
>or have I overlooked something?

Not a bug.  Using 'perl -c' won't execute your script -- unless your
manual says otherwise :) -- so there's no way for it to know what's
going to be in $DIGITS; it could change each time you run the script.
My guess is that it just skips over the ambiguous stuff.


--
Tim Gim Yee
Moogle Stuffy Inc.


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

Date: Sun, 21 Sep 1997 01:33:32 +0900
From: Dan Kogai <dankogai@dan.co.jp>
Subject: Re: Calculating the week number
Message-Id: <3423FAAF.1019390D@dan.co.jp>

Bjorn wrote:
> 
> I need a piece of code for calculating the current week. I checked the
> perl FAQ, but the formula there doesn't work (unless you're on a year
> that starts with monday and don't care about the last week being
> correct). Any help would be greatly appreciated...

$thisweek = (localtime())[6];

Dan the Camel Abuser


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

Date: Sat, 20 Sep 1997 08:31:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: COWBYS <cowbys@aol.com>
Subject: Re: Can I specify fonts?
Message-Id: <Pine.GSO.3.96.970920083032.18258I-100000@julie.teleport.com>

On 20 Sep 1997, COWBYS wrote:

> Yeah, but can you do all of this if you are printing to a filehandle? , 

If you can do something without printing to a filehandle, you can do the
same thing with printing to a filehandle. So, yes, you can. :-) Hope this
helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 20 Sep 1997 09:09:43 GMT
From: tom@mitra.phys.uit.no (Tom Grydeland)
Subject: Re: Capitalizing the first letter via regex
Message-Id: <slrn6274mm.fgi.tom@mitra.phys.uit.no>

On Mon, 15 Sep 1997 12:25:56 -0700,
Christopher Zukowski <czukowski@qualcomm.com> wrote:
> To all,
> 
>     I am trying to figure out how to capitalize the first character of
> an otherwise all lower case string.

$capstring = "\u$string";

> Any suggestions?

Read the FAQ.

> Thank

Yeah, right.

> Christopher Zukowski

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Sat, 20 Sep 1997 10:46:22 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Copying files
Message-Id: <3425a88c.806579860@woody.wcnet.org>

[original author automagically cc'd via e-mail]

On Fri, 19 Sep 1997 23:39:42 -0500, An Thi-Nguyen Le
<anle@ehsn3.ews.uiuc.edu> wrote:

>This is my first Perl program.  Don't laugh.  At least, not more than you
>have to :7

No problem, we all started at the beginning...

>Everything is peachy-keen until line 33, or so perl tells me, with the
>syscall to "cp": "Argument "cp" isn't numeric in syscall at archive line
>33. Bad system call"  

To quote the manual:

       syscall LIST
               Calls the system call specified as the first
               element of the list, passing the remaining
               elements as arguments to the system call.  If
               unimplemented, produces a fatal error.

I don't think you want to use syscall() for this operation. 'cp' is
not a system call--it's an external program that you'd like to call.

I'd suggest looking up system() and using it instead. I'm pretty sure
it'll do the tick.

On the other hand, you can make your code more portable by using the
File module on CPAN:

  http://www.perl.com/CPAN-local/modules/00modlist.long.html

Look for "File::Copy".

Good Luck,

Jeremy
-- 
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>

"These constraints effectively ruled out the obvious choices of using
 plain fingers (yogurt is not a finger food at work), and of constructing
 a make-shift spoon from paper clips, scraps of paper, and scotch tape."

  -- Justin Dolske (dolske@cis.ohio-state.edu> in alt.hackers


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

Date: Sat, 20 Sep 1997 08:29:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nate Riggs <kolbe2@mail.klink.net>
Subject: Re: dates and other oddities of time
Message-Id: <Pine.GSO.3.96.970920082832.18258H-100000@julie.teleport.com>

On Fri, 19 Sep 1997, Nate Riggs wrote:

> Sorry, I'm a newbie at perl.  Is there a function to retrieve the date?

Yes, and you'll find it in the docs. Start with the 'perldoc' command, and
do as it suggests. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 20 Sep 1997 07:57:05 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: entering debugger programmatically?
Message-Id: <5vvvkh$kvp@agate.berkeley.edu>

In article <Pine.GSO.3.96.970919164350.21537S-100000@julie.teleport.com>,
Tom Phoenix  <rootbeer@teleport.com> wrote:
> On 19 Sep 1997, Ken Trebus wrote:
> 
> > Is there sny way to enter the debugger programmatically. I.E., issue a
> > command in the Perl program that will cause it to enter the debugger?
> 
>     $DB::single = 1;	# See the perldebug(1) manpage for info
> 
> > I can't just run perl -d on the file because it is part of a big build
> > process and perl is called many times. 
> 
> If you can't use -d, then you can't use the built-in debugger. :-( But you
> can still use code (possibly from a module) which will put diagnostic
> messages into a file or mail them to you, for example. Hope this helps!

Note that these advices are mutually exclusive, though both true ;-).
The second one is closer to the question.

If one is absolutely desperate, append '-db' to the name of your
script and substitute 
	exec $^X, '-d', "$0-db", @ARGV;
for your script.  You need to ensure that the script is not started
with funny options, though.

Hope this helps,
Ilya


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

Date: Sun, 21 Sep 1997 01:17:17 +0900
From: Dan Kogai <dankogai@dan.co.jp>
Subject: Re: formatting number to 6 figures
Message-Id: <3423F6E1.C8785C4E@dan.co.jp>

David Waters wrote:
> I want to format a number so that it
> has leading zeros and is always padded
> to 6 figures.

$sixdigitnum = sprintf("06d%", $num);

Dan the Camel Abuser


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

Date: Sat, 20 Sep 1997 08:05:35 -0700
From: Gip <nospam.gibsonc@aztec.asu.edu>
Subject: Getting next array element in a foreach
Message-Id: <3423E63F.5119@aztec.asu.edu>

How would one go about getting the next element after finding an element
in an array, using a foreach:

# assume for this ex that the @array contains   b d h t
foreach $item (@array) {

  if ($item eq "d") {

    # the next line is where my problem is; I want the next item 'h'!
    $next_item = ??? ; # I've tried shift unshift pop push
    $last;
  }

} 

But, of course, I ended up doing the following:

for ($i=0; $i<=$#array; $i++) {
  :
  :

Thanks for your time.
CG

Notice I was able to type in this example without once using foo...oops
now
I guess I did.


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

Date: 20 Sep 1997 14:19:25 GMT
From: Martin Schwartz <schwartz@cs.tu-berlin.de>
Subject: Laola: Perl 5 release
Message-Id: <600m1d$6k8$1@nadine.teleport.com>
Keywords: Perl, Structured Storage, OLE, MS Word

Hello,

Brand new: 

A meantime perl 5 distribution of LAOLA. 

Laola is a library about the so called "Structured Storage" format, the
binary format of Microsoft Windows OLE documents. Also it gives access to
PropertySets, as they are defined e.g. in those OLE documents.

If you have to deal with binary documents done at MS Windows platforms, but
your locale machine is not, Laola might be interesting to you.

Starting with this release Laola is now written in perl 5. Elser, the
MS Word convertress, is not ported yet, but I wanted to publish Laola 
anyway.

It can be found at:

   http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/index.html

If I should figure out how CPAN works, I'll ask to putting it there, too.

Comments welcome!

Martin

-- 
// Le degre zero de l'ecriture? Zero probleme!




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

Date: Sat, 20 Sep 1997 11:35:14 GMT
From: ccsis@bath.ac.uk (Icarus Sparry)
Subject: Re: locking files over NFS
Message-Id: <EGt1Iq.5G0.B.mary@bath.ac.uk>

In article <Pine.GSO.3.96.970919214733.22475B-100000@daftary-ultra.cisco.com>,
Kuntal M Daftary  <daftary@cisco.com> wrote:
>executable "program" is on file system "FS" mounted on machines A and B
>the program uses lock files to make sure of mutual exclusion during resource
>sharing, which might be writing to a file (in which case file should not be
>corrupted during writing). the lock files are also formed on file system "FS"
>accessible by both A and B.
>
>now when i run "program" from A and a lock file is formed, the existance of the
>lock file may not be immediately reflected on B. so if i almost immediately
>start the "program" on B, it may also attempt to write to the data file and
>corrupt it.
>
>is there a unix utility to take care of this sitation? does flock take this
>problem into account and resolve it? iare there any suggestions that any of u
>would like to make as to how to resolve this problem? i m aware of the idea of
>waiting some time (like 10 secs) before checking the existance of the lock
>file, but that kinda looks kludgy to me and i was hoping for a more elegant
>soln.

I presume you are using 'NFS' to 'mount' your filesystem. There are a number
of things that NFS stands for - Sun would have you believe that it means
'Network File System', but those of us who use it prefer 'Not a filesytem'
or even 'No F***ing Security'. You have discovered one of the reasons for this.

There are a number of things you can do. The best one is to use an NFS call
which is reasonably atomic, such as 'mkdir'. You don't look for the lock
directory at all, you just try and make it. If the mkdir succeeds, then
you have the lock, otherwise someone else does. e.g.

if mkdir lock
then
	: we have the lock
else
	echo 'the directory "lock" exists - exiting' >&2
	exit 99
fi

The 'flock' is a bodge on top of a bodge. It is better than nothing but for
your problem using mkdir would be better.
Icarus



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

Date: Sat, 20 Sep 1997 15:27:26 +0100
From: Allan Wilkins <allanw@cscragroup.slv.co.uk>
Subject: Re: locking files over NFS
Message-Id: <3423DD4E.2781@cscragroup.slv.co.uk>

Kuntal M Daftary wrote:
> executable "program" is on file system "FS" mounted on machines A and B
> the program uses lock files to make sure of mutual exclusion during resource
> sharing, which might be writing to a file (in which case file should not be
> corrupted during writing). the lock files are also formed on file system "FS"
> accessible by both A and B.
> 
> now when i run "program" from A and a lock file is formed, the existance of the
> lock file may not be immediately reflected on B. so if i almost immediately
> start the "program" on B, it may also attempt to write to the data file and
> corrupt it.
> 
> is there a unix utility to take care of this sitation? does flock take this
> problem into account and resolve it?
> 
> Kuntal M. Daftary   Cisco Systems Inc
> Ph: 408 527 9789    170 W. Tasman Dr
> daftary@cisco.com   San Jose CA 95134

I would have thought you would have problems both when using NFS and
when not. The only reliable method for locking files is to to use the
'c' functions provided by the development system in your executable
program.

If you wrote the program or have access to the source I suggest you
use the locking 'c' functions in the program. If not complain to your
supplier that the program is not programmed properly for true
multi-user operation.

NOTE: NFS file locking is 'advisory' rather than the 'manadtory'
locking available when directly accessing a disk. It should however
all work fine as long as the NFS drive does not 'dissappear' while the
program is running.

Hope this helps

Al
-- 
Allan Wilkins (awilkins@csc.ragroup.co.uk)
CSC Ra Group Ltd.
In this posting/mail I am speaking for me, not my employer


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

Date: Sat, 20 Sep 1997 11:19:37 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newbie Question
Message-Id: <Pine.A41.3.95a.970920131408.99520E-100000@sp060>

On Fri, 19 Sep 1997, Joel Shellman wrote:

(pointlessly comprehensive quotes, complete with sig)

> I have been using cgi-lib.pl. 

The protocol between the client and the server does not know nor care
what library you are using to evaluate the submission. 

> Can someone please tell me if hidden variables
> are EVER treated different than non-hidden ones (on the server side)?

Someone can do, and already has done on this thread IIRC.

>  I always thought they were only hidden in the browser and that had
> nothing to do with the server. 

Yes, right.  Once the GET/POST has been formed for submission
there's no difference.



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

Date: 20 Sep 1997 07:42:41 -0400
From: Michael Alan Dorman <mdorman@viper.law.miami.edu>
Subject: Re: No Sys::Syslog (perl5.004, Solaris 2.5.1)
Message-Id: <ylenzpp85hzi.fsf@viper.law.miami.edu>

Tom Phoenix <rootbeer@teleport.com> writes:
> On Fri, 19 Sep 1997, Kyle Barger wrote:
> > I was trying to use Sys::Syslog and it does not seem to be working. 
> 
> > The following code produces no errors, but it also doesn't log anything:
> > 
> >   #!/usr/bin/perl
> 
> Maybe if you turned on -w it would warn in some way. (But I'm not sure
> that it would; it's just an idea to try.) 
> 
> As the docs say, you have to have a valid syslog.ph file for your system. 
> Do you? 

Another possibility---Sys::Syslog, IIRC, tries to use TCP sockets even
on local connections.  Could your syslog be configured (by you or Sun)
to only accept connections through Unix sockets as a security measure?

Linux distributions are often configured this way, and I seem to
remember reading something about it with regards to Solaris somewhere.

Maybe check netstat, and see if your box is accepting connections on
whatever the syslog socket is?

HTH,

Mike.


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

Date: Sat, 20 Sep 1997 08:23:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: rbush@up.net
Subject: Re: out on a limb ... Re: homogenous/nonhomogenous list test?
Message-Id: <Pine.GSO.3.96.970920081847.18258G-100000@julie.teleport.com>

On Fri, 19 Sep 1997 rbush@up.net wrote:

> didn't i read someplace that the short circuit operators were faster
> than if's? 

You might have, but that doesn't mean that it's true. :-)  But since the
short-circuit operators are doing something very different than 'if', I'm
not sure that you can compare them in a meaningful way. OTOH, if you're
saying that a short-circuit 'and' may be faster than 'if (this) { if
(that) { ... } }', I'd tend to agree.

> couldnt i construct one large "short circuit" expression containing the
> elemnts and then evaluate it? 

You could, but the time needed to compile it would make it slower. :-)

I don't recall whether I suggested it, but if speed is truly an issue,
some compiled code (probably written in C) might help. Then again, it
might not. :-)  Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 20 Sep 1997 10:02:36 GMT
From: levan@news.epix.net (Philippe Levan)
Subject: Re: Perl CGI Script Invoking Expect Script
Message-Id: <6006vs$dft$1@news1.epix.net>

ads@websp.com wrote:
: expect {
:         "New password:" {send "$password\r"}
: }
: expect {
:         "Re-enter" {send "$password\r"}
: }
: expect eof

Combine them all in one expect statement :

expect {
	"New password:" {send "$password\r"; exp_continue}
	"Re-enter" {send "$password\r"; exp_continue}
	eof
}

exp_continue restarts the waiting from the beginning.

: Bad header=spawn /usr/bin/sudo /usr/bin/passwd user

That line was sent to the standard output while the server expected
a header line to be generated by your scripts : the spawn command
echoes its arguments to the standard output by default, use the
-noecho option to make it quiet.

			Philippe.


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

Date: 20 Sep 1997 16:45:01 GMT
From: jgloudon@bbn.com (Jason Gloudon)
Subject: Re: Perl CGI Script Invoking Expect Script
Message-Id: <600uid$3a0$1@daily.bbnplanet.com>

In article <874721085.24031@dejanews.com>,  <ads@websp.com> wrote:
>I am currently writing a set of Perl CGI scripts that allow adding users,
>changing passwords,.....  I plan to integrate Perl and Expect together.
>Well my first step was setting up sudo.  Done.  That works.  Next I
>thought I'd better write some expect scripts.  Here is my expect_passwd
>script:
>
>#!/usr/local/bin/expect
>spawn /usr/bin/sudo /usr/bin/passwd [lindex $argv 0]
>expect "Password:" # password prompt for sudo
>send "password\r" # sends password for sudo
>set password2 [open "/....pwd.$username" "r"] #opens temp file that
>#contains password - to avoid letting someone type ps and see it the
>#passwd being entered as a command line argument

A word of warning :
Better check your umask. I'm not sure what the default is in your case.
Other wise you may be putting the password in a readable file.

Jason Gloudon


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

Date: 20 Sep 1997 09:13:11 GMT
From: sb@sdm.de (Steffen Beyer)
Subject: Pre-Announce: Bit::Vector 5.0
Message-Id: <600437$o6m@sunti1.sdm.de>

Dear Perl users,

I am currently working on version 5.0 of the "Bit::Vector" module.

Nearly daily developers versions (alpha state) are available
from my web site at

http://www.engelschall.com/u/sb/download/

(as well as my other modules).

The new version will comprise arithmetics which will make the
"Math::BigInt" module more than obsolete (that module uses
*strings* internally to represent integers and is written
entirely in Perl).

The "Bit::Vector" module, in contrast, uses machine words internally
to represent numbers (which can be of an arbitrarily large number of
bits) and is written in C (it has an XSUB interface so that it can
be used comfortably from Perl) for maximum performance.

The module is intended to be useful in applications such as Pretty
Good Privacy where large bit vectors (e.g. of random bits!) and
numbers of more than 1000 bits length must be handled.

The arithmetic functions also comprise bit shift operations which
make the module indispensable for Cyclic Redundancy Checksums of
an arbitrary number of bits, for example.

Moreover, the module can be used to represent sets. All operations
and functions familiar from set theory are available (e.g. union,
intersection, ..., number of elements, minimum, maximum, ..., etc.).

"newsrc" style sets (enumerations of numbers and ranges of numbers)
are also supported.

The module can also be used to represent matrices of booleans
(sometimes needed for certain algorithms in graph theory).

Finally, new methods have been provided that allow access to the
"internals" of a bit vector, i.e., it is now possible to access
the machine words in which the information is stored internally,
either individually (as though the bit vector was a Perl array)
or as a Perl list of items.

The size of the chunks that are stored or read can be chosen at
will.

This makes this module perfect to read in a file of bytes (8 bits)
and to process it in chunks of, say, 16 bits - an audio cd image,
for instance.

A list of the new functions follows:

Interval_Copy()

# Copies any interval to another bit vector at another position (same length)

Interval_Substitute()

# Similar to "splice" - substitutes an interval by another interval from
# another bit vector. The two intervals may have different lengths and
# may start at different positions. (The length of the resulting bit
# vector is adjusted automatically.)

Insert()

# Inserts a given number of bits at a given position

Delete()

# Deletes a given number of bits at a given position

add()
subtract()
Multiply()
Divide()
GCD()
Sign()
Negate()
Absolute()

# Arithmetic functions

Word_Bits()  #  Returns the number of bits in a machine word on your system
Long_Bits()  #  Returns the number of bits in an unsigned long on your system

Word_Size()  #  Size of the "word array" - similar to "scalar(@array)"

Word_Store()
Word_Read()
Word_List_Store()
Word_List_Read()
Word_Insert()
Word_Delete()

# Access a bit vector as though it was an array or list of machine words

Chunk_Store()
Chunk_Read()
Chunk_List_Store()
Chunk_List_Read()

# Access a bit vector as an array or list with choosable chunk size
# (To be portable, never use chunks larger than 32 bits - 32 bits
# are available on all systems due to ANSI C requirements.)

to_Dec()
from_Dec()

# Conversion to and from decimal numbers

I hope you will find this module beneficial.

Yours sincerely,
--
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Fri, 19 Sep 1997 16:07:26 -0700
From: "Ali Ersheid" <ali@cybercash.com>
Subject: Training in Bay Area
Message-Id: <5vv0bv$3hi$1@nehi.rwc.cybercash.com>

 Does anyone know of any Perl training for beginners in the SF Bay Area?





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

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

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