[7121] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 746 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 19 18:08:03 1997

Date: Sat, 19 Jul 97 15:00:44 -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, 19 Jul 1997     Volume: 8 Number: 746

Today's topics:
     Re: 12 FREE Perl Scripts... (Igor3000)
     Re: 2 xor 0 -> 1 (??) (Abigail)
     Re: 500 Server Error - Perl & Win 95 PWS sdklfjs@sdfklsdj.com
     ANNOUNCE: ePerl 2.2.0 (Embedded Perl 5 Language) (Ralf S. Engelschall)
     Re: Can I send a fax through cgi? (Colin Macleod)
     cgi perl <p.luca@macronet.it>
     Re: CGI.pm file uploads with Internet Explorer (Thomas R. Hall)
     Re: chmod (Even Holen)
     Re: command line perl prob (perl 5.004_01 in shell scri (M.J.T. Guy)
     DESPARATLY NEED CGI INSTALLER (Igor3000)
     Evaluating Strings <info@toronto-red-lite.com>
     Re: Evaluating Strings <sfairey@adc.metrica.co.uk>
     From file handle to filename? <kistler@erdw.ethz.ch>
     Re: From file handle to filename? (Even Holen)
     Getting 'eval' to shut up (Bernard Cosell)
     Re: Getting 'eval' to shut up (M.J.T. Guy)
     Re: GGAAAAKK!! Bad Perl week - now DBD Oracle troubles (Chris Faehl)
     HELP INSTALL CGI PERL FOR ME (Igor3000)
     Re: help with SNMP.pm module neal@pernet.SPAMnet
     Re: Hex,..octal??? (Honza Pazdziora)
     Re: How to keep track of context ('{' and '}') in LaTeX <seo@sorona.se>
     Re: How to round numbers in perl <aegis@mail.cyberwar.com>
     HUGE INCOME l39e19fty@ctc-mundo.net
     Re: Is there a tool similar to lex and awk combined (Abigail)
     Re: Learning Perl ..Help?? (Dave Till)
     Re: Mail management via web <p.luca@macronet.it>
     Memory creep importing data to Berkeley DB <pete@spry.com>
     Need Cgi Installation (Igor3000)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 18 Jul 1997 11:43:43 GMT
From: igor3000@aol.com (Igor3000)
Subject: Re: 12 FREE Perl Scripts...
Message-Id: <19970718114301.HAA07342@ladder02.news.aol.com>

hi 
i desparatly need a cgi installer for my website

i need to check referral for a directory that i want to 

protect from any seeking to download files from

without first going through my password encoded page..

problem is i got alot of files on one page ..

basically i need a referral script installed..

so no one can download the files without getting

referral from my own site.. 




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

Date: Fri, 18 Jul 1997 15:35:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 2 xor 0 -> 1 (??)
Message-Id: <EDItyv.2E0@nonexistent.com>

robert c. combs (xrcc0494@dcaca037.ca.boeing.com) wrote on 1414 September
1993 in <URL: news:33CBBBA3.13AC@dcaca037.ca.boeing.com>:
++ Actually, I've always thought it odd that a logical operator would
++ return ANYTHING OTHER than 1 or 0 (True or False). But, that could
++ just be the result of too much symbolic logic. :)

Actually, I've always thought it odd that people supply
ANYTHING OTHER than 1 or 0 (True or False) as operands to
logical operators.

If you only use 1 and 0 as operands, you will only get 1 or 0
back.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Fri, 18 Jul 97 14:56:09 GMT
From: sdklfjs@sdfklsdj.com
Subject: Re: 500 Server Error - Perl & Win 95 PWS
Message-Id: <5qo09i$9rg@kew.globalnet.co.uk>

In article <5q8qhh$qv5$1@auto.med.ohio-state.edu>, men2@auto.med.ohio-state.edu (Mark Nielsen) wrote:
>I read a webpage somewhere about how to get perl to work on a microsoft
>webserver. It was titled "What Microsft doesn't want you to know.".
>Sorry, i forget where it is. It gave a very nice demonstration of how to
>get perl scripts running on the Microsft webserver.
>
>Mark
>

The Article in question is @:

http://www.pmpcs.com/support/fp/perlwithPWS.htm

Enjoy!



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

