[17299] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4721 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 25 14:05:36 2000

Date: Wed, 25 Oct 2000 11:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972497116-v9-i4721@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 25 Oct 2000     Volume: 9 Number: 4721

Today's topics:
        [Newbie]: Perl and Cron <sferrandez@wineandco.com>
    Re: [Newbie]: Perl and Cron (Garry Williams)
    Re: [Newbie]: Perl and Cron (Rafael Garcia-Suarez)
    Re: [Newbie]: Perl and Cron <sferrandez@wineandco.com>
        [Q] Newbie question <bh_ent@my-deja.com>
    Re: [Q] Newbie question <newsposter@cthulhu.demon.nl>
        add a line once only <jane.walker@cimr.cam.ac.uk>
    Re: add a line once only (Tad McClellan)
    Re: add a line once only <godzilla@stomp.stomp.tokyo>
    Re: add a line once only grishaa@my-deja.com
    Re: add a line once only <godzilla@stomp.stomp.tokyo>
    Re: add a line once only (Tom Christiansen)
    Re: add a line once only <james@NOSPAM.demon.co.uk>
    Re: add a line once only <godzilla@stomp.stomp.tokyo>
        ANNOUNCE: Bio::PSU 0.03 <kdj@fes1.sanger.ac.uk>
        ANNOUNCE: Spreadsheet::WriteExcel, version 0.22 with fo mcnam@my-deja.com
    Re: Bitreverse an integer (Sean McAfee)
        CGI.pm form parameters initialization question (probabl (Ulrich G. Wortmann)
    Re: CGI.pm form parameters initialization question (pro <fty@hickory.engr.utk.edu>
    Re: CGI.pm form parameters initialization question (pro nobull@mail.com
        epd2svg 1.0 <sanface@sanface.com>
    Re: File locking <g.soper@soundhouse.co.uk>
    Re: File locking <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 25 Oct 2000 16:22:18 +0200
From: =?iso-8859-1?Q?S=E9bastien?= Ferrandez <sferrandez@wineandco.com>
Subject: [Newbie]: Perl and Cron
Message-Id: <39F6EC9A.C4D3BAB@wineandco.com>

When trying to launch the script below through cron :

#!/usr/local/bin/perl

use Oraperl;use Mail::Mailer;

$ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
$ENV{"ORACLE_SID"} = "my_sid";
$ENV{"LC_TIME"} = "fr";
 .....

I get the following output :

/usr/local/bin/pense_bete.pl
produced the following output:

Compilation failed in require at /usr/local/bin/pense_bete.pl
BEGIN failed--compilation aborted at /usr/local/bin/pense_bete.pl

I guess this is all a matter of setting properly the env variables.
Cron uses SH and my user uses CSH.
If I run the script manually with my CSH user, it works OK (because the
ORACLE env variables are known to him).
Any hint about a proper way to do make it work through cron ?



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

Date: Wed, 25 Oct 2000 14:45:05 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: [Newbie]: Perl and Cron
Message-Id: <RlCJ5.202$Si.12768@eagle.america.net>

On Wed, 25 Oct 2000 16:22:18 +0200, Sébastien Ferrandez
<sferrandez@wineandco.com> wrote:
>When trying to launch the script below through cron :
>
>#!/usr/local/bin/perl
>
>use Oraperl;use Mail::Mailer;
>
>$ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
>$ENV{"ORACLE_SID"} = "my_sid";
>$ENV{"LC_TIME"} = "fr";
>.....

    BEGIN {
	$ENV{ORACLE_HOME} = '/u01/app/oracle/product/8.0.6'
	    unless $ENV{ORACLE_HOME};
	$ENV{ORACLE_SID}  = 'my_sid' unless $ENV{ORACLE_SID};
	$ENV{LC_TIME}     = 'fr'     unless $ENV{LC_TIME};
    }
    use Oraperl;
    use Mail::Mailer;

Of course, you should seriously consider converting to DBI.  

-- 
Garry Williams


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

Date: Wed, 25 Oct 2000 14:48:43 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: [Newbie]: Perl and Cron
Message-Id: <slrn8vdspe.nt9.rgarciasuarez@rafael.kazibao.net>

Sébastien Ferrandez wrote in comp.lang.perl.misc:
>When trying to launch the script below through cron :
>
>#!/usr/local/bin/perl
>
>use Oraperl;use Mail::Mailer;
>
>$ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
>$ENV{"ORACLE_SID"} = "my_sid";
>$ENV{"LC_TIME"} = "fr";
>.....
>
>I get the following output :
>
>/usr/local/bin/pense_bete.pl
>produced the following output:
>
>Compilation failed in require at /usr/local/bin/pense_bete.pl
>BEGIN failed--compilation aborted at /usr/local/bin/pense_bete.pl
>
>I guess this is all a matter of setting properly the env variables.
>Cron uses SH and my user uses CSH.
>If I run the script manually with my CSH user, it works OK (because the
>ORACLE env variables are known to him).
>Any hint about a proper way to do make it work through cron ?

Does Oraperl.pm need those environment variables? Try:

  BEGIN {
    $ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
    # ...
  }
  use Oraperl;use Mail::Mailer;
  # ...

Alternatively, you can probably set the environment variables from your
crontab. See your system manpages for crontab(5) or such.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Wed, 25 Oct 2000 17:32:30 +0200
From: =?iso-8859-1?Q?S=E9bastien?= Ferrandez <sferrandez@wineandco.com>
Subject: Re: [Newbie]: Perl and Cron
Message-Id: <39F6FD0E.6C653F23@wineandco.com>

Thanks for anybody's kind piece of advice but unfortunately I get the same
error messages...argh ! going crazy on that one ! :)

Rafael Garcia-Suarez wrote:

> Sébastien Ferrandez wrote in comp.lang.perl.misc:
> >When trying to launch the script below through cron :
> >
> >#!/usr/local/bin/perl
> >
> >use Oraperl;use Mail::Mailer;
> >
> >$ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
> >$ENV{"ORACLE_SID"} = "my_sid";
> >$ENV{"LC_TIME"} = "fr";
> >.....
> >
> >I get the following output :
> >
> >/usr/local/bin/pense_bete.pl
> >produced the following output:
> >
> >Compilation failed in require at /usr/local/bin/pense_bete.pl
> >BEGIN failed--compilation aborted at /usr/local/bin/pense_bete.pl
> >
> >I guess this is all a matter of setting properly the env variables.
> >Cron uses SH and my user uses CSH.
> >If I run the script manually with my CSH user, it works OK (because the
> >ORACLE env variables are known to him).
> >Any hint about a proper way to do make it work through cron ?
>
> Does Oraperl.pm need those environment variables? Try:
>
>   BEGIN {
>     $ENV{"ORACLE_HOME"} = "/u01/app/oracle/product/8.0.6";
>     # ...
>   }
>   use Oraperl;use Mail::Mailer;
>   # ...
>
> Alternatively, you can probably set the environment variables from your
> crontab. See your system manpages for crontab(5) or such.
>
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/



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

Date: Wed, 25 Oct 2000 15:23:09 GMT
From: bh <bh_ent@my-deja.com>
Subject: [Q] Newbie question
Message-Id: <8t6tsj$e2q$1@nnrp1.deja.com>

Hi, I am new to perl, and I am interested in writing a program that
will let me create a table (or database or what have you) from several
password files (UNIX /etc/passwd) and:
1) verify all logins and UIDs are the same in all files (if they exist)
2) determine a UID in a given range (say 1000-9999) that is not in use
in any of the files.

