[6281] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 903 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 6 00:18:28 1997

Date: Wed, 5 Feb 97 21:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 Feb 1997     Volume: 7 Number: 903

Today's topics:
     <Newbie>Incorporating a JavaScript into a Perl script?? <ed@its2ez.com>
     Re: alphabetizing a list <rootbeer@teleport.com>
     Re: Anyone got a base64 encoder? <jesse@ginger.sig.bsh.com>
     Crypting <rom_ortiz@icepr.com>
     Re: Division and Rounding <rootbeer@teleport.com>
     Re: Empty contents of a file without deleting it <rootbeer@teleport.com>
     Re: Empty contents of a file without deleting it (Tad McClellan)
     Re: environment variables (Nathan V. Patwardhan)
     eval {} Within Tie::Hash (Eric M Knell)
     Getting file info in WinPERL <iswojtow@sfu.ca>
     Re: Getting file info in WinPERL (Stephen R. Morley)
     Re: How can I call a perl CGI from a C cgi ? <rootbeer@teleport.com>
     Re: How do I strip out all characters including newline <jesse@ginger.sig.bsh.com>
     Re: How to run Perl scripts w/o read&write permissions <jesse@ginger.sig.bsh.com>
     Re: How would a good Perl programmer have written this (Tad McClellan)
     Re: Looking for an oneliner perl script <rootbeer@teleport.com>
     Re: Nice perl way to generate n! permutations for n=8 ? <tchrist@mox.perl.com>
     Question on subprocesses <ez045864@peseta.ucdavis.edu>
     Setuid Issues <s.farooqi@cummins.com>
     Re: Setuid Issues (Nathan V. Patwardhan)
     Re: Setuid Issues <rootbeer@teleport.com>
     setuid() <dfox@pobox.com>
     simultaneous dbmopen <jaymez@creativeaccess.com.au>
     Re: space stripping <joseph@5sigma.com>
     Re: Trimming Dollar Value (Chaim Frenkel)
     Word wrap script - it works! (Geoff Cox)
     Re: Word wrap script - it works! (Nathan V. Patwardhan)
     Re: Word wrap script - it works! (Shishir Gundavaram)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Wed, 05 Feb 1997 22:16:46 -0500
From: It's 2 EZ Sales <ed@its2ez.com>
Subject: <Newbie>Incorporating a JavaScript into a Perl script????
Message-Id: <32F94D1E.4C9F@its2ez.com>

I have a Perl script that generates a web page by using commands, like

print "Content-type: text/html\n\n";
print "<HEAD>\n";

etc...

I also have a separate javascript that works well on my normal HTML
page.  The javascript looks like 