Date: 18 Jul 1997 14:46:33 GMT
From: rse@engelschall.com (Ralf S. Engelschall)
Subject: ANNOUNCE: ePerl 2.2.0 (Embedded Perl 5 Language)
Message-Id: <5qnvk9$87r$1@en1.engelschall.com>

  After a long 2.2 beta cycle I'm proud to release...
        ____           _ 
    ___|  _ \ ___ _ __| |
   / _ \ |_) / _ \ '__| |
  |  __/  __/  __/ |  | |
   \___|_|   \___|_|  |_|
                         
  ePerl -- Embedded Perl 5 Language

  <URL:http://www.engelschall.com/sw/eperl/>

  Version 2.2.0 (18-07-1997)

  ePerl interprets an ASCII file bristled with Perl 5 program statements by
  evaluating the Perl 5 code while passing through the plain ASCII data. It
  can operate in various ways: As a stand-alone Unix filter or integrated Perl
  5 module for general file generation tasks and as a powerful Webserver
  scripting language for dynamic HTML page programming.

  Copyright (c) 1996-1997 Ralf S. Engelschall, All rights reserved.

  Summary of Program
  ==================

  o  Implementation:   - ANSI C
  o  Min Requirements: - underlaying Unix derivate
                       - ANSI C compiler
                       - already installed Perl 5.004 (full functionality)
                         or at least 5.003+EMBED (minimum functionality)
  o  Distribution:     - freely available
                       - no charge
                       - GNU General Public License or Artistic License
  o  Status:           - Genesis: March 1996
                       - First major release: March 1996 (1.0)
                       - Last  major release: April 1997 (2.1)
                       - stable

  Major Changes from Version 2.1 to 2.2
  =====================================

  o  Changed Quotation/Delimiter Parsing
  o  Smarter and Optimized Parser
  o  Support for '=' block prefix
  o  HTML entity conversion inside ePerl blocks
  o  Perl Taint and Warning modes now available
  o  New ePerl Preprocessor
  o  New option -I for include path
  o  New Perl 5 interface module for ePerl parser: Parse::ePerl
  o  New ePerl emulation handler for Apache+mod_perl: Apache::ePerl
  o  New option -h for consistency ;-)
  o  First attempt to write a converter from (X)SSI to ePerl
  o  Built-in GIF images
  o  Enhanced portability
  o  Compiles and runs out-of-the-box on major Unix derivates.




                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com


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

Date: 18 Jul 1997 11:25:45 GMT
From: cmacleod@mcs.dundee.ac.uk (Colin Macleod)
Subject: Re: Can I send a fax through cgi?
Message-Id: <5qnjrp$pk7$1@dux.dundee.ac.uk>

Christopher Chan (chris@cybertech.com.sg) wrote:
: Is it possible??

You can find an attempt of mine to do this at
ftp://ftp.mcs.dundee.ac.uk/pub/cmacleod/web-fax.0.1.tar
It's fairly crude but might help you to get started.

--
Colin Macleod,
SW Eng., Intrasoft SA, Athens, Greece.

EMail (remove added spaces) :  macleod @ intrasoft . gr


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

Date: Sat, 19 Jul 1997 19:01:25 +0200
From: "Luca" <p.luca@macronet.it>
Subject: cgi perl
Message-Id: <5qqs40$e7i$1@news.flashnet.it>

Hi,
I'm looking for a  script ables to change my user's password.
I thought to the "open" command  for a pipe to the passwd, with the next
simple script...

open ( PASWD,"|passwd user");
print PASWD "password\n";
print PASWD "password\n";
close (PASWD);

but it doesn't works !!!      WHY??!!!

Is Ther anybody  that can help me!!




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

Date: 18 Jul 1997 13:43:55 GMT
From: trhall@ezinfo.ucs.indiana.edu (Thomas R. Hall)
Subject: Re: CGI.pm file uploads with Internet Explorer
Message-Id: <5qnrur$27g$1@dismay.ucs.indiana.edu>

: Does anyone know if there is an easy way to do file uploads with
: Internet Explorer?  CGI.pm makes file uploads really easy assuming that
: you are using netscape 2.0 or better, but I have seen nothing similar
: for Internat Explorer.

Internet Explorer (all versions, including the new 4.0 betas) does not
support HTTP-based file upload from the browser.  This is something that is
supported by other browsers, and there is an RFC out for it (cannot
remember the number right off hand), but it has never supported this
feature.  

I was hopeful that they would include support for this in the upcoming 4.0
version, but no such luck so far.  Other browsers support this type of
upload (in addition to Netscape Navigator), so hopefully IE will add this
to their list of features, though I wouldn't hold my breath.

-- 
Thomas R. Hall <trhall@indiana.edu>  BPO Web Services Coordinator
http://php.indiana.edu/~trhall     Indiana University Bloomington
RSA KeyID: 0x8F6DFD27   DSS/DH KeyID: 0x443AE82D   trhall@acm.org



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

Date: 19 Jul 1997 11:44:07 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: chmod
Message-Id: <slrn5t1a0i.7og.evenh@ra.pvv.ntnu.no>

In article <oeelo34w5o7.fsf@alpha.hut.fi>, Jarkko Hietaniemi wrote:
>:      chmod 755, $file;
>
>PLEASE use -w.
>
>It would have told you that you just changed your file to "writable by
>all, readable only by group, executable by all except group".  Well,
>not in so many words -- but it would have warned.

