[22093] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4315 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 26 21:05:53 2002

Date: Thu, 26 Dec 2002 18:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 26 Dec 2002     Volume: 10 Number: 4315

Today's topics:
        [ANN] Math::Project3D 1.009, MP::Plot 1.005 <0xeqj001@sneakemail.com>
        [ANN] Math::Project3d 1.009, MP::Plot 1.005 <0xeqj001@sneakemail.com>
        ANNOUNCE: Language::Chef 0.01 <0xeqj001@sneakemail.com>
        ANNOUNCE: Spreadsheet::WriteExcel 0.40 (John McNamara)
        ANNOUNCE: Text::Orientation 0.01 <xern@cpan.org>
        ANNOUNCE: Tie::Scalar::Transactional 0.01 Released (Arun Kumar U)
    Re: generate a line of code on the fly <squillion@hotmail.com>
    Re: Getting Connecting Host Info from inetd (David Efflandt)
    Re: pre declare a split variables <jurgenex@hotmail.com>
    Re: pre declare a split variables <eric.ehlers@btopenworld.com.nospam>
    Re: pre declare a split variables (Tad McClellan)
    Re: pre declare a split variables <uri@stemsystems.com>
    Re: pre declare a split variables <mgjv@tradingpost.com.au>
    Re: Processing \0xx in nonliteral strings <ahamm@mail.com>
    Re: Processing \0xx in nonliteral strings <ahamm@mail.com>
    Re: Simple array problem <ahamm@mail.com>
    Re: The Superiority of PHP over Perl <comments@vrml3d.com>
    Re: The Superiority of PHP over Perl <goldbb2@earthlink.net>
    Re: which UI for Perl? <mgjv@tradingpost.com.au>
        win32::ole woes <lance@augustmail.com>
    Re: win32::ole woes (Jay Tilton)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Dec 2002 21:56:25 +0100
From: Steffen Mueller <0xeqj001@sneakemail.com>
Subject: [ANN] Math::Project3D 1.009, MP::Plot 1.005
Message-Id: <3e0ba5ef$1_5@news.teranews.com>

I would like to announce two new additions to CPAN:
Math::Project3D and Math::Project3D::Plot

Excerpts from the README files follow:

Math::Project3D version 1.009
=============================

This distribution allows the projection of points of a three
dimensional function of an arbitrary number of parameters onto an
arbitrary plane.
[...]

Detailed documentation can be found as pod in the module files.
[...]

Math::Project3D::Plot version 1.005
===================================

This module uses Math::Project3D to project an arbitrary three
dimensional function onto a plane and then plots the outcome into an
Imager image.

Detailed documentation can be found as pod in the module file.
[...]

DEPENDENCIES

Both distributions require these other modules and libraries:

   Math::MatrixReal 1.9 or newer
   Test::More 0.44 or newer

Math::Project3D::Plot also requires Imager 0.41 or newer.

Note that the modules may well work with older versions of these
modules, but I cannot guarantee that it will because I only tested it
with the versions listed.

- Steffen Müller




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

Date: Wed, 25 Dec 2002 11:24:29 +0100
From: Steffen Mueller <0xeqj001@sneakemail.com>
Subject: [ANN] Math::Project3d 1.009, MP::Plot 1.005
Message-Id: <3e0ba616$1_5@news.teranews.com>

I would like to announce two new additions to CPAN:
Math::Project3D and Math::Project3D::Plot

Excerpts from the README files follow:

Math::Project3D version 1.009
=============================

This Perl distribution allows the projection of points of a three
dimensional function of an arbitrary number of parameters onto an
arbitrary plane.
[...]

Detailed documentation can be found as pod in the module files.
[...]

Math::Project3D::Plot version 1.005
===================================

This module uses Math::Project3D to project an arbitrary three
dimensional function onto a plane and then plots the outcome into an
Imager image.

Detailed documentation can be found as pod in the module file.
[...]

DEPENDENCIES

Both distributions require these other modules and libraries:

   Math::MatrixReal 1.9 or newer
   Test::More 0.44 or newer

Math::Project3D::Plot also requires Imager 0.41 or newer.

