[24595] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6771 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 6 14:05:46 2004

Date: Tue, 6 Jul 2004 11:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 6 Jul 2004     Volume: 10 Number: 6771

Today's topics:
        [Q] for Bill H <please_post@nomail.edu>
        ANNOUNCE: Spreadsheet::WriteExcel 2.03 <jmcnamara@cpan.org>
        ANNOUNCE: Spreadsheet::WriteExcelXML 0.05 <jmcnamara@cpan.org>
        ANNOUNCE: Zoidberg 0.55 <j.g.karssenberg@student.utwente.nl>
        Auto die on failed sys calls? <jkrugman345@yahbitoo.com>
    Re: Auto die on failed sys calls? (Anno Siegel)
        console print issue <someone@somewhere.com>
    Re: console print issue <Eugene.Mikheyev@kiev.cms.com.ua>
    Re: console print issue <someone@somewhere.com>
    Re: console print issue <mritty@gmail.com>
        Deparse error (rmartin)
    Re: equality test for multiple variables <matthew.garrish@sympatico.ca>
    Re: equality test for multiple variables (Anno Siegel)
    Re: equality test for multiple variables (Peter Scott)
        GD::Graph - Fitting wide legends? <koos@no.spam>
        getNodeValue Problem -Xerces Perl (Waseem)
    Re: Math::BigFloat oddities (Anno Siegel)
    Re: Newbie queries <iss025@bangor.ac.uk>
    Re: Newbie: How do I  filter output to the screen and w (Mav)
        perl eating up memory slowly until program stops - any  (Jasper)
    Re: pipes from forked processes (Corey_G)
    Re: Want comma in printed numbers not dot. How? (Peter Scott)
    Re: Want comma in printed numbers not dot. How? (Peter J. Acklam)
    Re: Why use dollar sign $ for variables <dha@panix.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 6 Jul 2004 16:09:25 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: [Q] for Bill H
Message-Id: <cceirk$o1t$1@reader2.panix.com>


Searching for an old post of mine through Google, I came across a
recent post by Bill Herrera, that I found intriguing:

  From: wherrera@lynxview.com (Bill)
  Date: 7 Jun 2004 09:21:49 -0700
  Newsgroups: comp.lang.perl.misc
  Subject: Re: Cute bit of Perl to Assign $1,$2 to named variables

  Michele Dondi <bik.mido@tiscalinet.it> wrote in message news:<o7h8c0ln1anf6kh711r75juu7orn7302s8@4ax.com>...

  > (i) the possibility of putting perl code (hooks) directly into @INC;

  Yep, this one was just an aha! how come I never saw that before!
  experience for me also in the past few months. Inserting refernces
  into @INC allows some non-admin user level manipulations of home
  directory CGI modules in taint mode I had thought too hard before.

Bill, could you elaborate on this idea, please?  A simple example,
maybe?

Many thanks!

	-(the other) bill


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

Date: Sun, 4 Jul 2004 22:50:14 GMT
From: John McNamara <jmcnamara@cpan.org>
Subject: ANNOUNCE: Spreadsheet::WriteExcel 2.03
Message-Id: <I0Fpy4.1MLB@zorch.sf-bay.org>

======================================================================
ANNOUNCE

    Spreadsheet::WriteExcel version 2.03 has been uploaded to CPAN.

    http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel

======================================================================
NAME

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

======================================================================
CHANGES

    ! Fixed bug that prevented column outlines from displaying.
      Thanks to Marc Rosenthal.

    ! Enhanced add_worksheet() name checking to exclude case-
      insensitive duplicate names.
      Thanks to James Wilkinson.

    ! Internal fix to number of rows in several (unseen) places.

    + Added mod_perl 2 example program from Matisse Enzer.

======================================================================
DESCRIPTION

    The Spreadsheet::WriteExcel module can be used create a cross-
    platform Excel binary file. Multiple worksheets can be added to a
    workbook and formatting can be applied to cells. Text, numbers,
    formulas and hyperlinks and images can be written to the cells.

    The Excel file produced by this module is compatible with
    Excel 97, 2000, 2002 and 2003.

    The module will work on the majority of Windows, UNIX and
    Macintosh platforms. Generated files are also compatible with the
    Linux/UNIX spreadsheet applications Gnumeric and OpenOffice.org.
    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.

    This module cannot be used to write to an existing Excel file.