I have started this project several times.  I've tried using hashes and
arrays as the storage types, but just can't get the comparison routines
to work.  Is there a better structure?

Thanks for the help

--

Drew Myers
perotsystems


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 25 Oct 2000 16:02:32 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: [Q] Newbie question
Message-Id: <8t706o$nlt$1@internal-news.uu.net>

bh <bh_ent@my-deja.com> wrote:
> Hi, I am new to perl, and I am interested in writing a program that
> will let me create a table (or database or what have you) from several
> password files (UNIX /etc/passwd) and:
> 1) verify all logins and UIDs are the same in all files (if they exist)
> 2) determine a UID in a given range (say 1000-9999) that is not in use
> in any of the files.

> I have started this project several times.  I've tried using hashes and
> arrays as the storage types, but just can't get the comparison routines
> to work.  Is there a better structure?

  Your approach sounds right. Exactly what problem are you having with
your comparison routines? Just a wild guess, you are used 'eq' for
string comparisons, and == for numeric comparisons?

  You could write a _short_ sample of demonstrating what goes wrong.
Include a good description what you want it to do, and what it does
instead.

Erik



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

Date: Wed, 25 Oct 2000 15:31:51 GMT
From: Jane Walker <jane.walker@cimr.cam.ac.uk>
Subject: add a line once only
Message-Id: <8t6ud7$eju$1@nnrp1.deja.com>