I was rather stunned by this answer although I do know about octal
representation and decimal representation. But after checking what 755
in decimal representation is in octal representation (1363) I just have
to conclude with:

   You've missed that 755 alsos sets the sticky bit, or save text image
   bit... Quite useful under the right OS. 

To original poster: There is serious difference between 0755 and 755...

Regards,
Even Holen
-- 
<><   Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/   :-)


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

Date: 18 Jul 1997 16:47:21 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: command line perl prob (perl 5.004_01 in shell scripts)
Message-Id: <5qo6mp$rni@lyra.csx.cam.ac.uk>

In article <33CF9090.5523@up.net>, Raymond K. Bush <rbush@up.net> wrote:
>Under perl 5.003 i had a number of one liners i used to type for things
>such as killing groups of processes. Now that i've updated to perl
>5.004_01 they no longer seem to work.  Any ideas as to what broke or
>what i need to change?  
>
>for example:
>
><!>
><!>kill -9 ` ps -ef|grep in.foo.d|grep -v grep|awk '{ print $2 }'|perl
>-new 'chop; print $_." ";' ` 
><!>Can't open chop; print $_." ";: No such file or directory
><!>
>
>This used to kill all in.foo.d lines from the ps

I see exactly the same effect; this worked in 5.003 but not in 5.004_01.
It seems to be because the -e is not the last switch in the group.
I always write  "perl -nwe ... " in these cases, and that works OK.
So there's a fix to get you going.

I don't recall this as a documented change, so I'd call it a bug.


Mike Guy


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

Date: 18 Jul 1997 11:47:56 GMT
From: igor3000@aol.com (Igor3000)
Subject: DESPARATLY NEED CGI INSTALLER
Message-Id: <19970718114701.HAA11048@ladder01.news.aol.com>

i desparately need a cgi installation 

it's a script to ensure that files are only accessable 

from the page i say.. sort of a referral script..

please help me someone please..

I have the script i think .. here it is.. have a look and tell me

if it will check referral and keep out any outside attempt at entry



 #!/usr/bin/perl

 

 $ref = $ENV{'HTTP_REFERER'};

 

 if ($ref && $ref eq "http://igor3000.redscull.com")

  {

   print "location: http://igor3000.redscull.com/gimme200.RA\n\n";

 }

 else

 {

   print "content-type: text/html\n\n";

   print "<HTML><BODY>You cannot access this page</BODY></HTML>\n\n";

 }

 

Please tell me a nice cgi person will install it for me!!!!!





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

Date: Fri, 18 Jul 1997 10:12:53 -0500
From: "Chris Bradley" <info@toronto-red-lite.com>
Subject: Evaluating Strings
Message-Id: <33cf784f.0@news.total.net>

I am trying to evaluate a string that contains a variable. For example:

$lcuser = 'Frank';
$x = "search.pl?user=$lcuser";
print "x=" . $x;

I want the output to be: x=search.pl?user=Frank

I have tried using the eval($x) function, but it was returning a empty
string.

Any help is greatly appreciated, please reply to me privately and to the
group.

thanks





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

Date: Fri, 18 Jul 1997 16:36:42 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Chris Bradley <info@toronto-red-lite.com>
Subject: Re: Evaluating Strings
Message-Id: <33CF8D89.AEE749C2@adc.metrica.co.uk>

Chris Bradley wrote:

> I am trying to evaluate a string that contains a variable. For
> example:
>
> $lcuser = 'Frank';
> $x = "search.pl?user=$lcuser";
> print "x=" . $x;
>
> I want the output to be: x=search.pl?user=Frank
>
> I have tried using the eval($x) function, but it was returning a empty
>
> string.
>
> Any help is greatly appreciated, please reply to me privately and to
> the
> group.
>
> thanks

'comp.lang.perl' no longer exists so don't try posting to it.

See the thread   'Using variables from a template file' ( which is
barely a day old ) and the assorted replies....

THEN READ THE FAQ!

Simon



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

Date: Fri, 18 Jul 1997 17:33:23 +0200
From: Per Kistler <kistler@erdw.ethz.ch>
Subject: From file handle to filename?
Message-Id: <33CF8CC3.B5BC08FA@erdw.ethz.ch>

Hi All

How do I get the file name from the file handle?

First I store the file handlies like: @handles = ( \*A, \*B,....);
Then I iterate over it with: for $ref ( @handles ){} 
but then I'd like to know the file name again...

Thanks for a hint, Per.
-- 

Per Kistler 
Programmer (Unix/Perl/C++)
kistler@erdw.ethz.ch    
http://www.erdw.ethz.ch/~kistler
Institute for Isotope Geology and Mineral Resources, ETH, Switzerland 
---------------------------------------------------------------------


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