======================================================================
SYNOPSIS

    To write a string, a formatted string, a number and a formula to
    the first worksheet in an Excel workbook called perl.xls:

        use Spreadsheet::WriteExcel;

        # Create a new Excel workbook
        my $workbook = Spreadsheet::WriteExcel->new("perl.xls");

        # Add a worksheet
        $worksheet = $workbook->add_worksheet();

        #  Add and define a format
        $format = $workbook->add_format();    # Add a format
        $format->set_bold();
        $format->set_color('red');
        $format->set_align('center');

        # Write a formatted and unformatted string
        $col = $row = 0;
        $worksheet->write($row, $col, "Hi Excel!", $format);
        $worksheet->write(1,    $col, "Hi Excel!");

        # Write a number and a formula using A1 notation
        $worksheet->write('A3', 1.2345);
        $worksheet->write('A4', '=SIN(PI()/4)');

======================================================================
REQUIREMENTS

    This module requires Perl 5.005 (or later), Parse::RecDescent and
    File::Temp

        http://search.cpan.org/search?dist=Parse-RecDescent
        http://search.cpan.org/search?dist=File-Temp


======================================================================
AUTHOR

    John McNamara (jmcnamara@cpan.org)

--




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

Date: Sun, 4 Jul 2004 22:49:12 GMT
From: John McNamara <jmcnamara@cpan.org>
Subject: ANNOUNCE: Spreadsheet::WriteExcelXML 0.05
Message-Id: <I0FpyB.1q0E@zorch.sf-bay.org>

======================================================================
ANNOUNCE

    Spreadsheet::WriteExcel version 0.05 has been uploaded to CPAN.

    http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcelXML/

======================================================================
NAME

    Spreadsheet::WriteExcelXML - Create an Excel file in XML format.

======================================================================
CHANGES

    Version 0.05 July 2 2004

    ! Fixed bug with implicit <Cell> ss:Index attribute.

    + Added index.t test for the above behaviour.


    Version 0.04 July 1 2004

    ! Added XML escape for "\n" and test. Used in set_text_wrap().
      Thanks to Masaaki Hirose and Marc Rosenthal for reports.

    + Enabled set_row() as per Spreadsheet::WriteExcel.

    + Enabled set_column() as per Spreadsheet::WriteExcel.

    + Added tests for set_row() and set_column().



======================================================================
DESCRIPTION

    The Spreadsheet::WriteExcelXML module can be used to create an
    Excel file in XML format. The Excel XML format is supported in
    Excel 2002 and 2003.

    Multiple worksheets can be added to a workbook and formatting
    can be applied to cells. Text, numbers, and formulas can be
    written to the cells. The module supports strings up to 32,767
    characters and the strings can be in UTF8 format.

    Spreadsheet::WriteExcelXML uses the same interface as
    Spreadsheet::WriteExcel.

    This module cannot, as yet, be used to write to an existing
    Excel XML file.


======================================================================
SYNOPSIS

    To write a string, a formatted string, a number and a formula to
    the first worksheet in an Excel XML spreadsheet called perl.xml:

        use Spreadsheet::WriteExcelXML;

        # Create a new Excel workbook
        my $workbook = Spreadsheet::WriteExcelXML->new("perl.xml");

        # Add a worksheet
        $worksheet = $workbook->add_worksheet();

        #  Add and define a format
        $format = $workbook->add_format(); # Add a format
        $format->set_bold();
        $format->set_color('red');
        $format->set_align('center');

        # Write a formatted and unformatted string, row and column
notation.
        $col = $row = 0;
        $worksheet->write($row, $col, "Hi Excel!", $format);
        $worksheet->write(1,    $col, "Hi Excel!");

        # Write a number and a formula using A1 notation
        $worksheet->write('A3', 1.2345);
        $worksheet->write('A4', '=SIN(PI()/4)');


======================================================================
REQUIREMENTS

    This module requires Perl 5.005 (or later).