<script language = "JavaScript">
function Add(form, Action){
	var Add="";

etc...

Now I want to add the JavaScript to the page that is generated by the
Perl script.  I am concerned that Perl will get confused by all the
reserved syntax needed for the JavaScript.  I doubt that 

print "<script language = "JavaScript">\n";
print "function Add(form, Action){\n";
print "var Add="";\n";

etc...

is going to work (is it?).

Is there a way that I can add this JavaScript into my Perl script, so
that the page generated by the Perl script incorporates the JavaScript?

Thanks, and please reply to email.

Ed


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

Date: Wed, 5 Feb 1997 19:09:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Craig Thompson <CRAIG@wingnet.net>
Subject: Re: alphabetizing a list
Message-Id: <Pine.GSO.3.95.970205190713.24308C-100000@linda.teleport.com>

On 5 Feb 1997, Craig Thompson wrote:

> Can anyone offer help on how I would alphabetize the list in order for
> them to be displayed in a more user-friendly fashion? 

This is a special case of sorting on a computed key. Have you seen the
examples in perlfunc and the Perl FAQ? Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 05 Feb 1997 20:37:01 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Anyone got a base64 encoder?
Message-Id: <4o4tfqhg02.fsf@ginger.sig.bsh.com>


cpan> i /base64/
Module id = MIME::Base64
    DESCRIPTION  Encode/decode Base 64 (RFC 1521)
    CPAN_USERID  GAAS (Gisle Aas)
    CPAN_VERSION 1.08
    CPAN_FILE    GAAS/libwww-perl-5.06.tar.gz
    DSLI_STATUS  Rdpf (released,developer,perl,functions)
    MANPAGE      encode_base64 - Encode string using base64 encoding decode_base64 - Decode base64 string
    INST_FILE    /usr/local/share/lib/perl5/site_perl/MIME/Base64.pm
    INST_VERSION 1.08


cpan> 

That wasn't so hard. RTF{M,FAQ,*}.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Wed, 05 Feb 1997 22:21:15 -0500
From: Romualdo Ortiz <rom_ortiz@icepr.com>
Subject: Crypting
Message-Id: <32F94E2B.7623@icepr.com>

How I can decode after I use crypt in a name?
Please email me at rom@icepr.com
Thanks
 
Rom Ortiz
rom_ortiz@icepr.com


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

Date: Wed, 5 Feb 1997 20:12:54 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff Thistle <jthistle@cancom.net>
Subject: Re: Division and Rounding
Message-Id: <Pine.GSO.3.95.970205200154.24308H-100000@linda.teleport.com>

On 5 Feb 1997, Jeff Thistle wrote:

> I have always encountered difficulty with division and rounding.  I have
> found it very difficult (almost impossible) to divide two numbers and
> end up with a manageable floating point as an answer (ie. a couple of
> decimal places). 

Perl tries to do all math with more accuracy than you're likely to need. 
This may mean that Perl knows more digits of accuracy than you want. If
you want only a couple of decimal places, just round off with printf, or
possibly sprintf. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Wed, 5 Feb 1997 20:17:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Schoenfeld <chris@ixlabs.com>
Subject: Re: Empty contents of a file without deleting it
Message-Id: <Pine.GSO.3.95.970205201348.24308I-100000@linda.teleport.com>

On Wed, 5 Feb 1997, Chris Schoenfeld wrote:

> What's the most desirable method of emptying a file's contents without
> deleting it (e.g. system(cp /dev/null file)) in Perl?

truncate() is good, if your system has it in one form or another. Or, you
can open for output and simply write nothing into the file, but that will
create the file if it didn't already exist. Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Wed, 5 Feb 1997 21:27:03 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Empty contents of a file without deleting it
Message-Id: <72jbd5.593.ln@localhost>

Chris Schoenfeld (chris@ixlabs.com) wrote:
: What's the most desirable method of emptying a file's contents without
             ^^^^^^^^^^^^^^

Kinda depends on what that means.

Fastest? Most perly? Shortest to type? Easiest to understand
when you come back to this code in six months? Most portable?


: deleting it (e.g. system(cp /dev/null file)) in Perl?


Others have already given the perly/portable way.

I'll offer up the shortest (sans error checking) to type:


system(">file_to_clear");


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 6 Feb 1997 02:32:35 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: environment variables
Message-Id: <5dbfs3$r4s@fridge-nf0.shore.net>

L. Ted Nocella (tnocella@outland.cyberwar.com) wrote:
:  : I'm trying to identify users' e-mail addresses when they post a form
:  : which is processed by my perl script. 

Short answer: you can't, really.

Some servers support REMOTE_IDENT which I've been told is "reliable,"
but I have my doubts.

--
Nathan V. Patwardhan
nvp@shore.net
"Outshined outshined outshined!"
	--Chris Cornell from Soundgarden


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

Date: 6 Feb 1997 01:54:49 GMT
From: knell@void (Eric M Knell)
Subject: eval {} Within Tie::Hash
Message-Id: <5dbdl9$qtg@vixen.cso.uiuc.edu>


I'm having a bit of a problem using eval to catch an exception within my
Tie'd Hash functions.  I am using perl5.002 on HP-UX.  This also does not
work on perl5.003 built under Solaris.

The problem seems to be that if an eval traps an exception in one of the
Tie::Hash functions, after that function exits, the program quits. 
Everything works fine if the function is called manually
($objref->STORE(a,b)) but it doesn't work with $hash{'a'} = b.  No error
or warning messages are given before the program shuts down, but all
global destruction occurs.

The code follows.

Am I doing something wrong here, or is this a bug in perl?

Thanks in advance,

Eric Knell
Undergraduate Research Assistant
National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
knell@uiuc.edu

The problem code is as follows:

package NewTieHash;

use Tie::Hash;

@ISA = qw ( Tie::StdHash );

sub STORE {
  $_[0]->SUPER::STORE($_[1],$_[2]);
  eval{die};
  return $_[2];
}

package main;

tie(%a,NewTieHash);
tied(%a)->STORE('1',1);		# It works this way.
print "Success 1\n";		# This line prints.

$a{'1'}=1;			# This doesn't work.
print "Success 2\n";		# This line never prints.
 




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

Date: Wed, 5 Feb 1997 19:29:43 -0800
From: Ian Stanislaw Wojtowicz <iswojtow@sfu.ca>
Subject: Getting file info in WinPERL
Message-Id: <Pine.SGI.3.91.970205192701.20853B-100000@beaufort>

Is there any way of retrieving file information like modification date 
and file size without using stat()? I'm using the Windows port of PERL 
which doesn't support stat().

please reply to ian@knowarch.com

thanks,
ian


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

Date: Thu, 06 Feb 1997 04:32:30 GMT
From: morleys@ix.netcom.com (Stephen R. Morley)
Subject: Re: Getting file info in WinPERL
Message-Id: <5dbn7v$9n9@sjx-ixn7.ix.netcom.com>

Perform a system command "dir" and parse the results.

Ian Stanislaw Wojtowicz <iswojtow@sfu.ca> wrote:

>Is there any way of retrieving file information like modification date 
>and file size without using stat()? I'm using the Windows port of PERL 
>which doesn't support stat().

>please reply to ian@knowarch.com

>thanks,
>ian




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

Date: Wed, 5 Feb 1997 20:24:07 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Thierry DELATTRE <th@euro-checkpoint.com>
Subject: Re: How can I call a perl CGI from a C cgi ?
Message-Id: <Pine.GSO.3.95.970205201826.24308J-100000@linda.teleport.com>

On Wed, 5 Feb 1997, Thierry DELATTRE wrote:

>     I'm using a CGI written in C and I would like to execute another
> CGI from it, but this one is written in PERL. Is it possible to do and
> how can I do ?

You do it the same way in which you would execute another CGI written in
any other language. (That is, you could fork off a child process to
execute it, and wait for it to finish, or you could call system, for
example.) Be sure to follow the CGI interface (from the server's side), of
course. 

If you have further questions on how to do this, newsgroups on C
programming, server programming, CGI, or their FAQ lists may be of
assistance. But this is not a Perl question: it would be the same if the
script in question were a shell script, for example. 

Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 05 Feb 1997 20:24:53 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: How do I strip out all characters including newlines?
Message-Id: <4o6806hgka.fsf@ginger.sig.bsh.com>

Charles Herold <cherold@pathfinder.com> writes:

> 
> This is probably quite simple, but me and a friend with a small book on
> Perl and a big book on regular expressions can't quite figure it out.
> 
> I want to strip out everything in a string from </a> to <a>, but I
> can't, a problem I assume with newlines (i.e. s#</a>.*#<a># won't
> work).

s#</a>.*?<a>##si;

/s modifier treats `.' approx. like `(.|\n)'. `.*?' does a non-greedy match
which you probably want, see perlre(1). /i for case-insensitive.

This should strip e.g. `...a</A>b...c<A>d...' to `...ad...'.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: 05 Feb 1997 20:11:47 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: How to run Perl scripts w/o read&write permissions
Message-Id: <4o7mkmhh64.fsf@ginger.sig.bsh.com>

"Garden Escape" <cliff@garden.com> writes:

> Jeff Dragovich <jjd6939@serverb.ca.boeing.com> wrote in article
> <32F14B5D.167E@serverb.ca.boeing.com>...
> > I would like to release production perl scripts that the users do not
> > have read or write access to. How can I do this?
> > 
> 
> chmod, dude.

Won't work of course, unless the Perl is setuid and only that UID is able to
read the scripts on _that particular_ system and you've turned off debugging
and probably a few other conditions I'm not thinking of. Or, you can try to
scramble it.

Once long ago, a certain company (unspecified) released a production software
suite in Perl and put an idiotic text-scrambling system on the code that would
make it do all sorts of secure things like being not directly readable, and
having a checksum, and taking longer to load because it had to unravel all
this crap. A certain acquaintance of mine, realizing that (s)he needed to make
a simple customization to the app, was forced to waste a day or so writing a
utility suite to read and write the "proprietary" format before (s)he could
begin.

In summary: give it up Jeff. I'm sure if you're terribly clever with undump
and a SunOS emulator, or a networked decryption key server, you can succeed in
being a pain in the ass to your customers. Have you considered limiting
yourself to a LICENSE?

Otherwise, I'll see you on
<ftp://ftp.dynamic.ip.com/%20warez/boeing/perl/scripts>.

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Wed, 5 Feb 1997 21:37:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How would a good Perl programmer have written this
Message-Id: <lmjbd5.ub3.ln@localhost>

Charles Herold (cherold@pathfinder.com) wrote:
: I'm a newbie Perlite, and at present my code is long and clumsy.  I
: suspect the very long script I wrote is something an experienced Perl
: programmer could make just a few lines.  If anyone feels like showing me
: what this code would look like written properly it would help me a lot
: in figuring out the proper approach to Perl.  What the code does (and it
: did work and got me what I wanted) is to go through an HTML page which
: was supposed to have server side maps and didn't.  It looks for each IMG
: tag, sees if that tag contains an ISMAP, and if it does, surrounds the
: IMG tag with an anchor with the HREF being the IMG SRC with the
: extension changed to "map."  I used the limited number of Perl I know
: and a book to look up whatever would be the closes to 'C', which I know
: much better, and cobbled this together.


See the -i switch in the perlrun man page too.


: ------- CUT --------
: #!/usr/local/bin/perl5 -w
: use diagnostics;

: BEGIN {
:   unless (@ARGV >= 1) {
:     print "Usage: change.pl <filename>\n"; 
:     exit;
:   }
: }


print "Usage: change.pl <filename>\n" unless @ARGV >= 1;



: $/ = undef;
: $ismap = 'ISMAP';
: foreach(@ARGV) {
:   $workfile = $_;


foreach $workfile (@ARGV) {
# don't need '$workfile = $_' now


:   open(IN, $workfile) or die "Couldn't open source file $workfile\n";
:   my $intext = <IN>;
:   my $outtext = '';
:   close IN;
:   if( $intext =~ m#$ismap#) {  # ignore files with no ISMAPs


next unless $intext =~ m#$ismap#;    # ignore files with no ISMAPs
                                     # eliminate if block and indenting


:     open(OUT, "> $workfile.bak") or die "Couldn't open backup file
: $workfile.bak"; 
:     print OUT $intext;
:     close OUT;


use -i instead ;-)

[ snip ]

: sub getMap
: {
:   $piece = $_[0];
:   $place = index($piece, 'SRC');

:   if($place == -1) {
:     die "uh oh";	# this was a test.  But I do get it sometimes, I think
: only on the last file	
:   }  
:   $src = substr($piece, $place, 1000);
:   
:   ($begin, $name, $rest) = split('"', $src);
:   $src = $rest = $begin;	# this is just to stop a Perl error message
: about only using a variable once
:   $name = substr($name, 0, rindex($name, '.'));
:   $src = "$name.map";
:   $src;	# the above line may be enough for a return, but I wasn't sure
                      ^^^^^^^^^^^^^^^^^^^^^^^^
: so I stuck this in too


$src = "$name.map"; is indeed enough


: }


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Wed, 5 Feb 1997 20:30:18 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Thierry DELATTRE <th@euro-checkpoint.com>
Subject: Re: Looking for an oneliner perl script
Message-Id: <Pine.GSO.3.95.970205202425.24308K-100000@linda.teleport.com>

On Wed, 5 Feb 1997, Thierry DELATTRE wrote:

>     I'm looking for a free oneliner perl script. Do you ever saw one
> somewhere ?

  perl -e 'print pack "H*", "49276d20667265652120" x 2 . "3a2d290a"'

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 6 Feb 1997 00:40:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Nice perl way to generate n! permutations for n=8 ??
Message-Id: <5db9ar$9fg$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    ncpsltd@aol.com (NCPSLtd) writes:
:I'm unable to come up with a nice "algorithm" to generate the permutations
:for 12345678.  
:
:Perl has always given me clever, compact ways to do such jobs, and I'm at
:a loss for this one.

Try this permute script of mine.  Use it this way:

    % echo '1 2 3 4 5 6 7 8' | permute 

This takes about 15 seconds to run on my system.  So don't 
expect speed here.

#!/usr/bin/perl -n
permut([split], []);
sub permut {
    my @car = @{ $_[0] };
    my @cdr = @{ $_[1] };
    unless (@car) {
	print "@cdr\n";
    } else {
	my(@newcar,@newcdr,$i);
	foreach $i (0 .. $#car) {
	    @newcar = @car;
	    @newcdr = @cdr;
	    unshift(@newcdr, splice(@newcar, $i, 1));
	    permut([@newcar], [@newcdr]);
	}
    } 
}

__END__
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
    last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
    That's gonna be tough for Randal to beat...  :-)
            --Larry Wall in  <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov>


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

Date: Wed, 5 Feb 1997 18:26:28 -0800
From: "D.M. Johnson" <ez045864@peseta.ucdavis.edu>
Subject: Question on subprocesses
Message-Id: <Pine.GSO.3.95.970205182428.12757C-100000@bullwinkle.ucdavis.edu>

This is kind of general.  I am curious as to how I could call a
subprocess, like spell or crypt, from my program.  I am working with HP-UX
and ULTRIX machines.  Thanks.

D.J.




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

Date: Wed, 05 Feb 1997 21:00:07 -0500
From: Suheb Farooqi <s.farooqi@cummins.com>
Subject: Setuid Issues
Message-Id: <32F93B27.299C@cummins.com>

Hello,
I have cgi script in perl that I wish to run with setuid to another
user.

However, the script fails with error:

Insecure dependency in eval while running setuid at
/disk/perl_v5.x/lib/SelfLoader.pm line 24.

I can tell that the error occured at:

use CGI;


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

Date: 6 Feb 1997 02:30:32 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Setuid Issues
Message-Id: <5dbfo8$r4s@fridge-nf0.shore.net>

Suheb Farooqi (s.farooqi@cummins.com) wrote:
: I have cgi script in perl that I wish to run with setuid to another
: user.

I've preferred to do one of two things (which may or may not be good
for your problem/implementation): (1) write an suid C program that is
executed from the Perl program, or (2) have your sysadmin install 
cgiwrap, which executes the CGI scripts as "you," or "the user."

BTW, What does the script output from the commandline?  It would
be extremely helpful if you posted some code.

--
Nathan V. Patwardhan
nvp@shore.net
"Outshined outshined outshined!"
	--Chris Cornell from Soundgarden


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

Date: Wed, 5 Feb 1997 19:15:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Suheb Farooqi <s.farooqi@cummins.com>
Subject: Re: Setuid Issues
Message-Id: <Pine.GSO.3.95.970205191140.24308D-100000@linda.teleport.com>

On Wed, 5 Feb 1997, Suheb Farooqi wrote:

> I have cgi script in perl that I wish to run with setuid to another
> user.

That's all right, if you must do so, and if you've read perlsec(1)
concerning the security issues involved.

> However, the script fails with error:
> 
> Insecure dependency in eval while running setuid at
> /disk/perl_v5.x/lib/SelfLoader.pm line 24.
> 
> I can tell that the error occured at:
> 
> use CGI;

I believe you'll need to disable autoloading in CGI.pm. There should be
instructions near the beginning of that file on how to do that. If you
can't find them, you may need to get a more recent version of CGI.pm. 

If you have further error messages from Perl, be sure to see what perldiag
has to say about them. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Wed, 05 Feb 1997 20:09:12 -0500
From: Daniel Fox <dfox@pobox.com>
Subject: setuid()
Message-Id: <32F92F37.46F22A94@pobox.com>

Is there a way to change the uid of a perl program
like setuid() in C?

Thanks..

-- 
Daniel Fox
dfox@pobox.com


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

Date: Thu, 06 Feb 1997 14:50:04 +1100
From: James Murray <jaymez@creativeaccess.com.au>
Subject: simultaneous dbmopen
Message-Id: <32F954EC.7327@creativeaccess.com.au>

Hi All...

I've written a simple cgi perl script
which uses a dbmopen call.

Everything's fine, until it comes to a point where
simultaneous calls are made to the same script.

One processes opens the dbm file successfully, other processes can't
accesses the file.

$! reports "try again"

I'm running perl 5.001 and the man page states...
 .
 .
Multiple simultaneous DBM implementations         
A Perl program may now access DBM, NDBM, SDBM, GDBM, and Berkeley DB
files from the same script simultaneously.  In fact, the old dbmopen
interface has been generalized to allow any variable to be tied to any
object class which defines its access methods.
 .
 .

Can anyone help me out?

Regards,
james


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

Date: Wed, 05 Feb 1997 18:41:09 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: space stripping
Message-Id: <32F93626.1381@5sigma.com>

Tad McClellan wrote:
> I've checked for it several times at Borders and Book Stop. Neither
> even could tell that it was a book in print...

You must not have looked at the Borders where I bought my copy.

	-joseph

-- 
Joseph N. Hall   http://www.5sigma.com/joseph/  mailto:joseph@5sigma.com
Proprietor, 5 Sigma Productions          P.O. Box 6250 Chandler AZ 85246
Perl training & software, C++/C/etc. software, web stuff, original music 
*Effective Perl (A-W Spring '97) .. http://www.5sigma.com/perl/book.html


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

Date: 6 Feb 1997 01:55:52 GMT
From: Chaimf@cris.com (Chaim Frenkel)
Subject: Re: Trimming Dollar Value
Message-Id: <5dbdn8$e3c@chronicle.concentric.net>


Tom Christiansen (tchrist@mox.perl.com) (comp.lang.perl.misc <5da43s$p8i$1@csnews.cs.colorado.edu>) wrote:
: :P/S: I want to actually trim it rather than formatting to STDOUT using
: :printf().

: This is all respecting your probably unreasonable aversion to the oft-used
: sprintf function:
: 
:     $it = '3.4405';
:     $it = sprintf "%.2f", $it;

Note, he said TRIM not ROUND.

Depending on architecture and on some boxes the setting of the rounding
method, any and many wrong answers are to be found.

The manual rounding method is probably the best way of getting it right.

<chaim>


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

Date: Thu, 06 Feb 1997 02:37:38 GMT
From: geoff.cox@dial.pipex.com (Geoff Cox)
Subject: Word wrap script - it works!
Message-Id: <32f942bd.9173785@news.dial.pipex.com>

Hello,

Thanks for the useful suggestions from several people.

The following seems to be necessary if you send TEXTAREA info from a
form via email (sendmail in this case) - otherwise the text comes out
in one long string. Neither Netscape v3 or MS IExplorer appear to
support WRAP="Physical" or "Virtual" as far as I can see.....?

Can anyone tell me how to use the Wrap.pm instead of my re-invention
of the proverbial wheel??!

Cheers

Geoff

$text = $FORM[26];

$line_len = 80;

while ($text =~ /./g) {

        if ($text !~ /.{$line_len}/) {
        $final .= $text . "\n";
        last;
        } else {
        $text =~ /.{1,$line_len}.\s/;
        $final .= $& . "\n";
        $text = $';
        }
        
}

$FORM[26] = "\n\n" . $final;



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

Date: 6 Feb 1997 02:47:53 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Word wrap script - it works!
Message-Id: <5dbgop$sm4@fridge-nf0.shore.net>

Geoff Cox (geoff.cox@dial.pipex.com) wrote:

: Can anyone tell me how to use the Wrap.pm instead of my re-invention
: of the proverbial wheel??!

I'm sorry to hear that your system doesn't have pod2text, where you
might have been able to do pod2text /usr/local/lib/perl5/Text/Wrap.pm.  :-(

>From the pod for Text::Wrap:

NAME
    Text::Wrap -- wrap text into a paragraph

SYNOPSIS
            use Text::Wrap;
            
            $Text::Wrap::columns = 20; # Default
            print wrap("\t","",Hello, world, it's a nice day, isn't it?");


--
Nathan V. Patwardhan
nvp@shore.net
"Outshined outshined outshined!"
	--Chris Cornell from Soundgarden


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

Date: 6 Feb 1997 03:17:43 GMT
From: shishir@ruby.ora.com (Shishir Gundavaram)
To: shishir@ora.com
Subject: Re: Word wrap script - it works!
Message-Id: <5dbign$8gd@amber.ora.com>

Geoff Cox (geoff.cox@dial.pipex.com) wrote:

[other stuff deleted]

Instead of the code below, how about some short and simple:

$line_len = 80;
$text =~ s/(.{0,$line_len})\s/$1\n/og;

If your $text contains newlines, etc, you can translate them
to spaces before you invoke the regexp above, like so:

$text =~ s/\n/ /g;

--Shishir

Original code follows:

: $text = $FORM[26];
: 
: $line_len = 80;
: 
: while ($text =~ /./g) {
: 
:         if ($text !~ /.{$line_len}/) {
:         $final .= $text . "\n";
:         last;
:         } else {
:         $text =~ /.{1,$line_len}.\s/;
:         $final .= $& . "\n";
:         $text = $';
:         }
:         
: }
: 
: $FORM[26] = "\n\n" . $final;
: 


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

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

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 V7 Issue 903
*************************************

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