Date: 18 Jul 1997 16:05:52 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: From file handle to filename?
Message-Id: <slrn5sv4vg.na6.evenh@ra.pvv.ntnu.no>

In article <33CF8CC3.B5BC08FA@erdw.ethz.ch>, Per Kistler wrote:
>How do I get the file name from the file handle?

I think this is rather hard to achieve... But I'm on thin ice here...

But the easiest way to get the file names is to store the filename when
you creates the handles... Build an array of filenames using the handles
as keys into the array...

Hope this helps.

Regards,
Even Holen
-- 
<><   Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/   :-)


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

Date: Fri, 18 Jul 1997 12:44:06 GMT
From: bernie@rev.net (Bernard Cosell)
Subject: Getting 'eval' to shut up
Message-Id: <33d063fe.571834876@news.rev.net>

I'm using 5.0 patchlevel 3 on Linux and I'm having a problem with
'eval'.  I use 'use strict' and '-w' as a matter of course.  I'm doing
an 'eval' of a string that, in fact, has assorted errors and problems.
What I *want* is that when the string to eval is broken, it should
just do as the manual says and return an undef and leave an error
message in $@.  What I'm *getting is a lot of nonsense like

Bare word found where operator expected at (eval 3) line 1, near"","W"
        (Missing operator before W?)
String found where operator expected at (eval 3) line 1, near "318",""
        (Missing operator before ","?)
Bare word found where operator expected at (eval 3) line 1, near "",
"Friday"
        (Missing operator before Friday?)

written to stderr.  Ugly though it is, I've tried:
    { no strict; local $^W=0 ; $temp = <eval> ; }
but STILL the eval pours its stuff to stderr.  Is there some way to
get it to be quiet so *I* can handle the error and control what the
user sees?

Thanks!
  /Bernie\
-- 
Bernie Cosell                        mailto:bernie@rev.net
Roanoke Electronic Village


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

Date: 18 Jul 1997 15:00:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Getting 'eval' to shut up
Message-Id: <5qo0dt$mt1@lyra.csx.cam.ac.uk>

Bernard Cosell <bernie@rev.net> wrote:
>I'm using 5.0 patchlevel 3 on Linux and I'm having a problem with
>'eval'.  I use 'use strict' and '-w' as a matter of course.  I'm doing
>an 'eval' of a string that, in fact, has assorted errors and problems.
>What I *want* is that when the string to eval is broken, it should
>just do as the manual says and return an undef and leave an error
>message in $@.  What I'm *getting is a lot of nonsense like
>
>Bare word found where operator expected at (eval 3) line 1, near"","W"
>        (Missing operator before W?)
>String found where operator expected at (eval 3) line 1, near "318",""
>        (Missing operator before ","?)
>Bare word found where operator expected at (eval 3) line 1, near "",
>"Friday"
>        (Missing operator before Friday?)
>
>written to stderr.  Ugly though it is, I've tried:
>    { no strict; local $^W=0 ; $temp = <eval> ; }
>but STILL the eval pours its stuff to stderr.  Is there some way to
>get it to be quiet so *I* can handle the error and control what the
>user sees?

Errors from the compiler are either warnings (when the compiler is
carrying on) or 'die' when the compiler gives up.   The latter are
trapped by eval and returned in $@; the former are not.    You need
to set $SIG{__WARN__} to catch and process these, for example

     # untested code
     { my $warnings = '';
       local $SIG{__WARN__} = sub { $warnings .= "@_" };
       eval "mystuff";
       if ($warnings or $@) { process errors ... };
     };

This is (briefly) mentioned in the "eval" entry in perlfunc.


Mike Guy


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

Date: 18 Jul 1997 08:02:26 -0600
From: cfaehl@tahiti.cs.unm.edu (Chris Faehl)
Subject: Re: GGAAAAKK!! Bad Perl week - now DBD Oracle troubles
Message-Id: <5qnt1i$rhr@tahiti.cs.unm.edu>

In article <33CED4AB.17B0@ixlabs.com>,
Chris Schoenfeld  <chris@ixlabs.com> wrote:
>Earlier this week I installed DBI/DBD Oraperl into 2 brand-spanking new
>Perl installations (5.003/5.003_07) on a Sun Sparc 20 running Solaris
>2.5.
>
>Worked great!
>
>Now I have installed 2 more Perls on the same box - 5.004 and 5.004_01,
>and DBD Oraperl 'make test' dumps core with BOTH of them - WAA!!!
>
>Any ideas?

Sure - rebuild/reinstall DBI/DBD Oracle. Perhaps the module you installed
under 5.003 used something specific in the release that has moved about
some in 5.004. 