======================================================================
INSTALLATION

    Use the standard Unix style installation, a ppm for Windows
    users will be available in the next release:

        Unzip and untar the module as follows or use winzip:

            tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz

        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


======================================================================
AUTHOR

    John McNamara (jmcnamara@cpan.org)

--




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

Date: Mon, 5 Jul 2004 12:00:02 GMT
From: Jaap Karssenberg <j.g.karssenberg@student.utwente.nl>
Subject: ANNOUNCE: Zoidberg 0.55
Message-Id: <I0Fpxq.3o7@zorch.sf-bay.org>

Last week there were two new releases of the Zoidberg shell.
Zoidberg (a.k.a. zoid) provides a modular Perl shell written,
configured, and operated entirely in Perl. It aspires to be a fully
operational login shell with all the features one normally expects. But
it also gives direct access to Perl objects and data structures from the
command line, and allows you to run Perl code within the scope of your
command line.

0.55 Sun Jul  4 2004
This release adds a more perlish job control interface through a tied
@JOBS giving the user direct access to the job objects. Also a regex
glob feature was added.

0.54 Tue Jun 29 2004
In this release the "list control" code is finished. This means you can
add shell commands to a command list that is already being executed.
Also Aliases can now contain command lists of arbitrary complexity and
effectively work as macros. Various bugs related to quoting and escaping
are fixed.

See <http://zoidberg/wiki/index.cgi?QuickGuide> for some usage examples.

Ask for "Bundle::Zoidberg" at your local CPAN mirror !

-- 
   )   (     Jaap Karssenberg || Pardus [Larus]                | |0| |
   :   :     http://pardus-larus.student.utwente.nl/~pardus    | | |0|
 )  \ /  (                                                     |0|0|0|
 ",.*'*.,"   Proud owner of "Perl6 Essentials" 1st edition :)  wannabe




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

Date: Tue, 6 Jul 2004 14:37:00 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: Auto die on failed sys calls?
Message-Id: <ccedec$ln7$1@reader2.panix.com>




Is there any way to instruct perl to die whenever a system call
(e.g. through open, opendir, backticks, system, etc.) fails?

The aim is to be able to enclose a series of such calls in a single
eval block, and catch any failures at the end, instead of checking
for them after each system call.

Thanks!

jill
-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.



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

Date: 6 Jul 2004 16:16:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Auto die on failed sys calls?
Message-Id: <ccej8k$flj$1@mamenchi.zrz.TU-Berlin.DE>

J Krugman  <jkrugman345@yahbitoo.com> wrote in comp.lang.perl.misc:
> 
> 
> 
> Is there any way to instruct perl to die whenever a system call
> (e.g. through open, opendir, backticks, system, etc.) fails?

No, there isn't.

Note also that open and opendir belong in a different category than
backticks and system.  The first ones call kernel- or library routines,
the second ones call external programs.


> The aim is to be able to enclose a series of such calls in a single
> eval block, and catch any failures at the end, instead of checking
> for them after each system call.

One could think of tie-ing $! so that it dies when something non-zero
is stored there, but that doesn't work either.  The values in $!  get
there via magic, not the standard SV procedure, so the tie is ignored.

Anno


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

Date: Tue, 6 Jul 2004 16:24:34 +0100
From: "Bigus" <someone@somewhere.com>
Subject: console print issue
Message-Id: <cceg7k$1bq0@newton.cc.rl.ac.uk>

This is driving me nuts and I've had it working in different scripts
before.. here's the code:

for($i=0;$i<5;$i++){
 sleep 2;
 print ">";
}

that should cause an angle bracket to be printed on the commandline every 2
seconds, but instead all 5 are printed at the same time when it's finished
the loop. Can anyone shed any light on why?

Bigus



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

Date: Tue, 6 Jul 2004 18:29:34 +0300
From: "Eugene Mikheyev" <Eugene.Mikheyev@kiev.cms.com.ua>
Subject: Re: console print issue
Message-Id: <ccegiv$2ek1$1@news.univ.kiev.ua>