Note that the modules may well work with older versions of these
modules, but I cannot guarantee that it will because I only tested it
with the versions listed.

- Steffen Müller




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

Date: Wed, 25 Dec 2002 11:22:36 +0100
From: Steffen Mueller <0xeqj001@sneakemail.com>
Subject: ANNOUNCE: Language::Chef 0.01
Message-Id: <3e0ba5f5$1_4@news.teranews.com>

I would like to announce a new addition to CPAN:
Language::Chef, version 0.01

-- Steffen Müller

An excerpt from the README file:

Language::Chef version 0.01
===========================

Language::Chef and all contained Perl modules represent a simple
interpreter of the Chef programming language designed by
David Morgan-Mar.
[...]

DEPENDENCIES

This module requires these other modules and libraries:

   Test::More 0.44 or newer

Note that it may well work with older versions of this module,
but I cannot guarantee that it will because I only tested it with
the version listed.
[...]




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

Date: Sun, 22 Dec 2002 00:05:53 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: ANNOUNCE: Spreadsheet::WriteExcel 0.40
Message-Id: <3e0ba5fc$1_8@news.teranews.com>

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

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

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

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

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

    Minor release

    ! Fixed internal sheet indexing in formulas on some platforms.
      This caused multi-sheet workbooks with formulas to crash.
      Thanks Troy Daniels.

    ! Fixed non-lexical filehandles to prevent problems in
      multi-threaded environments.
      Thanks Ning Xie.

    An Excel97 pre-release version of the module with long
    string (32k) support is now available. See:
    http://freshmeat.net/projects/writeexcel/#comment-22753


======================================================================
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 5,
    95, 97, 2000 and 2002.

    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.
    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->addworksheet();

        #  Add and define a format
        $format = $workbook->addformat();    # 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: Mon, 23 Dec 2002 18:17:37 +0800
From: xern <xern@cpan.org>
Subject: ANNOUNCE: Text::Orientation 0.01
Message-Id: <3e0ba604$1_3@news.teranews.com>

Text::Orientation is designed for changing the orientation of text. Users
can apply transpose(), rotate(), mirror() to play the magic. It is
especially useful for languages that do not necessarily write from left to
right, for example, Chinese. Users can spare themselves the trouble of
handling the problem.









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

Date: 24 Dec 2002 13:31:18 -0800
From: u_arunkumar@yahoo.com (Arun Kumar U)
Subject: ANNOUNCE: Tie::Scalar::Transactional 0.01 Released
Message-Id: <3e0ba60c$2_4@news.teranews.com>

Hi All,

The module Tie::Scalar::Transactional has been released on CPAN. This
module implements scalars with transactional capabilities.

This modules was inspired by "Perl6 RFC 161: Everything in Perl
becomes
an Object", that talks about the possibility of implementing
transaction
support in Perl scalars.

Find below an extract from the modules's README file:

NAME

  Tie::Scalar::Transactional - Implementation of Transactional Scalars

SYNOPSIS

  use Tie::Scalar::Transactional;

  my $foo = 10;
  new Tie::Scalar::Transactional($foo);

  $foo = $baz * 10;
  #... Transactions here ...#

  if ($error) {
    Tie::Scalar::Transactional->rollback($foo);  ## or
    tied($foo)->rollback();                      
  }
  else {
    Tie::Scalar::Transactional->commit($foo);  ## or
    tied($foo)->commit();                      
  }

  ### ----------------------------------------- ###
  ### Or use the following Procedural Interface ###
  ### ----------------------------------------- ###

  use Tie::Scalar::Transactional qw(:commit);
  tie my $bar, 'Tie::Scalar::Transactional', 10;

  $bar = $baz * 10;
  #... Transactions here ...#

  if ($error) { rollback $bar; }
  else        { commit $bar; }

DESCRIPTION

    This module implements scalars with transactional capabilities.
The
    functionality is similar to the ones found in most Relation
Database
    Management Systems (RDBMS).

    A transaction begins under any one of the following conditions:

    * A new transactional variable is created
    * When an existing scalar is converted into a transactional scalar
    * When an existing transaction is committed, a new one begins
      automatically.

    All the changes/updates to the scalar after the transaction has