That's my best guess, but it seems reasonable - I know for a fact that DBI/DBD
works great under 5.004_01 (though I haven't checked under Solaris yet -
works fine for SunOS 4.1.4 anyway). 



-- 
-- Chris Faehl (cfaehl@cs.unm.edu)



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

Date: 18 Jul 1997 11:48:32 GMT
From: igor3000@aol.com (Igor3000)
Subject: HELP INSTALL CGI PERL FOR ME
Message-Id: <19970718114800.HAA11074@ladder01.news.aol.com>

i desparately need a cgi installation 

it's a script to ensure that files are only accessable 

from the page i say.. sort of a referral script..

please help me someone please..

I have the script i think .. here it is.. have a look and tell me

if it will check referral and keep out any outside attempt at entry



 #!/usr/bin/perl

 

 $ref = $ENV{'HTTP_REFERER'};

 

 if ($ref && $ref eq "http://igor3000.redscull.com")

  {

   print "location: http://igor3000.redscull.com/gimme200.RA\n\n";

 }

 else

 {

   print "content-type: text/html\n\n";

   print "<HTML><BODY>You cannot access this page</BODY></HTML>\n\n";

 }

 

Please tell me a nice cgi person will install it for me!!!!!



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

Date: 18 Jul 1997 15:24:32 GMT
From: neal@pernet.SPAMnet
Subject: Re: help with SNMP.pm module
Message-Id: <5qo1rg$pbo$1@news.pernet.net>

Andrew Farrior <afarrior@vc.cc.tx.us> wrote:

[SNIP]
: i'm trying to use the SNMP module to probe my router for a particular
: SNMP variable:

: at.atTable.atEntry.atPhysAddress.1.1.192.168.1.1


[snip, second verse]
: i need to change the 'ifNumber' to something, but i don't know what.
: how do i execute the 'get' command to retreive the value i want?

Try:

$obj->get(['atPhyAddress.1.1.192.168.1',1]);

I pretty much gave up on cmu-snmp and it's derivitaves.  It still leaks like
a seive.  Perl's garbage collection picks most of it up, but it still gets
real big.  I run some polling stuff, and it eventually gets too big and has
to be restarted.

I haven't been too much help, but maybe enough to get you going in the right
direction.



-- 
--
Neal Rigney, PERnet Communications, (409)729-4638
neal@mail.pernet.net
"I've seen better bandwidth between two gorillas with flash cards!"


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

Date: Fri, 18 Jul 1997 11:20:03 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Hex,..octal???
Message-Id: <adelton.869224803@aisa.fi.muni.cz>

Fractture <rroberts@gowebway.com> writes:

> I think I need to learn the hex coding and octal coding systems,...
> I keep seeing them and have no knowlage about them,..exept the colors in
> html which is not what I am wanting.
> I am wanting to know about things like this
> statement..../[\000-\377]{5}/
> Or when I was trying to write a script that removed the ^M from a DOS
> text file,...and I couldn't get the expression to work,...he said
> s/015//g  or something like that.
> I know what the s and g are, but only know that 015 is a octal and must
> mean ^M and really want to know them.
> 
> So, where do I find this information,...on the net prefrably.

Decimal digits run from 0 to 9. Once you want to express number greater
than 9, you add another digit: 9 -> 10. So 10 = 9 + 1 in decimal base.
The number 235 in fact means

	2 * 100 + 3 * 10 + 5 * 1 (or 2 * 10^2 + 3 * 10^1 + 5 * 10^0)

If you increase that digit 3 to 4 on the second position, you are
adding 10 to the total number: 235 + 10 = 245.

In the octal base, you have only digits 0 to 7. If you add 1 to that
7, you do not have symbol 8 available and have to add another digit.
So, in octal system, 7 + 1 = 10. Let's see what octal 0235 means (in
Perl and other languages, the 0 at the beginning of the number denotes
octal number). OK,

	0235 = 2 * 8^2 + 3 * 8^1 + 5 * 8^0 = 2 * 64 + 3 * 8 + 5, which
					is 157 in decimal notation.

Now, what is 0235 + 010? It's 0245 and means increase 0235 by octal
number 010, and that is decimal 8.

With hexadecimal numbers, you have digits 0 to 9 and a to f, so 0 to
15 in fact and the principle stays the same.

Now: 015 is 0 * 64 + 1 * 8 + 5 = 13 and that is decadic value of
carriage return character in the ASCII set. You want to remove them
when you convert from DO$ and will use s/\015//g to remove all
characters with this octal value from the string.