> that should cause an angle bracket to be printed on the commandline every
2
> seconds, but instead all 5 are printed at the same time when it's finished
> the loop. Can anyone shed any light on why?

Sure, just turn on the autoflash.
$| = 1;




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

Date: Tue, 6 Jul 2004 16:50:26 +0100
From: "Bigus" <someone@somewhere.com>
Subject: Re: console print issue
Message-Id: <cceho4$1bua@newton.cc.rl.ac.uk>


"Eugene Mikheyev" <Eugene.Mikheyev@kiev.cms.com.ua> wrote in message
news:ccegiv$2ek1$1@news.univ.kiev.ua...
> > that should cause an angle bracket to be printed on the commandline
every
> 2
> > seconds, but instead all 5 are printed at the same time when it's
finished
> > the loop. Can anyone shed any light on why?
>
> Sure, just turn on the autoflash.
> $| = 1;

that's odd, because I've never used $| before and in some of my previous
scripts where I've looped through a folder of log files I've included a
progress-bar style thing, like:

>>>>>>>>>>>>>>>>>>>>>
>>>>>

where the first row of brackets is the number of log files and on the second
row a bracket is printed after each file has been processed.. and it's
worked fine. I guess something else must have forced a flush of teh print
statements in those cases.

Anyway, thanks :)



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

Date: Tue, 6 Jul 2004 12:30:12 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: console print issue
Message-Id: <20040706122605.N22150@barbara.cs.rpi.edu>

On Tue, 6 Jul 2004, Bigus wrote:

> "Eugene Mikheyev" <Eugene.Mikheyev@kiev.cms.com.ua> wrote in message
> news:ccegiv$2ek1$1@news.univ.kiev.ua...
> > > that should cause an angle bracket to be printed on the commandline
> every
> > 2
> > > seconds, but instead all 5 are printed at the same time when it's
> finished
> > > the loop. Can anyone shed any light on why?
> >
> > Sure, just turn on the autoflash.
> > $| = 1;
>
> that's odd, because I've never used $| before and in some of my previous
> scripts where I've looped through a folder of log files I've included a
> progress-bar style thing, like:
>
> >>>>>>>>>>>>>>>>>>>>>
> >>>>>
>
> where the first row of brackets is the number of log files and on the second
> row a bracket is printed after each file has been processed.. and it's
> worked fine. I guess something else must have forced a flush of teh print
> statements in those cases.
>
> Anyway, thanks :)

STDOUT defaults to line-buffering (when set to the terminal), files
default to block-buffering.  This could account for the differences you
see.  Also, printing a newline character flushes the buffer as well.

perldoc -q flush
and
perldoc perlop  (search for $!)

for more info.

Paul Lalli


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

Date: 6 Jul 2004 09:43:45 -0700
From: rmartin@freemail.it (rmartin)
Subject: Deparse error
Message-Id: <d7999283.0407060843.7444d618@posting.google.com>

I need to try the Deprse function

my system Windows Xp
Perl 5.6.1

C:\DeparseTest\bin>perl -MO=Deparse catalogo.cgi
Can't call method "PADLIST" on an undefined value at C:/Perl/lib/B/Deparse.pm 
line 1039.
CHECK failed--call queue aborted.

The module is installed?
I try to
ppm verify

PPM interactive shell (2.1.5) - type 'help' for available commands.
PPM> verify b-deparse
While verifying package 'b-deparse': Package 'b-deparse' has not been installed
by PPM

Any idea?
thanks
ramrtin


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

Date: Tue, 6 Jul 2004 09:35:13 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: equality test for multiple variables
Message-Id: <fUxGc.24381$JG5.528777@news20.bellglobal.com>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:cce00t$4hm$1@mamenchi.zrz.TU-Berlin.DE...
> Matt Garrish <matthew.garrish@sympatico.ca> wrote in comp.lang.perl.misc:
> > Just curious if anyone has a more elegant way to check whether multiple
> > values are equal. For example, given:
> >
> > $a = $b = $c = $d = $e = 'test';
> >
> > is there anything better than:
> >
> > if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ...  }
> >
> > It would be nice (cleaner) if you could simply test if $a eq $b eq $c eq
$d,
> > but that obviously won't work.
>
> A hash can do it:
>
>     my %h;
>     @h{ $a, $b, $c, $d, $e} = ();
>     if ( keys %h == 1 ) { ... }
>
> This doesn't need an external module, but Uri's suggestion using
List::Util
> is about twice as fast.
>