Hi,

I am trying to write a short Perl script, and I'm having problem adding
a line at a certain point. I need to search for "tub_54" and then add an
extra line. The problem is that "tub_54" occurs many times.

This is the code I am using:

open(IN,$infilename) || die "Cannot open $infilename for reading: $!";
open(OUT,">tempfile") || die "cannot create tempfile: $!";
while (<IN>)  {
 s/^tub_54/added line here/;
 print OUT $_;
}
close(IN);
close(OUT);

Please can anyone help me to change this so that the substitution only
occurs once.

Many thanks for your time.

Jane Walker
University of Cambridge


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 25 Oct 2000 10:59:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: add a line once only
Message-Id: <slrn8vdta9.bo6.tadmc@magna.metronet.com>

On Wed, 25 Oct 2000 15:31:51 GMT, Jane Walker 
   <jane.walker@cimr.cam.ac.uk> wrote:
>Hi,
>
>I am trying to write a short Perl script, and I'm having problem adding
>a line at a certain point. I need to search for "tub_54" and then add an
>extra line. The problem is that "tub_54" occurs many times.
>
>This is the code I am using:
>
>open(IN,$infilename) || die "Cannot open $infilename for reading: $!";
>open(OUT,">tempfile") || die "cannot create tempfile: $!";

   my $doit = 1;  # true = do substitution, false = substitution already done