And now, what the \000-\377 mean. Zero is zero and 0377 is octal value
for decadic 255 (try it). And as you might know, 255 is important
because it's the highers number you can express in one byte. And that
is because one byte is eight bits, or 11111111 in binary. And in
binary, you only have digits 0 and 1, so 1b + 1b = 10b.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 18 Jul 97 14:29:38 GMT
From: "Andreas Olsson" <seo@sorona.se>
Subject: Re: How to keep track of context ('{' and '}') in LaTeX with Perl?
Message-Id: <01bc9387$4f62bbf0$6db8ecc2@sorona>

>> Hi!
>> 
>> I have a problem I can't figure out.
>> I have the following LaTeX code:
>> 
>> \textbf{CL$_{cr}$ (mL/min)}
>> 
>>I want it to look like this after filtering:
>> 
>><emphasis>CL${CL$_{cr}$ (mL/min)</emphasis>
>> 
>>I have tried with the following code:
>> 
>> s#\\textbf{(.*?)}#<emphasis>$1</emphasis>#gs;
>> 
>> The obvious problem with this regexp is that it finds the *first*
>> end-brace, and not the last, which is what I want.
>> This is a general problem, offcourse there it can exist multiple
>> brace-pairs within the \textbf{...} and I want to extract the correct
text.
>> In some way I have to track brace-pairs to find the proper end-brace,
but I
>> can't find out a way to do this in a simple way.
>> 
>> Thanks in advance

Thank you all for your tips! Now I've taken a step in right direction, but
the real world is more complex still...
My task is to filter a LaTeX document into an SGML-instance. I would really
appreciate if someone has any further tips to share.

LaTeX commands can be written in different ways:

1) \{...}
2) {\...}
3) \... </entry>   (if inside a table entry no braces are needed, the end
of entry ends the command)

In addition, to make it further complex, these syntaxes can be nested
inside each other as well as we can have brace-pairs with text inside that
is *not* a start or end of a command. Below follows some more examples. 

examples:

\textbf{Hello \textit \textsc world}
\textbf{\textit{Hello} \textsc world}
{\small Hello \textbf{world}  \textit and {now} italic}
{\rm QTc} = \frac{{\rm QT}}{\sqrt{60/{\rm heart~rate}}}
<entry>Hello \textbf world</entry>

Here's jet another problem introduced, the \frac{...}{...} for fractions.
It takes two arguments. Here for example {\rm QT} becomes <rm>QT</rm> etc.
The braces around 'now' is ignored by LaTeX and shall be removed.

My solution for now is as follows:

$count = 1;

while ($count > 0) {
    $count = 0;

   # Treat all commands with declare-syntax, i.e. ...\\...}|</entry
   while (s#\\(\w+)([^{}\\]*)(}|</entry)#&translate($1,$2) . $3#gse) {
       $count++;
   };

    # Treat all commands with declare-syntax, i.e. {\\...}
    while (s#{\\(\w+)((?:[^{}\\]|\\.)*)}#&translate($1,$2)#gse) {
        $count++;
    }  

    # Treat all commands with command-syntax, i.e. \\{...}
    while (s#\\(\w+){((?:[^{}\\]|\\.|{.*?})*)}#&translate($1,$2)#gse) {
        $count++;
    }  
  
} # while

This is how my output looks like:

<textbf>Hello <textit><textsc> WORLD</textsc></textit></textbf>
<textbf><textit>Hello</textit>  WORLD</textbf>
{ Hello <textbf>world</textbf>  <textit> and now italic</textit>}
{<rm> QTc</rm>} = <FRAC>{{<rm> QT</rm>}}{<sqrt>60/{<rm> heart
rate</rm>}</sqrt>}
<entry>Hello <textbf> world</textbf></entry>

Without the outer while loop for example the \small would not be
substituted since it will not match because of the 
\textbf{world}. The while loop stops when none of the three regexs matches.

Another problem is that the first regexp matches \\small ... } and the
braces will be left to the output file (since the closing brace is inserted
again). I would want to write the first regexp s#[^{]\\(w+)... that is
don't match a \\ with { before it. But now comes the most myserious of all.

With the small testfile this works, but when I run it on my inputfile that
is several 100 kilobytes it all ends up with a message "Runtime
exception"(just because the harmless [^{] is added). This message also
appears sometimes with different input and when I try to alter the order
that the three regexp's are executed.

Thanks again

/Andreas Olsson, aol@sorona.se




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

Date: 18 Jul 1997 15:34:22 GMT
From: Aegis <aegis@mail.cyberwar.com>
Subject: Re: How to round numbers in perl
Message-Id: <5qo2du$bsa$1@bandit.cyberwar.com>

James Phillips <phillips@nortel.ca> wrote:
: Hi Folks,
: Does anyone know how to round numbers in perl?
: If you do please post.
:
: 	#We want x to be 62 and y to be 61 on the screen
:
: 	$x = 61.7;
: 	$y = 61.2;
:
: 	print "$x, $y\n";
: Jim Phillips
: phillips@nortel.ca



 To round an arbitrary number $num to a whole number : 

 $num = $num + .5; 
 $num =~ s/(\d*)\.\d*/$1/;