Thanks to everyone for the suggestions! It's code I'm hoping not to be
responsible for for long so the cleaner (clearer) it is to read the
better... : )

Matt




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

Date: 6 Jul 2004 14:17:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: equality test for multiple variables
Message-Id: <ccec9m$atg$1@mamenchi.zrz.TU-Berlin.DE>

Matt Garrish <matthew.garrish@sympatico.ca> wrote in comp.lang.perl.misc:
> 
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:cce00t$4hm$1@mamenchi.zrz.TU-Berlin.DE...
> > Matt Garrish <matthew.garrish@sympatico.ca> wrote in comp.lang.perl.misc:
> > > Just curious if anyone has a more elegant way to check whether multiple
> > > values are equal. For example, given:
> > >
> > > $a = $b = $c = $d = $e = 'test';
> > >
> > > is there anything better than:
> > >
> > > if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ...  }
> > >
> > > It would be nice (cleaner) if you could simply test if $a eq $b eq $c eq
> $d,
> > > but that obviously won't work.
> >
> > A hash can do it:
> >
> >     my %h;
> >     @h{ $a, $b, $c, $d, $e} = ();
> >     if ( keys %h == 1 ) { ... }
> >
> > This doesn't need an external module, but Uri's suggestion using
> List::Util
> > is about twice as fast.
> >
> 
> Thanks to everyone for the suggestions! It's code I'm hoping not to be
> responsible for for long so the cleaner (clearer) it is to read the
> better... : )

In that case, if you're using one of the less obvious solutions,
make it a named sub.  Here is a grep-based one:

    sub all_equal {  not ( @_ and grep $_[ 0] ne $_, @_) }

That one's a little faster than the hash, but still 15% slower than
the List::Util solution.

Anno


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

Date: Tue, 06 Jul 2004 14:53:22 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: equality test for multiple variables
Message-Id: <C1zGc.35921$P7.33139@pd7tw3no>

In article <J_pGc.14982$JG5.481220@news20.bellglobal.com>,
 "Matt Garrish" <matthew.garrish@sympatico.ca> writes:
>Just curious if anyone has a more elegant way to check whether multiple
>values are equal. For example, given:
>
>$a = $b = $c = $d = $e = 'test';
>
>is there anything better than:
>
>if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ...  }
>
>It would be nice (cleaner) if you could simply test if $a eq $b eq $c eq $d,
>but that obviously won't work.

use Quantum::Superpositions;
if ( all($a, $b, $c, $d) eq $e ) ...

Couldn't resist... :-)

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: Tue, 06 Jul 2004 15:35:18 +0200
From: Koos Pol <koos@no.spam>
Subject: GD::Graph - Fitting wide legends?
Message-Id: <newscache$00nf0i$xv3$1@news.emea.compuware.com>

Hello all,

Anyone know how to make GD::Graph ignore the width of the legends
when it's calculating the graph size?
Currently the legend width *is* taken into account. This results
in graphs starved from space as the legends are eating it up.

Thanks,
Koos

-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped


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

Date: 6 Jul 2004 08:25:13 -0700
From: shinnykausar@yahoo.co.uk (Waseem)
Subject: getNodeValue Problem -Xerces Perl
Message-Id: <d30fc54.0407060725.373ce3a4@posting.google.com>

Hi

I have looked and tried everything and i still cant sort this out i
have no idea why this wont work

I am using Xerces Perl on Windows and Debian to try this and it wont
work on both of them.

Basically i am tryin to do simple tree transversale and get the node
values out

I now understand that evetything in DOM is a node including the actual
element values etc so i am using the code below , part done myself
part copied from the examples in the /t dir.

I dont get any values from this code, all i get are blanks and thats
it, if i do getNodeName instead i get "#text". From the commented out
code below this it shows i have tried many different things. I even
tried to copy the code in DOM2Hash.pl but i couldt get it to work for
my code.