>while (<IN>)  {
> s/^tub_54/added line here/;

   $doit = 0 if $doit and s/^tub_54/added line here/;


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 25 Oct 2000 09:35:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: add a line once only
Message-Id: <39F70BBF.B1D692@stomp.stomp.tokyo>

Jane Walker wrote:

> I am trying to write a short Perl script, and I'm having 
> problem adding a line at a certain point. I need to search
> for "tub_54" and then add an extra line. The problem is that
> "tub_54" occurs many times.
 
> open(IN,$infilename) || die "Cannot open $infilename for reading: $!";
> open(OUT,">tempfile") || die "cannot create tempfile: $!";
> while (<IN>)  {
>  s/^tub_54/added line here/;
>  print OUT $_;
> }
> close(IN);
> close(OUT);


Easy enough to do in a variety of ways. Add a toggle
switch to your code, call it a day, then enjoy a lecture
by your Lucasian Professor of Mathematics, Stephen Hawking.


my ($toggle) = "true";

while (<IN>)  
 {
  if ($toggle eq "true")
   {
    $_ =~ s/^tub_54/added line here/;
    print OUT $_;
    $toggle = "false";
   }
  else
   { print OUT $_; }
 }

Keep your toggle outside your while loop to
prevent a flip flop effect with each line read,
which would defeat your intent.

I've added $_ =~ to your substitution for clarity
which is usually a good practice in programming to
enhance readability.

As an added note, there is a quicker, more memory
efficient way of handling your substitution. This
prevents invoking a regex engine for each line:

while (<IN>)  
 {
  if (index ($_, "tub_54") > -1)
   {
    $_ =~ s/^tub_54/added line here/;
    print OUT $_;
   }
  else
   { print OUT $_; }
 }

A more precise variation on this, per your parameters,
would be to use substr to check your first six characters
of your line:

if (substr ($_, 0, 6) eq "tub_54")
 {
  your substitution stuff

You may combine a toggle with your if conditional
by use of an 'and' operator or a 'logical and'
operator to keep this clean,

 if ((substr ($_, 0, 6) eq "tub_54) & ($toggle eq "true"))
  {
   your substitution stuff

A toggle as I have shown may also be a counter should
you wish to only change n number of lines, change even
numbered lines, change odd numbered lines or even a 
certain line number or certain numbered lines.

You will discover a moderate improvement in efficiency
for your script by use of index, substring or a similar
device in an if conditional to avoid invoking a regex
engine when it is not really needed. A regex engine does
run slower and uses more memory than index or substring.
This notion applies better for a script which will make
more than one substition, rather than just one substitution
as is your intent. Nonetheless, this use of index or
substring will enhance your script's speed and efficiency,
even for a single substitution event, enough so, to be
worth inclusion.

You really should enjoy Stephen Hawking while at Cambridge.
He is our modern day Albert Einstein and, most sadly, will
not live much longer.

Godzilla!


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

Date: Wed, 25 Oct 2000 16:41:48 GMT
From: grishaa@my-deja.com
Subject: Re: add a line once only
Message-Id: <8t72gb$id4$1@nnrp1.deja.com>

Not entirely sure what you are trying to do..
If you need to substitute each occurence of "tub_54" with something else
use
  s/^tub_54/added line here/g;
If you need to substitute only the first occurence of "tub_54" in the
file replace you while loop with the folowing:

  undef $/; #No $INPUT_RECORD_SEPARATOR means the whole file is one line
  $_=<IN>;
  s/^tub_54/added line here/;
  print OUT $_;

In article <8t6ud7$eju$1@nnrp1.deja.com>,
  Jane Walker <jane.walker@cimr.cam.ac.uk> wrote:
> Hi,
>
> I am trying to write a short Perl script, and I'm having problem
adding
> a line at a certain point. I need to search for "tub_54" and then add
an
> extra line. The problem is that "tub_54" occurs many times.
>
> This is the code I am using:
>
> open(IN,$infilename) || die "Cannot open $infilename for reading: $!";
> open(OUT,">tempfile") || die "cannot create tempfile: $!";
> while (<IN>)  {
>  s/^tub_54/added line here/;
>  print OUT $_;
> }
> close(IN);
> close(OUT);
>
> Please can anyone help me to change this so that the substitution only
> occurs once.
>
> Many thanks for your time.
>
> Jane Walker
> University of Cambridge
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 25 Oct 2000 09:53:16 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: add a line once only
Message-Id: <39F70FFC.6D611CFE@stomp.stomp.tokyo>

Godzilla! wrote:
 
> Jane Walker wrote:
 

I have a typo syntax error here:
 
>  if ((substr ($_, 0, 6) eq "tub_54) & ($toggle eq "true"))
>   {
>    your substitution stuff


should be,   ... eq "tub_54"

You will note I left off a closing quote mark.

Godzilla!


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

Date: 25 Oct 2000 11:09:24 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: add a line once only
Message-Id: <39f713c4@cs.colorado.edu>

In article <8t6ud7$eju$1@nnrp1.deja.com>,
Jane Walker  <jane.walker@cimr.cam.ac.uk> wrote:
:I am trying to write a short Perl script, and I'm having problem adding
:a line at a certain point. I need to search for "tub_54" and then add an
:extra line. The problem is that "tub_54" occurs many times.
:
:This is the code I am using:
:
:open(IN,$infilename) || die "Cannot open $infilename for reading: $!";
:open(OUT,">tempfile") || die "cannot create tempfile: $!";
:while (<IN>)  {
: s/^tub_54/added line here/;
: print OUT $_;
:}
:close(IN);
:close(OUT);

    perl -i.orig -pe '?tub_54? && s//added line here/' inputfile

--tom


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

Date: Wed, 25 Oct 2000 18:18:43 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: add a line once only
Message-Id: <ant251743345fNdQ@oakseed.demon.co.uk>

In article <39F70FFC.6D611CFE@stomp.stomp.tokyo>, Godzilla!
<URL:mailto:godzilla@stomp.stomp.tokyo> wrote:
> Godzilla! wrote:
>  
> > Jane Walker wrote:
>  
> 
> I have a typo syntax error here:
>  
> >  if ((substr ($_, 0, 6) eq "tub_54) & ($toggle eq "true"))
> >   {
> >    your substitution stuff
> 
> 
> should be,   ... eq "tub_54"

You probably want a logical && rather than bitwise & too.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Wed, 25 Oct 2000 10:58:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: add a line once only
Message-Id: <39F71F29.D9688B25@stomp.stomp.tokyo>

James Taylor wrote:
 
> > Godzilla! wrote:
> > > Jane Walker wrote:

> > I have a typo syntax error here:

> > >  if ((substr ($_, 0, 6) eq "tub_54) & ($toggle eq "true"))
> > >   {
> > >    your substitution stuff

> > should be,   ... eq "tub_54"

> You probably want a logical && rather than bitwise & too.
 


 "...by use of an 'and' operator or a 'logical and' operator...."


* shrugs *

Godzilla!


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

Date: 24 Oct 2000 17:00:15 +0100
From: Keith James <kdj@fes1.sanger.ac.uk>
Subject: ANNOUNCE: Bio::PSU 0.03
Message-Id: <sve0gr5qsfd41e@corp.supernews.com>


This is the README file for the Bio::PSU Perl module distribution
version 0.03


Bio::PSU - simple OO Perl modules for biological sequence analysis and
annotation

DESCRIPTION

The Bio::PSU modules are general purpose OO Perl libraries for
biological (DNA, RNA, protein) sequence and feature manipulation.

Features include:

Sequence IO

    EMBL (including fuzzy ranges in feature locations)
    Fasta

Sequence (DNA/RNA/protein) objects

    Simple composition methods (residue count, codon count, MWt.)
    Reverse-complementing (including treatment of attached features)
    Subsequence extraction (including treatment of attached features)

Generic sequence feature objects

    Access to feature keys and qualifiers
    Access to feature sequence and translation
    Simple composition methods (residue count, codon count, MWt.)

Search program output parsing

    Lightweight BlastN/P/X (NCBI/WU, v1 & v2) parser
    Fasta (-m 10 format) output parser

These modules will only recognise AC, ID, DE, OS, FT and SQ fields
from EMBL format files. Of these, AC, ID, DE and OS are simply stored
and never changed, unless this is done explicitly by the user. FT and
SQ are parsed and used to create objects.

The modules allow features without sequence as well as sequence
without features. They also respect feature tables without any ID
line. This is useful in situations where: 

   * You want to separate features into different files, but don't
     want to store a copy of the same (possibly very large) sequence
     in each file

   * Your features are dissociated from the sequence, having been
     created from coordinates indicated by a search program output
     (e.g. Blast, Fasta, HMMER)

   * Your sequence is already parsed by another program, such as
     Artemis (http://www.sanger.ac.uk/Software/Artemis/), and you want
     to provide it with some features to display

If you need full treatment of EMBL format, I suggest you use Bioperl
(see http://bio.perl.org).

To get an overview of the module organisation is may be useful to look
at my attempt at a class diagram in the doc directory (Gnome Dia and
PostScript formats).

Why did I write these modules?

    As a learning exercise; they are my first attempt at any sort of
    OO code.

Why not use Bioperl - remember the virtue of 'laziness'?

    I used it for a while. It didn't quite do what I wanted, but I
    couldn't understand the OO code well enough to make the changes I
    needed.

    The Bio::PSU modules are the result of my trying to learn OO
    Perl. As they have proved useful to some people I thought I would
    share them. Merging of functionality with Bioperl has been
    discussed and may occur in the future.

Any comments or pointers are welcome.

A gzipped tar archive may be obtained from:

  ftp://ftp.sanger.ac.uk/pub/pathogens/software/biopsu/Bio-PSU-0.03.tar.gz

  http://www.sanger.ac.uk/Users/kdj/Bio-PSU-0.03.tar.gz

INSTALLATION

Bio::PSU uses the standard Perl installation system:

  perl Makefile.PL
  make
  make test
  make install

At the moment there are some minimal tests included. These will be
added to when I have the time.

ACKNOWLEDGEMENTS

These modules incorporate some ideas from Bioperl, but not much actual
code. Similarly, the Blast parsing code was inspired by Ian Korf's
BPlite modules (http://sapiens.wustl.edu/~ikorf). Code, ideas and
bug-fixes have been contributed by members of the Pathogen Sequencing
Unit at the Sanger Centre. I can also highly recommend 'Object
Oriented Perl' by Damian Conway.

DISCLAIMER

'PSU' stands for Pathogen Sequencing Unit, where I work, and
consequently where this code has seen some use. Note however, that
this is a personal project and therefore they are NOT endorsed in any
way by the Pathogen Sequencing Unit or the Sanger Centre. 

These modules are provided "as is" without warranty of any kind. They
may be used, redistributed and/or modified under the same conditions
as Perl itself.


-- 

-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs CB10 1SA




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

Date: Wed, 25 Oct 2000 15:48:58 GMT
From: mcnam@my-deja.com
Subject: ANNOUNCE: Spreadsheet::WriteExcel, version 0.22 with formatting
Message-Id: <sve0g7ku75is17@corp.supernews.com>

Version 0.22 of Spreadsheet::WriteExcel has been uploaded to CPAN. This
version allows formatting of cells. From the README:


NAME
    Spreadsheet::WriteExcel - Write formatted text and numbers to a
    cross-platform Excel binary file.

DESCRIPTION
    This module can be used to write numbers and text in the native
    Excel binary file format. Multiple worksheets can be added to a
    workbook. Formatting can be applied to cells.

    The Excel file produced by this module is compatible with Excel 5,
    95, 97 and 2000.

    The module will work on the majority of Windows, UNIX and
    Macintosh platforms. Generated files are also compatible with the
    Linux/UNIX spreadsheet applications Star Office, Gnumeric and
    XESS. The generated files are not compatible with MS Access.

    This module cannot be used to read an Excel file. See
    Spreadsheet::ParseExcel or look at the main documentation for some
    suggestions.

INSTALLATION
    The module can be installed using the standard Perl procedure:

        perl Makefile.PL
        make
        make test
        make install    # You may need to be root
        make clean      # or make realclean

    Windows users without a working "make" can get nmake from:
        ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe

    ActivePerl users can use PPM as follows:

  C:\> ppm
  PPM> set repository tmp http://homepage.eircom.net/~jmcnamara/perl
  PPM> install Spreadsheet-WriteExcel
  PPM> quit
  C:\>

VERSION
    This document refers to version 0.22 of Spreadsheet::WriteExcel,
    released Oct 22, 2000.

AUTHOR
    John McNamara (jmcnamara@cpan.org)

--
Sent via Deja.com http://www.deja.com/
Before you die()





Sent via Deja.com http://www.deja.com/
Before you buy.




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

Date: Wed, 25 Oct 2000 17:31:04 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Bitreverse an integer
Message-Id: <sNEJ5.8324$O5.176067@news.itd.umich.edu>

In article <7jcdvsc7qatsvnn545r47is3ml281188il@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>Is there a better way to bitreverse a number? For example, with a
>"register length" of 10 bits, 768 (0b1100000000, two highest bits of 10
>set) should be turned into 3 (0b0000000011, two lowest bits set), and
>vice versa. The highest bit of the source number becomes the lowest bit
>in the destination.

>These two methods seem to work, but they're pretty clumsy (IMO), let
>alone unmaintainable:
[snip]
>Isn't there a less obscure way?

How about this?

----------------------------------------------------------------------
for ($i = 3; $i < 24; $i++) {
    print $i, ": ", reverse_bits($i, 10), "\n";
}

sub reverse_bits {
    my ($num, $size) = @_;
    my $result = 0;
    (($result <<= 1) |= $num & 1, $num) >>= 1 for 1 .. $size;
    $result;
}
----------------------------------------------------------------------

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 25 Oct 2000 17:18:13 +0200
From: uliw@erdw.ethz.ch (Ulrich G. Wortmann)
Subject: CGI.pm form parameters initialization question (probably silly)
Message-Id: <m366mhrlu2.fsf@bonk.ethz.ch>

Hi there,

I'm stuck with a strange behavior of CGI.pm

I initialize the parameter list with values which might or might not
exist in a database - like:

        foreach (0..$#field_name) {
	    $q->param(-name=>$field_name[$_],
		      -default=>$my_values[$_] || "");

later I use this data to construct a form like the following

     @names = $q->param;
        
     foreach (0..$#names) {
      	     push(@rows,$q->td($names[$_]) . 
	      $q->td($q->textfield(-name=>$names[$_],
				   -value=>$q->param($names[$_]||""),
				   -align=>"top",
				   -size=>$ri_table_data_r->{$names[$_]}[1],
				   -maxlength=>$ri_table_data_r->{$names[$_]}[0])));
	 }

which is printed afterwards with

          print($q->start_form); print $q->table($q->Tr(\@rows));

If I enter now data into the form, or modify the records already
listed, press the submit button, (i.e. recall the form printing
routine), and check the contents of $q->param() none of the data I
entered is found on the parameter list, only the default values.

        Thanks for any enlightenment

                Uli
        
-- 
	Uli Wortmann
	Dept. of Geology       Fax (Switzerland) (1) 632  1030
	ETH-Zuerich            Fon                        3694
        Visit the SPOC-team at http://www.spoc.ethz.ch


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

Date: 25 Oct 2000 16:42:59 GMT
From: Jay Flaherty <fty@hickory.engr.utk.edu>
Subject: Re: CGI.pm form parameters initialization question (probably silly)
Message-Id: <8t72ij$bcl$1@penn.dii.utk.edu>

Ulrich G. Wortmann <uliw@erdw.ethz.ch> wrote:

> If I enter now data into the form, or modify the records already
> listed, press the submit button, (i.e. recall the form printing
> routine), and check the contents of $q->param() none of the data I
> entered is found on the parameter list, only the default values.

CGI.pm form fields have "sticky" behaviour. Try using the -force=>1
property. i.e.
print textfield(-name=>$name, -value=>$value, -force=>1);

jay
--
**********************************************************************  
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************



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

Date: 25 Oct 2000 17:41:20 +0100
From: nobull@mail.com
Subject: Re: CGI.pm form parameters initialization question (probably silly)
Message-Id: <u94s20lvpr.fsf@wcl-l.bham.ac.uk>

uliw@erdw.ethz.ch (Ulrich G. Wortmann) writes:

> 	    $q->param(-name=>$field_name[$_],
> 		      -default=>$my_values[$_] || "");

The -default named parameter to CGI.pm's param() method is actually
just a synonym for -value.  It alters the CGI object's concept of a
field's _current_ value not its _default_ value.

IMNSHO this is silly on the part of CGI.pm's authors.  If -default is
not going to DWIM them better not to have it do anything.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 25 Oct 2000 08:07:34 GMT
From: SANFACE Software <sanface@sanface.com>
Subject: epd2svg 1.0
Message-Id: <svduq5rootqhbd@corp.supernews.com>

What's EPD?
EPD is a new encapsulated vectorial graphic format.
We've developed it and put it with GPL License at
http://EPD.sourceforge.net/

The idea is very simple and powerful:
EPD uses the standard PDF (Adobe trademark) graphic syntax.
Every line is only one command.
Every line starting with % is a comment.
The command %BBox(x1,y1,x2,y2) will specify the Bounding Box.
This is a simple example

%EPD-1.0
% This is only a test with the new EPD format
%BBox(-50.87109,97.4201,668.62891,700.57977)
0.97 g
1 i
-64.1289 549.6731 m
308.6328 97.4201 l
-64.1289 625.8317 l
-64.1289 549.6731 l
h
f

What's SVG?
Scalable Vector Graphics (SVG) is standard under development by W3C
http://www.w3.org/Graphics/SVG/
If you need a SVG browser viewer, we suggest you the
Adobe® SVG Viewer (plug-in) at
http://www.adobe.com/svg/viewer/install/

What's epd2svg?
It's a simple and powerful convert from EPD to SVG.
At the moment, this is a beta with poor ducumentation (only the POD file
inside the epd2svg.pl program)
We think it can work good in every OS already tested with (txt2pdf, our
best product)
http://www.sanface.com/txt2pdftesters.html
AIX, SGI, Windows95, Linux, NEXT, NT4, MacOS, Solaris,
OpenVMS/Alpha 7.1, BeOS v 4.5.1, Amiga OS3.1, Acorn-risc RiscOS 3.5,
SCO Unixware 7.0, FreeBSD 4.0, HP-UX 10.20, Digital Unix 4.0D, HP
MPE/iX 6.0

Where you can find epd2svg tool?
At http://EPD.sourceforge.net/ and at every CPAN mirror S/SA/SANFACE/

ftp://EPD.sourceforge.net/pub/EPD/
http://download.sourceforge.net/EPD/

We need your suggestion and your help!

--
SANFACE Software
Your technology glasses. We help you see your full potential.
http://www.sanface.com
mailto:sanface@sanface.com
WAP     http://www.sanface.com/wap/
i-mode  http://www.sanface.com/i/


Sent via Deja.com http://www.deja.com/
Before you buy.




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

Date: Wed, 25 Oct 2000 18:07:50 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: File locking
Message-Id: <4a131cfe2ag.soper@soundhouse.co.uk>

OK I think I need simple exclusive locking before writing files and
non-exclusive locks when reading. There's very little load on the
application so the exclusive lock should never have to wait long.

But...

in one part of the code a file is modified and written to a new file
('something.new'). When this process is completed the old file is renamed
to 'something.old' and the new file is renamed to 'something'. Do I need
to apply for an exclusive lock before renaming the old file?

Cheers

-- 
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/


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

Date: Wed, 25 Oct 2000 17:33:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: File locking
Message-Id: <h26evskc3u5m9uidpq2koidbrh7doc527b@4ax.com>

Geoff Soper wrote:

>But...
>
>in one part of the code a file is modified and written to a new file
>('something.new'). When this process is completed the old file is renamed
>to 'something.old' and the new file is renamed to 'something'. Do I need
>to apply for an exclusive lock before renaming the old file?

I think it's one of those cases where locking the files you're working
with, isn't enough. You can't lock a file that gets renamed. You may be
able to lock the *contents* of the file, but on Unix these two things
can be separated. For example, if you delete a file while it's open, the
contents of the file will keep existing until the file is fully closed. 

An independent sign flag seems like a better idea to me. Create an extra
file, and lock that. As long as it is locked, this is a signal of the
script to it's twin brothers, that none of these files may be changed,
and shouldn't be treated as permanent. For example, your script should
reopen and reread the file "something", which may be a different file
from before, when it got the lock on this general flag.

-- 
	Bart.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4721
**************************************


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