Aegis


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

Date: 18 Jul 1997 16:23:38 GMT
From: l39e19fty@ctc-mundo.net
Subject: HUGE INCOME
Message-Id: <5qo5aa$8tb@news0-alterdial.uu.net>


HOW TO BUILD A PART-TIME BUSINESS WITH EXECUTIVE
INCOME WHILE KEEPING YOUR PRESENT JOB!  LEVERAGE
YOUR EFFORTS WITH A UNIQUE METHOD FOR RESIDUAL 
INCOME WORKING 5-20 HOURS PER WEEK AT YOUR OWN PACE.

NEW DIVISION OF A MAJOR (NASDAQ) 93-YEAR-OLD
PHARMACEUTICAL COMPANY, SEEKS TWO PROFESSIONALS
PART-TIME OR FULL-TIME FROM WHEREVER YOU ARE,
FOR EXPANSION IN THE UNITED STATES, MEXICO, HONG KONG, 
ASIA, ETC.  STOCK OPTIONS ON TOP OF THE MOST LUCRATIVE 
PAY PLAN IN THE INDUSTRY.  

FOR FREE AUDIO CALL OUR 24 HOUR RECORDED MESSAGE NOW.
  
THEN YOU CAN HEAR WHY TOP ENTREPRENEURS, MEDICAL, AS 
WELL AS, BUSINESS PROFESSIONALS ARE DIVERSIFYING
THROUGH US.            

            24 HR. MESSAGE
            1-281-587-6863


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

Date: Fri, 18 Jul 1997 15:09:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Is there a tool similar to lex and awk combined
Message-Id: <EDIsrv.F7@nonexistent.com>