Someone must have an answer.

----------------------------- code
---------------------------------------------
use XML::Xerces;
use Getopt::Long;
use Benchmark;
package MyNodeFilter;
use vars qw(@ISA);
@ISA = qw(XML::Xerces::PerlNodeFilter);
$validate = $XML::Xerces::AbstractDOMParser::Val_Always;

### set new parser
my $DOM = XML::Xerces::XercesDOMParser->new();
$sc = 'lr.xsd';
$DOM->setValidationScheme ($sc);
$DOM->setDoNamespaces (1);
$DOM->setDoSchema (1);
$file = 'lr.xml';
$error_handler = XML::Xerces::PerlErrorHandler->new();
$DOM->setErrorHandler($error_handler);
$d = $DOM->parse($file);
XML::Xerces::error($@) if $@;
$doc = $DOM->getDocument();
$root = $doc->getDocumentElement();
$filter = MyNodeFilter->new();
$what = $XML::Xerces::DOMNodeFilter::SHOW_ALL;
$walker = $doc->createTreeWalker($root,$what,$filter,1);
XML::Xerces::error($@) if $@;
$node = $walker->getCurrentNode();
#$cd = $cn->getFirstChild(); 

if ($node->hasChildNodes()) {
    my $text;
    foreach my $child ($node->getChildNodes) {
        if ($child->getNodeType ne
$XML::Xerces::DOMNode::ELEMENT_NODE) {
            print "sda";
            print $child->getNodeValue();
            
        }


   
   
#	if ($child->isa('XML::Xerces::DOMElement')) {
#     $k .= $child->getNodeValue();
	 
   # }
   # if ($child->isa('XML::Xerces::DOMText')) {
   #    print "asd";
   #     print $k;
   #     $new{text} = $k;
   # }
   
   
   
   #  $v = $child-> getElementsByTagName($k);
   #  print $v;
#}
   ## if $child->isa('XML::Xerces::DOMText');
}          
    }
#   print $text;
   # $return->{text} = $text
 #     if $text !~ /^\s*$/;

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

--------------------------------- lr.xml
-------------------------------------
<?xml version="1.0"?>
<room xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='lr.xsd'>
<roomref>ccccccccccccccc</roomref>
<roomday>2004-06-30Z</roomday>
<roomprice>229.00</roomprice>
</room>
------------------------------------------------------------------------------



Waseem


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

Date: 6 Jul 2004 16:26:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Math::BigFloat oddities
Message-Id: <ccejqo$flj$2@mamenchi.zrz.TU-Berlin.DE>

Peter J. Acklam <pjacklam@online.no> wrote in comp.lang.perl.misc:
> I am totally out of clues as to why the following happens.
> Please, let me know...
> 
> First, subtracting an element from itself should give 0...
> 
>    $ perl -MMath::BigFloat -wle \
>       '$x = Math::BigFloat->new(3.14) ; $x = $x - $x ; print $x'
>    0
> 
>    $ perl -MMath::BigFloat -wle \
>       '$x = Math::BigFloat->new(3.14) ; $x -= $x ; print $x'
>    6.28
>    ^^^^
> 
> What was that?
> 
> Secondly, dividing an element by itself should give 1...
> 
>    $ perl -MMath::BigFloat -wle \
>       '$x = Math::BigFloat->new(3.14) ; $x = $x / $x ; print $x'
>    1           # OK; x / x = 1
> 
>    $ perl -MMath::BigFloat -wle \
>       '$x = Math::BigFloat->new(3.14) ; $x /= $x ; print $x'
>    0.00000000000000000000000000000000000000000001
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> What was that?
> 
> Is there a bug in the operator overloading of Math::BigFloat
> objects?

The "-=" bug is already in Math::BigInt from which Math::BigFloat inherits
most of its overloading.  I'm not sure what exactly is going on, but the
code jumps through quite a few hoops when it comes to protecting the
operands of overloading from unwanted changes.  I suppose something is
going wrong there.  I guess a bug report is in order.

Anno


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