begun
    can be rolled back, if neccessary. Once committed a change cannot
be
    rolledback.

INVOCATION

    The module can be invoked in two ways:

      * use Tie::Scalar::Transactional;
      * use Tie::Scalar::Transactional qw(:commit);

    If you are strong believer (like me) in the fact that an Object
Oriented
    module should never export methods, then you should use the first
    method.

    On the other hand if you are constantly annoyed by the line noise
    created by the "commit()" / "rollback()" calls, when using a pure
OO
    interface. And would prefer the less terse procedural interface,
then
    the 2nd method is for you. This will import the "commit()" and
    "rollback()" methods the current package's namespace.

CREATING A TRANSACTIONAL SCALAR

    There are two modes in which you can create a Transactional scalar
i.e.

      * Call the module's constructor with the scalar as the first
argument
      * Call the builtin "tie()" function and pass the Scalar and
Class name
        as arguments

    The two modes are illustrated below:

        my $foo = 10;
        new Tie::Scalar::Transactional($foo);
                  (or)
        tie my $foo, 'Tie::Scalar::Transactional', 10;

METHODS

    commit()
        The "commit()" method, sets the state of the scalar to the
last
        update/change done to the scalar since the start of the
transaction.
        The subsequent "rollback()" method call (if any) will revert
back
        the scalar to this state.

        The "commit()" method can be invoked in one of the following
ways:

            Tie::Scalar::Transactional->commit($foo);  ## or
            tied($foo)->commit();                      ## or
            commit $foo;  ## When you have 'use T::S::T qw(:commit)'

    rollback()
        The "rollback()" method, reverts back the state of the scalar
to
        what it was at the beginning of the transaction. The calling
        conventions are similar to the "commit()" method, as discussed
        above.

LIMITATIONS

    Since this is a pure Perl module, it may not be fully optimized in
terms
    of performance. Also the module *might not* be thread safe [But
who
    cares ;) ... ]

KNOWN BUGS

    May be lot of them :-), but hopefully none. Bug reports, fixes,
    suggestions or feature requests are most welcome.

INSPIRATION

    This modules was inspired by "Perl6 RFC 161: Everything in Perl
becomes
    an Object", that talks about the possibility of implementing
transaction
    support in Perl scalars.

COPYRIGHT
    Copyright (c) 2002-03 Arun Kumar U <u_arunkumar@yahoo.com> All
rights
    reserved.

    This library is free software; you can redistribute it and/or
modify it
    under the same terms as Perl itself.

AUTHOR
    Arun Kumar U <u_arunkumar@yahoo.com>, <uarun@cpan.org>

SEE ALSO
    perl(1), perltie(1)

                            ---------------------
Regards,
Arun




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

Date: Thu, 26 Dec 2002 23:24:13 +0000 (UTC)
From: "squillion" <squillion@hotmail.com>
Subject: Re: generate a line of code on the fly
Message-Id: <aug32s$jhj$1@venus.btinternet.com>

> I get it, but I would discourage that use of "compile time" and "run
> time."  Their meanings do not sync with the meanings Perl users expect
> them to have.  Bending old terms into new meanings will always cause
> confusion.
>
> I'd probably change them to something like "anonymous subroutine
> definition time" and "anonymous subroutine call time."

agreed.

> How's this grab you:
>
>     sub get_funcref {
>         my $orig_arg = shift;
>         sub{
>             my $arg = defined $orig_arg ? $orig_arg : shift;
>             print $arg
>         }
>     }

so simple.  thanks!




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

Date: Fri, 27 Dec 2002 00:45:25 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Getting Connecting Host Info from inetd
Message-Id: <slrnb0n8l5.m7p.efflandt@typhoon.xnet.com>

On Thu, 26 Dec 2002 11:11:13 -0500, George Kuetemeyer <gk@pobox.com> wrote:
> I want to use inetd to kick off a Perl script. How can the script itself 
> determine connecting host info, since inetd is brokering connections?

inetd simply starts whatever it is configured to start when a connection 
is attempted on that port and hands off the connection to that.  Not sure 
what you mean by brokering since inetd itself does not do any negotiating.