Barrie Walker (bwalker@csl.co.uk) wrote on 1415 September 1993 in
<URL: news:01bc91f0$49c11360$843482c2@fruin.csl.co.uk>:
++ Hi,
++ Can't think of an succinct awk way off hand,
++ 
++ The perl script below does it easily enough if it's all single character
++ input.
++ (complete (& utter) ignorance of lex showing here)
++ 
++ while (<>) { for (split //) { defined &$_ ? &$_ : &duh }}
++ sub duh {}
++ 
++ sub a {  # whatever for 'a' }
++ sub h {  # etc }
++ sub C {}
++ # etc
++ 
++ If you need access to following parameters try replacing the first line
++ above with this one
++ undef $/; @c= split //, <>; defined &$_ ? &$_ : &duh while $_ = shift @c;
++ You can get the next character with
++ $p = shift @c;


We discussed this problem on IRC/#perl last night, and some benchmarking
showed that 
$foo = reverse $string; while (defined $foo) {$char = chop $foo;}
is the fastest method to read characters one by one.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 18 Jul 1997 10:49:50 -0400
From: davet@angel.uunet.ca (Dave Till)
Subject: Re: Learning Perl ..Help??
Message-Id: <5qnvqe$62v@angel.uunet.ca>

In article <5qlhe6$pv7@mimsy.cs.umd.edu>, Charles Lin <clin@cs.umd.edu> wrote:
>|| Not to sound like  I am sucking up, but the PERL book is one of the best
>|| computer books ever written. I hate those learn anything in 7 days
>[...]
>
>    Which PERL book is that?   There are two by O'Reilly (publishing).
>
>    Anyway, the reason there are so many "learn blah in 7 days" is 
>precisely because people learn differently.

And also because they have differing levels of experience.  I don't
think it's possible for one computer book to satisfy all readers:
beginners would get confused by such a book, and experts would get bored.

I think O'Reilly books in general are great, but they are clearly
intended for people with significant experience in the field.
For example, the first page of Chapter 1 of *Programming Python*
says that Python is appealing because of its "support for object-
oriented development", "powerful programming constructs", "extendible
and embeddable architecture" and "remarkably clear syntax and
coherent design".  Most of the readers of this group would know
what the author is talking about, and would have some idea of
what sort of language Python is, just from this description.
A beginning reader, however, would be hopelessly befuddled.
[NB:  I hasten to point out that I do not think the Python book
is a bad book -- just that it's not suitable for beginners.]

Most "learn X in Y days" books assume very little previous
knowledge.  Experienced programmers would find it frustrating
to spend time reading pages that tell them what they already know.
For example, my book, *Teach Yourself Perl in 21 Days*, uses the
first chapter to cover details such as what "white space" is, what
statements and tokens are, what a function invocation is, and so on.
People without a lot of background don't necessarily know this stuff.

Plus there are other (not necessarily intuitive) concepts, such
as round-off error, that beginners would not know but experts
would not need explained to them.  I don't know about you, but
I didn't find out why an expression such as 100000000 + 0.01 -
100000000 is a bad idea until about my third year of computer
science -- and I went to Waterloo, which is considered a good
school.  And using == to compare two floating-point numbers
seems, at first glance, to be a sensible thing to do, doesn't it?

I think the merit of any book must be determined by how
good it is at meeting the needs of its declared target audience.
-- 
--Dave Till, Dilettante, Toronto, Ontario, Canada (davet@[NOSPAM]uunet.ca)
view Baseball Tour '97:  http://www.interlog.com/~davet/bbtrip1.html
"The mental image of millions of old ladies shouting 'Snap' at each
other merely confirms my ideas about the futility of life." - Peter Cook


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

Date: Sat, 19 Jul 1997 16:20:10 +0200
From: "Luca" <p.luca@macronet.it>
Subject: Re: Mail management via web
Message-Id: <5qqilk$d34$1@news.flashnet.it>

OOPS 
my mail!! p.luca@macronet.it
 Luca ha scritto nell'articolo <5qqiig$cs6$1@news.flashnet.it>...
>I'm looking for a perl script to manage my mail via web.
>I would like to check for mail, delete messages and to do all other
actions
>I can make with Eudora but..... via web!
>Is it possible??? can anyone help me ??????
>Please answer me in mailbox.
>
>
>
>
>
> 




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

Date: Thu, 17 Jul 1997 17:36:30 -0700
From: Dan Peterson <pete@spry.com>
Subject: Memory creep importing data to Berkeley DB
Message-Id: <Pine.GSO.3.96.970717163401.3686U-100000@gort>


OS: Solaris 2.5
Perl: 5.004_01
Berkeley DB: 1.85

I have a Perl program that reads each line of a text file and imports it
into a Berkeley DB file.  The program takes a long time to run for 2
reasons:

  1:  # of records (~131,000 recs, avg 46 bytes/rec)
  2:  the DB file is open/closed for each record

Number 1, I can't do anything about.  Number 2, I don't want to keep the
database open for the entire import, (or even for a set of records),
because I don't want to prevent other processes from having access to the
database (my DB io module locks the database, using fcntl(), every time
it's opened for a write).

I'm not that concerned about the speed of the import, I'm concerned about
the amount of memory it takes up.  I started the process, and also
collected the memory it was using (via top) every 5 seconds.

When it started, it was using 4140K (3624K resident), after loading
~26,000 records, it was up to 37M (26M resident)!  The entire txt file is
only 6M, and the resulting DB file around 12M.  But I'm not holding any
records, I read 1 record from the file and write it to the DB, then read
the next record from the file and write it to the DB, etc.  I'm not using
local() anywhere in the code, although there are several levels of
function calls, many with my() variables.

I also noticed it would go for a while using the same amount of memory,
then increase by a large amount in 1 jump (is that me, Perl or Berkeley
DB?):

  11M  ~10 min
  13M  ~5 min
  17M  ~21 min
  21M  ~10 min
  29M  ~42 min
  37M  ~23 min
  53M  at least 45 min (still going when I checked)

The question is, how can I figure out where in my code I'm losing the
memory?  I'm sure there must be something in my code that's using a chunk
of memory every time through the loop, I'm just not sure how to track it
down.  Is there some Module or tool I can use to show me memory used by
Module, function, variable, etc while the program is running?

Thanks in advance for any hints.

PS. Please respond to pete@spry.com, I don't always remember to check the
newsgroups.

 --
------------------------------------------------------------------------
 Dan Peterson                                  Internet: pete@spry.com
 System Architect                              Phone:    (425) 957-8240
 Spry, CompuServe Internet Division            FAX:      (425) 957-6240
------------------------------------------------------------------------



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

Date: 18 Jul 1997 11:48:14 GMT
From: igor3000@aol.com (Igor3000)
Subject: Need Cgi Installation
Message-Id: <19970718114801.HAA07456@ladder02.news.aol.com>

i desparately need a cgi installation 

it's a script to ensure that files are only accessable 

from the page i say.. sort of a referral script..

please help me someone please..

I have the script i think .. here it is.. have a look and tell me

if it will check referral and keep out any outside attempt at entry



 #!/usr/bin/perl

 

 $ref = $ENV{'HTTP_REFERER'};

 

 if ($ref && $ref eq "http://igor3000.redscull.com")

  {

   print "location: http://igor3000.redscull.com/gimme200.RA\n\n";

 }

 else

 {

   print "content-type: text/html\n\n";

   print "<HTML><BODY>You cannot access this page</BODY></HTML>\n\n";

 }

 

Please tell me a nice cgi person will install it for me!!!!!



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

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

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