Date: Tue, 06 Jul 2004 16:49:08 +0100
From: "P.R.Brady" <iss025@bangor.ac.uk>
Subject: Re: Newbie queries
Message-Id: <40EAC9F4.4030107@bangor.ac.uk>

P.R.Brady wrote:
> I just can't find answers in the FAQ.  It tells you how to do clever 
> things but I just can't find the simple things.
> 
> Q1:  Is there an index to the FAQ?  If not , how do you find your way 
> round it?
> 
> Q2:  How do I exit gracefully from a program?  Die is a crash close, but 
> is there a 'clean' finish, other than dribbling down to the end of the 
> source file?
> 
> Q3:  I start my scripts typically with 'perl -w myprog.pl'.
> How do I supply run time parameters to my program?   What puts them in 
> @ARGV?     A possibly related question - why am I entreated to put the 
> first line of my script as:
> #!c:\perl\perl.exe -w   (I'm running under windoze)?
> 
> Q4:  How do I declare global variables so that 'use strict;' is satisfied?
> 
> Regards
> Phil
> 

Thanks for the helpful replies everyone.
Phil



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

Date: 6 Jul 2004 10:31:15 -0700
From: mluvw47@yahoo.com (Mav)
Subject: Re: Newbie: How do I  filter output to the screen and writing the orginal output to a file?
Message-Id: <dfaafecd.0407060931.61ec6d15@posting.google.com>

Thanks, only after the build completed
it print out the info. I would like to show up what is building...=(
It will print "Start" and nothing show up...
Do I need to create a seperate process?

#Here is the completed code.
#!/usr/bin/perl

$build_config = Release;

# Setup the path to devenv
my $devPath = $ENV{VS71COMNTOOLS};
$devPath =~ s/\\\w+\\$//;
$devPath =~ s/$/\\IDE\\/;

# Do the build
if (-e "b.log") {
     @args = ("del b.log");
     system(@args);
}

@args = ("\"$devPath\\devenv.com\" ..\\Solution\\my.sln /build $build_config");

print "Start\n";
my $output = qx(@args);

open LOG, '>> b.log' or die $!;
print LOG $output;
close LOG;
print "$1\n" while $output =~ /^(\s*--.+)/gm;



Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<2kptuuF4g3bdU1@uni-berlin.de>...
> Mav wrote:
> > I still didn't get my progam working. I think it is because I
> > didn't explain it correctly.
> 
> Or you did not listen to the advices you got. ;-)
> 
> > On my perl script, I would like to execute the command:
> > @args =
> > ("\"$devPath\\devenv.com\" Solution\\my.sln /build Release");
> > This is an Vs.net command that allow user to build the solution(my 
> > solution) from the console. Once this command got execute, the
> > output will print on the SCREEN like:
> >  --Build Item A
> >  compiling a1.cpp
> >  compiling a2.cpp
> >  compiling a3.cpp
> 
> <snip>
> 
> > However, I don't want all the detail got print on the screen, I
> > want only key main being print on the SCREEN like,:
> > 
> >  --Build Item A
> >  --Build Item B
> >  --Build Item C
> > 
> > But still keep the orignal format in the a log FILE (build.log)
> 
> You may want to try something like this:
> 
>      my $output = qx(@args);
>      open LOG, '>> build.log' or die $!;
>      print LOG $output;
>      close LOG;
>      print "$1\n" while $output =~ /^(\s*--.+)/gm;


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

Date: 6 Jul 2004 10:08:55 -0700
From: jasper_marzin@yahoo.com (Jasper)
Subject: perl eating up memory slowly until program stops - any ideas ?
Message-Id: <89b27d52.0407060908.3574e9ac@posting.google.com>

Hello, I am clearing the contents of the arrays with @array = (); for
all arrays, and I print out the $#array to get the size while the
program is running for all arrays...and the arrays are not growing..so
I am stumped as to what could be causing the fact that memory needs
continue to increase...I am using GMP::BigFloat and doing large
precision subtractions..

Any tips are appreciated as to how I can manage/stop this..
Thank you,

Jasper


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