'perldoc perlipc' has client/server examples that show how the server can 
determine what IP and port is connecting to it.  It is up to your script 
to figure out what you want to do from there.  tcpwrappers does not come 
into play unless you are launching something that pays attention to that.

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Thu, 26 Dec 2002 23:23:40 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: pre declare a split variables
Message-Id: <0cMO9.132516$4W1.62393@nwrddc02.gnilink.net>

Blnukem wrote:
> When I pre declare a split variables "$data_sting" why do they not
> work ?
>
> Snipped Code:

No use strict; no use warnings;
They would have told you what's wrong.

> open DBASE, ("<users.dat");
> @allusers = <DBASE>;
> close(DBASE);
>
> my $data_sting = "$name,$age,$phone";

At this point none of $name, $age, or $phone are defined.
If you would have asked perl to help you it would have told you.

> foreach $user (@allusers){
> chomp($user);
> ($data_sting) = split (/\|/, $user);

This assigns the first element of the list returned by split to $data_sting.
Is that what you want?

> print "Name:$name Phone:$phone<br>";

$name and $phone are still undefined. You never assigned any value to them.

jue




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

Date: Thu, 26 Dec 2002 23:46:27 +0000 (UTC)
From: "eric" <eric.ehlers@btopenworld.com.nospam>
Subject: Re: pre declare a split variables
Message-Id: <aug4cj$ll1$1@venus.btinternet.com>


"Blnukem" <blnukem@hotmail.com> wrote in message
news:oZKO9.160371$a8.28592@news4.srv.hcvlny.cv.net...
> When I pre declare a split variables "$data_sting" why do they not work ?
>
> Snipped Code:
>
> open DBASE, ("<users.dat");
> @allusers = <DBASE>;
> close(DBASE);
>
> my $data_sting = "$name,$age,$phone";
>
> foreach $user (@allusers){
> chomp($user);
> ($data_sting) = split (/\|/, $user);
>
> print "Name:$name Phone:$phone<br>";
>
> }

use strict;
use warnings;

open DBASE, ("<users.dat");
my @allusers = <DBASE>;
close(DBASE);

my ($name,$age,$phone);
my $data_sting='($name,$age,$phone) = split (/\|/, $user)';

foreach my $user (@allusers){
    chomp($user);
    eval $data_sting;
    print "Name:$name Phone:$phone<br>";
}

- eric




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

Date: Thu, 26 Dec 2002 18:48:57 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: pre declare a split variables
Message-Id: <slrnb0n8rp.1sf.tadmc@magna.augustmail.com>

Blnukem <blnukem@hotmail.com> wrote:

> open DBASE, ("<users.dat");


You should always, yes *always*, check the return value from open().

But you already knew that.  [1]


> my $data_sting = "$name,$age,$phone";

> ($data_sting) = split (/\|/, $user);


   my($name,$age,$phone) = split (/\|/, $user);



[1]
    Message-Id: <slrn9a5rjg.2uh.tadmc@tadmc26.august.net>
    Message-Id: <slrn9jf9k7.dvi.tadmc@tadmc26.august.net>

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


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

Date: Fri, 27 Dec 2002 01:33:21 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: pre declare a split variables
Message-Id: <x7smwk8cv4.fsf@mail.sysarch.com>

>>>>> "e" == eric  <eric.ehlers@btopenworld.com.nospam> writes:

  e> my ($name,$age,$phone);
  e> my $data_sting='($name,$age,$phone) = split (/\|/, $user)';

  e> foreach my $user (@allusers){
  e>     chomp($user);
  e>     eval $data_sting;

blechh! why use eval for this?

the proper solution is a hash. whenever anyone wants to choose variable
names at runtime the proper solution is a hash, not eval nor symrefs.

those latter techniques are left to those who know when NOT to use
them. they are a last resort when common and much safer things like
hashes will not work at all. this case is not even close to needing
them.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Fri, 27 Dec 2002 12:28:29 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: pre declare a split variables
Message-Id: <slrnb0nb5t.4tt.mgjv@martien.heliotrope.home>

On Thu, 26 Dec 2002 21:59:48 GMT,
	Blnukem <blnukem@hotmail.com> wrote:
> When I pre declare a split variables "$data_sting" why do they not work ?
> 
> Snipped Code:
> 
> open DBASE, ("<users.dat");

That's a very strange way to use open(). And you should check the return
value.

> @allusers = <DBASE>;
> close(DBASE);

Why do you read the whole file in an array, when later you are
processing these line by line anyway?

> my $data_sting = "$name,$age,$phone";

$name, $age and $phone are undefined here.

> foreach $user (@allusers){

You should really consider scoping your variables as tightly as possible
with my. You are using strict, aren't you?

> chomp($user);
> ($data_sting) = split (/\|/, $user);
> 
> print "Name:$name Phone:$phone<br>";

$name and $phone are not set.

You cannot 'predeclare' a string like that, unless you want to use
string eval, and that is to be avoided. Even in that case, you would
have to set the values of the three variables, not the value of the
variable that contains them. I am not going to tell you how to do what I
think you want to do, because it is bad practice, unnecessary and
dangerous.

Why don't you just do:

#!/usr/local/bin/perl -w
use strict;

open DBASE, "users.dat" or die "Cannot open 'users.dat': $!\n";

while (my $line = <DBASE>)
{
    chomp $line;
    # Assuming the three records are on each line in tis order:
    my ($name, $age, $phone) = split /\|/, $line;
    print "$name, $age, $phone\n";
}

close DBASE;


Are you by any chance trying to change a vertical bar separated file to
a comma-separated one?

$ perl -pe 's/\|/,/g' users.dat > users.csv

or even better:

$ perl -pe 'tr/|/,/' users.dat > users.csv

will do that job. 

Martien
-- 
                        | 
Martien Verbruggen      | 
                        | "Mr Kaplan. Paging Mr Kaplan..."
                        | 


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

Date: Fri, 27 Dec 2002 10:24:46 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Processing \0xx in nonliteral strings
Message-Id: <aug366$74jk2$1@ID-79573.news.dfncis.de>

John W. Krahn wrote:
>
> my $fmt = "user: %u\ndomain:%d\n"; # example
>
> $fmt =~ s/(\\(?:t|n|r|f|b|a|e|c[@-_]|[0-
> 7]{1,3}|x[[:xdigit:]]{1,2}))/qq["$1"]/eeg;

PLEASE guys - EXPLAIN!!!

There's no point presenting awesomely clever solutions if they scare the OP
out of 6 months growth.
--
There's nowt wrong wi' owt what mitherin' clutterbucks don't barly grummit!
-
Replies directly to this message will go to an account that may not be
checked for a week or two. For more timely e-mail response, use (only
in an emergency) ahamm sanderson net au with all the usual punctuation.




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

Date: Fri, 27 Dec 2002 10:25:11 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Processing \0xx in nonliteral strings
Message-Id: <aug36v$72hv8$1@ID-79573.news.dfncis.de>

Benjamin Goldberg wrote:
>
> If *all* you want is to process backslash-escapes just as if you were
> the perl preprocessor, then *use* the perl preprocessor.
>
>    $string =~ s/\\(0x\d{1,2}|[0-7]{1,3}|.)/
>       $1 ne '"' ? eval qq["\\$1"] : '"'/sge;
>
> [untested]
>
> But, since you also want to escape %-thingies, then try:
>
>    my $fmt = 'user: %u\ndomain:%d\n'; # example
>    my %percent = (
>       'u' => $usr, 'd' => $dom, ....,
>    );
>    $string =~ s<(?=([\\%])(?sx:
>       (?:\\(0x\d{1,2}|[0-7]{1,3}|.))
>    |
>       (?:%(.))
>    )>{
>       if( $1 eq "\\" ) {
>          $2 eq '"' ? '"' : eval qq["\\$2"];
>       } else {
>           exists $percent{$3} ? $percent{$3} : "%$3";
>       }
>    }ge;
> [untested]


PLEASE guys - EXPLAIN!!!

There's no point presenting awesomely clever solutions if they scare the OP
out of 6 months growth.
--
There's nowt wrong wi' owt what mitherin' clutterbucks don't barly grummit!
-
Replies directly to this message will go to an account that may not be
checked for a week or two. For more timely e-mail response, use (only
in an emergency) ahamm sanderson net au with all the usual punctuation.




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

Date: Fri, 27 Dec 2002 10:21:46 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Simple array problem
Message-Id: <aug30j$71ulu$1@ID-79573.news.dfncis.de>

Bob Walton wrote:
>
> Well, actually... @hash{a,c} doesn't pass muster with use strict, so
> that should be:
>
>     @arr = @hash{'a','c'};
>
> The bareword hash key bit only applies to strings which look like a
> variable name or a number, which a hash slice list of keys doesn't.

Ahhh, true. That's a mildly annoying artefact of the language. See also

    @arr = @hash{qw(a c)}

or

    @arr = @hash{@indexes}

which is probably the most likely usage. Maybe.

;-)

--
There's nowt wrong wi' owt what mitherin' clutterbucks don't barly grummit!
-
Replies directly to this message will go to an account that may not be
checked for a week or two. For more timely e-mail response, use (only
in an emergency) ahamm sanderson net au with all the usual punctuation.




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

Date: Thu, 26 Dec 2002 21:01:44 -0500
From: "istartedi" <comments@vrml3d.com>
Subject: Re: The Superiority of PHP over Perl
Message-Id: <augbtf$42e$1@bob.news.rcn.net>


Egg Troll <eggtroll@yahoo.com> wrote in message
news:4e2f159f.0212251625.702cd571@posting.google.com...
[snip]

go back to Slashdot.

--$teve





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

Date: Thu, 26 Dec 2002 21:05:07 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: The Superiority of PHP over Perl
Message-Id: <3E0BB553.3026EE01@earthlink.net>

Murat Ünalan wrote:
> 
> > Perl's OO already supports introspection, reflection, and
> > self-replication to a degree.
> 
> ..to a degree. Did you introspect methods (not subs) and attributes
> from a give class/package.

Every sub in a class is a method for that class.  There is no
distinction in perl.

> > For introspection/reflection, one can use the UNIVERSAL:: methods
> > "can" and "isa"; also, one can look at the @ISA tree of a class
> > directly, and the %SymbolTable:: of a class directly.
> 
> Aaargh... this is mostly not helpfull. Show me how you introspect
> module methods (not funcs/subs) and attributes ?! Its impossible.

As I said, every function/sub *is* a method.

As to attributes...  In perl, modules don't really have 'attributes' --
Unless you consider stuff like $object->{foo} to be an attribute, in
which case you can examine it by, err, examining it (with keys(),
values(), and/or each() on %$object).

> > I've never had a problem with this.  It's possible to go out of your
> > way to write *unportable* code, of course, but writing portable code
> > isn't the least bit difficult.
> 
> I bang my head nearly weekly against my monitor, because *nix-vs-win
> compability.

What kind of incompatibility?  If it's because of [lack of] using
binmode() on those filehandles which contain binary data, then I would
*not* in any way consider it perl's fault -- it's ignorance/stupidity.

You would have the same problems if you wrote your program in C or C++.

> Any statistics from the cpantesters would reveal that. This is mostly
> because of ignorance.

So... when someone writes broken code, and puts it on CPAN, you consider
it *Perl's* fault that the code doesn't work?

Or if you use that broken code *without* looking at the CPAN-testers
test results for the platforms you're using it on, you consider that
*Perl's* fault?

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Fri, 27 Dec 2002 11:03:02 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: which UI for Perl?
Message-Id: <slrnb0n65m.4tt.mgjv@martien.heliotrope.home>

On Tue, 10 Dec 2002 23:13:29 GMT,
	Brad <xxxxxxx@xxx.xxx> wrote:
> 
> "Erik Braun" <erik@pax07e3.mipool.uni-jena.de> wrote in message
> news:slrn4avbhiv.86eq.erik@pax07e3.mipool.uni-jena.de...
>> Erik Braun <erik@pax07e3.mipool.uni-jena.de> wrote:
>>
>> > I'm looking for a Perl Module, which provides interactive dialogs,
>> > and some extensions like Radio buttons or file requestors.
>>
>> thank you for all the answers. I forgot to write one important
>> detail: I look for an UI which runs in a Shell Window or on
>> the console (Linux), so I cannot use the graphical extensions.
>> Sorry about that.
>>
>> Erik
> 
> I would then use one of the Curses packages.  Take a look at CPAN, you have
> several options, such a Curses....

I have had reasonable success with Curses::Widgets (and their slightly
higher level versions, Curses::Forms and Curses::Application). The older
versions were a bit more palatable to me, since I could actually make
them do something sensible on a terminal resize, via SIG_WINCH, and I
haven't yet been able to figure out a way to do that with the new
OO-style modules.

I've also had a look at Curses::UI, and it looks promising, although I
haven't actually built any applications with it yet.

Both have a reasonable set of standard widgets to use on top of Curses.

Martien
-- 
                        | 
Martien Verbruggen      | prepBut nI vrbLike adjHungarian! qWhat's
                        | artThe adjBig nProblem? -- Alec Flett
                        | 


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

Date: Thu, 26 Dec 2002 17:23:28 -0600
From: Lance Hoffmeyer <lance@augustmail.com>
Subject: win32::ole woes
Message-Id: <slrnb0n3s0.6er.lance@buddha.hofflund.net>



Seems like this should fairly easy and straight forward but I am still
having problems.  Keep getting error:

Does not support a collection and
cannnot call method Shapes


use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const;
use Win32::OLE 'in';
use Win32::OLE::Const 'Microsoft Office';
use Win32::OLE::Const 'Microsoft PowerPoint';
my $p1=Win32::OLE->GetActiveObject('Powerpoint.Application')
||Win32::OLE->new('PowerPoint.Application','Quit'); 
$p1->{Visible} = 1;
$p1->Presentations->Open({FileName=>"b:\\perl\\test.ppt"});
foreach my $shape (in $p1->Slides(1)->Shapes()){
if ($shape->{Type}==msoEmbeddedOLEObject()){
$shape->Application->DataSheet->Range("AS1:AS1")=10};
};

Lance


-- 

                                Lance Hoffmeyer
                              lance@augustmail.com



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

Date: Fri, 27 Dec 2002 00:28:35 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: win32::ole woes
Message-Id: <3e0b957b.164215363@news.erols.com>

Lance Hoffmeyer <lance@augustmail.com> wrote:

: Seems like this should fairly easy and straight forward but I am still
: having problems.  Keep getting error:
: 
: Does not support a collection and
: cannnot call method Shapes

If an object does not have the methods you think it should have, it's
not the kind of object you think it should be.

: use strict;
: use warnings;
: use Win32::OLE;
: use Win32::OLE::Const;
: use Win32::OLE 'in';
: use Win32::OLE::Const 'Microsoft Office';
: use Win32::OLE::Const 'Microsoft PowerPoint';
: my $p1=Win32::OLE->GetActiveObject('Powerpoint.Application')
: ||Win32::OLE->new('PowerPoint.Application','Quit'); 
: $p1->{Visible} = 1;

: $p1->Presentations->Open({FileName=>"b:\\perl\\test.ppt"});
: foreach my $shape (in $p1->Slides(1)->Shapes()){

$p1 is the Powerpoint application object.
It has no Slides().

The presentation object that was opened by $p1 does have Slides().

    my $presentation =
        $p1->Presentations->Open( {FileName=>'b:\perl\test.ppt'} );
    foreach my $shape (in $presentation->Slides(1)->Shapes ) {

: if ($shape->{Type}==msoEmbeddedOLEObject()){
: $shape->Application->DataSheet->Range("AS1:AS1")=10};
: };

You skipped a fistful of steps there too.

$shape is not the graph.  It is only the container for the Graph
object.  Its Application() method returns the Powerpoint application
object.

As well, the Range object is not an lvalue.  To get at the values in a
range, use the {Value} property.

    $shape->OLEFormat->Object->Application->DataSheet
        ->Range("AS1:AS1")->{Value} = 10;



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

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.  

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


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