Date: 6 Jul 2004 06:23:24 -0700
From: corey-nospam@test-tools.net (Corey_G)
Subject: Re: pipes from forked processes
Message-Id: <7ef3e932.0407060523.57315980@posting.google.com>

I finally figured out what I am doing thanks to this post from Bob
Showalter.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=2E4528861499D41199D200A0C9B15BC001D7EE62%40FRISTX&rnum=2

he does this and it works great:


  #!/usr/bin/perl

  use strict;
  $| = 1;
  my $nc = 3;             # number of children to create
  pipe READER, WRITER;    # pipe for communication

  for my $c (1 .. $nc) {
      # create a child process
      defined(my $pid = fork) or die "Couldn't fork: $!";
      next if $pid;   # parent loops to create next child

      # child does it's thing and writes back to parent through pipe
      close READER;
      select WRITER;
      $| = 1;
      print "Hello, I am child $c, and my PID is $$\n";
      sleep rand(5) + 1;
      print "Goodbye from child $c\n";
      exit;           # child exits (IMPORTANT!)
  }

  # parent reads from children
  # pipe will close when last child exits
  close WRITER;
  while(<READER>) {
      print $_;
  }

  1 while wait() > 0;   # reap all exit statuses



Sample output:

  $ perl myscript.pl
  Hello, I am child 1, and my PID is 16774
  Hello, I am child 2, and my PID is 16775
  Hello, I am child 3, and my PID is 16776
  Goodbye from child 2
  Goodbye from child 1
  Goodbye from child 3


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

Date: Tue, 06 Jul 2004 14:44:54 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Want comma in printed numbers not dot. How?
Message-Id: <GVyGc.35914$P7.8631@pd7tw3no>

In article <uzn6e1tjw.fsf@notvalid.se>,
 moller@notvalid.se writes:
>I thought this wold be simple, but after fooling
>around with POSIX and locale I cant get it to
>work.
>
>LC_NUMERIC stays C no matter what I try.
>
>Using Activestate perl on WIN-XP Swedish version.

Locale names on Windows are different.  This works:

C:\Documents and Settings\peter>perl -MPOSIX=locale_h -Mlocale -le \
"setlocale(LC_NUMERIC, 'French'); print 22/7"
3,14285714285714

where on Unix it would be "fr_FR" instead of "French".

Tested with ActivePerl 5.8.2 on XP.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: 06 Jul 2004 17:15:03 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: Want comma in printed numbers not dot. How?
Message-Id: <8ydxi2vc.fsf@online.no>

peter@PSDT.com (Peter Scott) wrote:

> This works:
> 
> C:\Documents and Settings\peter>perl -MPOSIX=locale_h -Mlocale -le \
> "setlocale(LC_NUMERIC, 'French'); print 22/7"
> 3,14285714285714
> 
> where on Unix it would be "fr_FR" instead of "French".

Neither of them seem to work on Cygwin, though...

    $ perl -MPOSIX=locale_h -Mlocale -le \
        "setlocale(LC_NUMERIC, 'French'); print 22/7"
    3.14285714285714

    $ perl -MPOSIX=locale_h -Mlocale -le \
        "setlocale(LC_NUMERIC, 'fr_FR'); print 22/7"
    3.14285714285714

[This is perl, v5.8.2 built for cygwin-thread-multi-64int]

Peter

-- 
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;


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

Date: Tue, 6 Jul 2004 17:32:01 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Why use dollar sign $ for variables
Message-Id: <slrncelogh.l6e.dha@panix2.panix.com>

On 2004-07-06, Tad McClellan <tadmc@augustmail.com> wrote:
> Dennis Walter <dwmail@gmx.net> wrote:
>
>> Subject: Why use dollar sign $ for variables
>
>
> One reason is so you can have variables like:
>
>    $chomp
>    @print
>    %foreach
>
> without having to memorize (and avoid using) a few hundred reserved words.

Not to mention that you can have these sets of variables:

	$chomp, @chomp, %chomp
	$print, @print, %print
	$foreach @foreach %foreach

Although that is probably rarely a good idea. :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Okay, that's it.  30 days no computer use penalty for being stupid
	- Greg at http://www.userfriendly.org


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 6771
***************************************


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