[23578] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5785 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 12 09:05:59 2003

Date: Wed, 12 Nov 2003 06:05:10 -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           Wed, 12 Nov 2003     Volume: 10 Number: 5785

Today's topics:
        [RegEx] Replace characters (Bouba654)
    Re: [RegEx] Replace characters <noreply@gunnar.cc>
    Re: [RegEx] Replace characters <abigail@abigail.nl>
    Re: [RegEx] Replace characters <HelgiBriem_1@hotmail.com>
    Re: count of 1s in a binary number <nospam-abuse@ilyaz.org>
    Re: count of 1s in a binary number (Anno Siegel)
        Emacs modules for Perl programming (Jari Aalto+mail.perl)
    Re: Fastest Perl Interpreter <trevie@cox.net>
        fetchrow not proceeding beyond 9th record (dn_perl@hotmail.com)
    Re: fetchrow not proceeding beyond 9th record <ThomasKratz@REMOVEwebCAPS.de>
    Re: fetchrow not proceeding beyond 9th record <nospam@bigpond.com>
    Re: fork process to handle fifo input (Ole)
        Get original destination IP and port with Linux 2.4 ipt <junkto@tm.net.my>
        Getting real url from ASP database. <rich@NOSPAM_ultimathule.net>
    Re: Getting real url from ASP database. <noreply@gunnar.cc>
    Re: how to erase \r or \015 in win32? <kaspREMOVE_CAPS@epatra.com>
        Installation of a perl module (mistletoe)
    Re: installing perl <kingsman22004@yahoo.com>
    Re: JVM in perl <chris@kiffer.eunet.be>
    Re: Sort array of objects using a method (Anno Siegel)
    Re: Sorting a multi-dimensional hash (Anno Siegel)
        Very newbie Q anout $,@ and % (Torch)
    Re: Very newbie Q anout $,@ and % <ak+usenet@freeshell.org>
    Re: Very newbie Q anout $,@ and % <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: Why Camel is Better than Perldoc <kaspREMOVE_CAPS@epatra.com>
    Re: Win32::OLE and CDO Message Filters <delius@no.spam.for.me.progsoc.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 12 Nov 2003 01:27:52 -0800
From: arnaud.thomas@laposte.net (Bouba654)
Subject: [RegEx] Replace characters
Message-Id: <c0b5897e.0311120127.28e7c102@posting.google.com>

HEllo,

I would like to write a regex for mod_rewrite in order to replace all "?" by "!".
Do you think it's possible ?

Thanks,
AT/


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

Date: Wed, 12 Nov 2003 11:32:37 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: [RegEx] Replace characters
Message-Id: <bot270$1hsf30$1@ID-184292.news.uni-berlin.de>

Bouba654 wrote:
> I would like to write a regex for mod_rewrite in order to replace
> all "?" by "!".
> Do you think it's possible ?

Probably.

This is a Perl group. Why don't you ask in an Apache group?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 12 Nov 2003 10:48:26 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: [RegEx] Replace characters
Message-Id: <slrnbr43vq.8mv.abigail@alexandra.abigail.nl>

Bouba654 (arnaud.thomas@laposte.net) wrote on MMMDCCXXV September
MCMXCIII in <URL:news:c0b5897e.0311120127.28e7c102@posting.google.com>:
$$  HEllo,
$$  
$$  I would like to write a regex for mod_rewrite in order to replace all "?" by "!".
$$  Do you think it's possible ?


Yes, but I wouldn't use a regex. tr/// is much better suited for
character by character replacements.

    $str =~ tr/?/!/;


Abigail
-- 
BEGIN {print "Just "   }
CHECK {print "another "}
INIT  {print "Perl "   }
END   {print "Hacker\n"}


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

Date: Wed, 12 Nov 2003 10:57:20 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: [RegEx] Replace characters
Message-Id: <pe44rv4kchictm0vc7gsm71ejfhj0d9r3l@4ax.com>

On 12 Nov 2003 01:27:52 -0800, arnaud.thomas@laposte.net (Bouba654)
wrote:

>I would like to write a regex for mod_rewrite in order to
> replace all "?" by "!".
>Do you think it's possible ?

If regexes in apache are anything like those in Perl,
it might be something like:

s/\?/!/g;


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

Date: Wed, 12 Nov 2003 13:10:20 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: count of 1s in a binary number
Message-Id: <botbfs$v1r$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <boj8vt$iui$1@mamenchi.zrz.TU-Berlin.DE>:
> >   sub size1 {
> >       # Recursive approach, terse and elegant IMHO.
> >       # An iterative one is OK as well.
> >       my $n=shift;
> >       return 0 unless $n;
> >       return ($n&1) + size1($n>>1);
> >   }

> That counts the bits of an n-bit number in n steps.  There is an old trick
> in the dying art of bit-fiddling that allows to count them in as many steps
> as there are one-bits.  That is a significant advantage if the numbers
> involved are small (or sparse, bit-wise).

Should be quite sparse to beat something like this:

  sub count_bits ($) {
    my $x = shift;
    my $shift = 1;
    for my $mask (0x55555555, 0x33333333, 0x0f0f0f0f, 0x00ff00ff, 0x0000ffff) {
      $x = ($x & $mask) + (($x >> $shift) & $mask);
      $shift *= 2;
    }
    $x;
  }

  print count_bits 0b111110010111000111101010001001;

(especially if one unwinds the loop, so there is no need to maintain
$shift).  If it were C on a PC, I would also note that this
OOO-executes better...

Hope this helps,
Ilya


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

Date: 12 Nov 2003 13:44:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: count of 1s in a binary number
Message-Id: <botdgl$6eg$1@mamenchi.zrz.TU-Berlin.DE>

Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote in comp.lang.perl.misc:
> [A complimentary Cc of this posting was sent to
> Anno Siegel
> <anno4000@lublin.zrz.tu-berlin.de>], who wrote in article
> <boj8vt$iui$1@mamenchi.zrz.TU-Berlin.DE>:
> > >   sub size1 {
> > >       # Recursive approach, terse and elegant IMHO.
> > >       # An iterative one is OK as well.
> > >       my $n=shift;
> > >       return 0 unless $n;
> > >       return ($n&1) + size1($n>>1);
> > >   }
> 
> > That counts the bits of an n-bit number in n steps.  There is an old trick
> > in the dying art of bit-fiddling that allows to count them in as many steps
> > as there are one-bits.  That is a significant advantage if the numbers
> > involved are small (or sparse, bit-wise).
> 
> Should be quite sparse to beat something like this:
> 
>   sub count_bits ($) {
>     my $x = shift;
>     my $shift = 1;
>     for my $mask (0x55555555, 0x33333333, 0x0f0f0f0f, 0x00ff00ff, 0x0000ffff) {
>       $x = ($x & $mask) + (($x >> $shift) & $mask);
>       $shift *= 2;
>     }
>     $x;
>   }
> 
>   print count_bits 0b111110010111000111101010001001;

Yikes, what's that?  Wait... it's considering $x as a series of $shift-bit
($shift = 1, 2, 4,..) numbers and makes room for overflow using the mask
and doing every addition in two steps.  I hadn't seen this before, thanks
for bringing it up.

I'll do some benchmarks when I get a minute.  I'm curious how it compares
with a lookup table.

Anno


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

Date: 12 Nov 2003 09:44:01 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1068630134@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs/XEmacs

        o   Unix:
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/

        o   Unix Windows port (for Unix die-hards):
            install http://www.cygwin.com/  which includes native Emacs 21.x.
            XEmacs port is bundled in XEmacs setup.exe available from
            XEmacs site.

        o   Pure Native Windows port
            http://www.gnu.org/software/emacs/windows/ntemacs.html
            ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe

        o   More Emacs resources at
            http://tiny-tools.sourceforge.net/  => Emacs resource page

Emacs Perl Modules

    Cperl -- Perl programming mode

        ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
        http://www.perl.com/CPAN-local/misc/emacs/cperl-mode/
        <ilya@math.ohio-state.edu>    Ilya Zakharevich

        CPerl is major mode for editing perl files. Forget the default
        `perl-mode' that comes with Emacs, this is much better. Comes
        standard in newest Emacs.

    TinyPerl -- Perl related utilities

        http://tiny-tools.sourceforge.net/

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Grep through all Perl manpages (.pod)
        o   Follow POD references e.g. [perlre] to next pod with RETURN
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.

        o   Update `$VERSION' variable with YYYY.MMDD on save.
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Prepare script (version numbering) and Upload it to PAUSE
        o   Generate autoload STUBS (Devel::SelfStubber) for you
            Perl Module (.pm)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in Tiny Tools Kit]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
        how to set up dattabases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to to do the search, You can adjust
        recursive grep options, set search case sensitivity, add user grep
        options etc.

        You can find latest `igrep.el' module at
        <http://groups.google.com/groups?group=gnu.emacs.sources> The
        maintainer is Jefin Rodgers <kevinr@ihs.com>.

    TinyCompile -- To Browse grep results in Emacs *compile* buffer

        TinyCompile is a minor mode for *compile* buffer from where
        you can collapse unwanted lines or shorten file URLs:

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->

            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: Tue, 11 Nov 2003 22:59:29 -0700
From: "Michael J. Astrauskas" <trevie@cox.net>
Subject: Re: Fastest Perl Interpreter
Message-Id: <0%jsb.21836$0K6.934@fed1read06>

William Herrera wrote:

> On Sat, 25 Oct 2003 15:34:51 -0700, "Michael J. Astrauskas" <trevie@cox.net>
> wrote:
> 
> 
>>I'm attempting build a system that needs to run a perl script very 
>>quickly. There will be no disk access, but the system will be doing an 
>>intense amount of network and processor work. 
> 
> 
> In most cases, unless there is a large amount of calculation or disk searching
> involved,  this will result in an i/o bound system, where most of the CPU
> cycles are spent waiting for the network i/o to complete. In such a case,
> system CPU speed will be secondary in system speed impact to network latency
> issues. This may guide selection of hardware--spend more on speeding your I/O,
> not necessarily your CPU.

It'll basically be a front end NNTP server. Network I/O will be intense. 
About 300 copies of the script will be running at any time.

> OTOH, if your app is really CPU bound, not network bound, maybe you should not
> use Perl. Use something compiled.

Sadly, it's for a contest and the language and script are not of my choice.

-- 
  - Michael J. Astrauskas



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

Date: 12 Nov 2003 01:22:16 -0800
From: dn_perl@hotmail.com (dn_perl@hotmail.com)
Subject: fetchrow not proceeding beyond 9th record
Message-Id: <97314b5b.0311120122.55ecbe03@posting.google.com>

I am trying to fetch rows using  $sth->fetchrow.
If I run my sql query from 'sqlplus' prompt, it returns 58 unique
records. But if I do :

while ($sth->fetchrow())

the loop is terminated after processing only 9 (not 58) records.

Why could this be happening? Is there any variable associated with
Perl DBI which is set to 9 and fetches only 9 rows by default. 
If the number was 8 or 16, that would be less of a surprise. 
But I am unable to make out while the loop exits too early
and why it exists after fetching 9 records.

Please advise.


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

Date: Wed, 12 Nov 2003 11:52:01 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: fetchrow not proceeding beyond 9th record
Message-Id: <3fb21193.0@juno.wiesbaden.netsurf.de>

dn_perl@hotmail.com wrote:

> I am trying to fetch rows using  $sth->fetchrow.
> If I run my sql query from 'sqlplus' prompt, it returns 58 unique
> records. But if I do :
> 
> while ($sth->fetchrow())
> 
> the loop is terminated after processing only 9 (not 58) records.
> 
> Why could this be happening? Is there any variable associated with
> Perl DBI which is set to 9 and fetches only 9 rows by default. 
> If the number was 8 or 16, that would be less of a surprise. 
> But I am unable to make out while the loop exits too early
> and why it exists after fetching 9 records.
> 
> Please advise.

First advice: Please read the posting guidelines and post real code - 
a minimal example - that shows the problem.

A DBI statement handle has no fetchrow() method! There are a few that 
begin with "fetchrow" though.

And there are no restrictions on the number of returned rows from a 
select statement.

Second advice: Please read the docs (perldoc DBI).
When fetching a row of data from a statement handle fails, you can use 
the $sth->err() method to check the error. Also have a look at the 
trace method of the database handle.

And tell us what perl and DBI version you are running.

Thomas



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

Date: Wed, 12 Nov 2003 21:56:32 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: fetchrow not proceeding beyond 9th record
Message-Id: <1565983.77ua0VsUmL@gregs-web-hosting-and-pickle-farming>

It was a dark and stormy night, and dn_perl@hotmail.com managed to scribble:

> I am trying to fetch rows using  $sth->fetchrow.
> If I run my sql query from 'sqlplus' prompt, it returns 58 unique
> records. But if I do :
> 
> while ($sth->fetchrow())
> 
> the loop is terminated after processing only 9 (not 58) records.
> 
> Why could this be happening? Is there any variable associated with
> Perl DBI which is set to 9 and fetches only 9 rows by default.
> If the number was 8 or 16, that would be less of a surprise.
> But I am unable to make out while the loop exits too early
> and why it exists after fetching 9 records.
> 
> Please advise.

Well, it shouldn't!

I suggest posting the code that causes the problem. Are there any variables used in the SQL statement. Are you SURE the statements are the same. Are you checking DBI return codes?

Note that some databases like Oracle (and possibly mysql with Innodb tables) have "read consistency", allowing two users to see different data. Make sure you are doing commits.

gtoomey


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

Date: 12 Nov 2003 02:30:35 -0800
From: oviaudmurat@web.de (Ole)
Subject: Re: fork process to handle fifo input
Message-Id: <c640408c.0311120230.2f491929@posting.google.com>

Hello,

please critizize my perlscripts posted in position ( 6 ). 

They concern SysV IPC and standard perl stuff.

Greetings Ole V.-M.


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

Date: Wed, 12 Nov 2003 20:12:29 +0800
From: Lincoln Yeoh <junkto@tm.net.my>
Subject: Get original destination IP and port with Linux 2.4 iptables redirect?
Message-Id: <gp84rvo8u0bhju5bck02ospn91p4vt7u1n@4ax.com>

Sorry to repost this but I still haven't figured it out and there
weren't any responses.
---
Say I use iptables to redirect tcp connections to my perl proxy
servers. How then do I get the original destination IP address and tcp
port?

On FreeBSD I just use ipfw and fwd and then following works:
$daddr=$client->sockhost;
$dport=$client->sockport;

And then my various proxies work transparently.

But on Linux I'm supposed to use some FD options:
e.g.
  getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, &dst_addr, &slen)

What's a good way to do this with perl? Working examples would be very
helpful.

I've tried perl's getsockopt but replacing OPTNAME with
SO_ORIGINAL_DST doesn't work - it's not defined.

perl -f getsockopt 
getsockopt SOCKET,LEVEL,OPTNAME

I've tried specifying a numerical 80 for OPTNAME but not sure how to
get the address etc.

Thanks,
Link.


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

Date: Wed, 12 Nov 2003 12:36:30 -0000
From: "Rich @  Ultima Thule" <rich@NOSPAM_ultimathule.net>
Subject: Getting real url from ASP database.
Message-Id: <bot9gp$ntv$1$830fa795@news.demon.co.uk>

I have a number of links within a database which link to asp pages with a
clickthru which opens a browser with the real URL in. e.g.
www.somesite.com/asp/clickthru.asp?id=180 and this goes to www.realsite.com.

Is it possible in perl to simulate a browser visiting the asp page and
recover the real URL?

Apologies if this has been asked before but I have done a google groups
search to no avail.

Thanks for any assistance

Richard Lee.




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

Date: Wed, 12 Nov 2003 13:47:37 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Getting real url from ASP database.
Message-Id: <bota4v$1i6km6$1@ID-184292.news.uni-berlin.de>

Rich @ Ultima Thule wrote:
> I have a number of links within a database which link to asp pages
> with a clickthru which opens a browser with the real URL in. e.g. 
> www.somesite.com/asp/clickthru.asp?id=180 and this goes to
> www.realsite.com.
> 
> Is it possible in perl to simulate a browser visiting the asp page
> and recover the real URL?

Not sure what it is you want to do. What do you mean by "recover"?

By help of a module, you can easily have Perl fetch the source code of
a URL.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Wed, 12 Nov 2003 11:04:17 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: how to erase \r or \015 in win32?
Message-Id: <bosgrr$1glo8m$1@ID-191136.news.uni-berlin.de>

> i want to erase ^M in then end of lines.
> but i can do this in win32.

while(<>){
    s/\^M/\\n/g;        #replace ^M with newline
    print;
}

-- 




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

Date: 12 Nov 2003 02:35:43 -0800
From: ranjithvenkatesh@hotmail.com (mistletoe)
Subject: Installation of a perl module
Message-Id: <f08a2d40.0311120235.35917bb4@posting.google.com>

Command : ppm install DBI.ppd

Error: No valid repositories: Error: 500 Can't connect to
ppm.ActiveState.com:80 (connect: Unknown error) at C:/Program
Files/Perl/site/lib/PPM/Repository.pm line 84 Error: 500 Can't connect
to ppm.ActiveState.com:80 (connect: Unknown error) at C:/Program
Files/Perl/site/lib/PPM/Repository.pm line 84

Line 84: "my $soap_result = $client->ppm_protocol;"

How do I correct this error?


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

Date: Wed, 12 Nov 2003 20:23:53 +1100
From: King <kingsman22004@yahoo.com>
Subject: Re: installing perl
Message-Id: <3FB1FC29.2080808@yahoo.com>

Ben Morrow wrote:
> news@group.com wrote:
> 
>>isn't ture that with debian, I better install perl in a different 
>>directory so it does not interfere with debian stock perl? and what does 
>>that mean?
> 
> 
> Yes, that's true. Debian puts its perl (perl 5.6.1) in /usr/bin; the
> perl you (should) have just installed is in /usr/local/bin. I would
> have hoped that would be clear by now...
> 
> 
>>when make install puts its files in whatever place it likes 
>>and that include locations other than -r /home/username/perl-5.8.1.
> 
> 
> I'm not sure what you mean by '-r': ITYM 'in or somewhere underneath
> this directory'?
> 
> Yes, this is true. This is what is meant by 'installing' a
> program. This is both why 'make install' must be run as root, and also
> why you should read the READMEs/INSTALL files/whatever before you
> install anything to make sure you know what it is going to put where.
> 
> 
>>I don't understand the objective here inorder not to interfere with 
>>debian stock perl. ok back to my problem solving steps.
> 
> 
> The objective is that everything provided by Debian should live under
> /usr, and everything you build yourself should live under
> /usr/local, so they don't interfere. That's what it's there for.
> 
> 
>>now what... when I run a file.pl, do I need to start the file with 
>>#!/usr/local/bin/perl instead of #!/usr/bin/perl?
> 
> 
> It depends which perl you want to run it with... you have two
> installed. If you want it to use 5.6.1, then use /!/usr/bin/perl; if
> you want it to use 5.8.1, use #!/usr/local/bin/perl.
> 
> Also, it is neither necessary nor usual in a Unix environment to use
> the extension '.pl' on Perl scripts.
> 
> 
>>how about installing tha CPAN to keep up with cpan modules?
> 
> 
> CPAN.pm is already installed: it comes with the core.
> 
> 
>>also I need to install Data::Dumpber,
> 
> 
> Become root, then
> 
> # /usr/local/bin/perl -MCPAN -e'install "Data::Dumper"'
> 
> 
>>I never did this before, do I follow instruction off the net from a
>>reliable source like perlmonks, or I need to do thing differently. I
>>will try not to do somthing I don't full understand next time.
> 
> 
> In general it is a very bad idea to attempt to follow instructions you
> don't understand, even when they are from a 'reliable' source like
> perlmonks.
> 
> Ben
> 

thank you, you have been a great help.




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

Date: Wed, 12 Nov 2003 12:56:35 +0100
From: chris <chris@kiffer.eunet.be>
Subject: Re: JVM in perl
Message-Id: <bot7b3$8ao$1@reader11.wxs.nl>

Mc Kiernan, Daniel Kian wrote:

> I'm planning an implementation of the JVM in perl. (I can begin work in
> early 2004.) Has anyone else been doing or planning something along these
> lines?

I know of open-source projects in C, C++, Oberon, and .NET - but not Perl.

Go for it! Perl has one big thing against it (an extra layer of translation 
via bytecode) and one big thing for it (associative arrays - a VM spends a 
lot of time doing various kinds of table lookups). My two eurocents worth 
of advice would be:
  - go for a compile-and-execute approach rather than an interpreter; i.e. 
compile the Java bytecode to Perl and throw that at the Perl engine. That 
largely overcomes the "two layers of bytecode" problem.
  - use the Classpath libraries for your Java runtime. You'll probably need 
to do your own implementation of java.lang.String, java.lang.Class, and a 
couple of others, but for the rest you can build on the fine work that's 
already been done - and maybe contribute as well ...

See you at the next open-source Java implementors' BOF ...

-- 
Chris Gray      chris@kiffer.eunet.be



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

Date: 12 Nov 2003 13:58:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sort array of objects using a method
Message-Id: <boteaj$6eg$2@mamenchi.zrz.TU-Berlin.DE>

Uri Guttman  <uri@stemsystems.com> wrote in comp.lang.perl.misc:
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

[variants of GRT]

>   AS> Another variant is to use an array slice to put the final sorted list
>   AS> together: "@raw[ map substr( $_, ...), sort ... ]".  It's less readable,
>   AS> imo, so to be acceptable it would have to be faster, which I doubt. 
> 
> that is a good point. a map could be faster with certain sizes of sort
> lists. my module could support both kinds of output conversions. more on
> that when i get a tuit.

Out of curiosity I benchmarked.  Other things equal, the slice came out
about 8% slower, for large and small sorts.

Anno


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

Date: 12 Nov 2003 11:14:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sorting a multi-dimensional hash
Message-Id: <bot4lr$8e$1@mamenchi.zrz.TU-Berlin.DE>

ifiaz <ifiaz@hotmail.com> wrote in comp.lang.perl.misc:
> > No.  What follows is pseudo-code.  You improve your chances of getting
> > useful replies when you post runnable code.
> > 
> > > $Fnd{$Lic}{$cF}{mFullScanTime} = $mFullScanTime; #20030317090000
> (Sample data)
> > Why let everyone wade through all these lines?  The only one relevant
> > to the problem is the one I highlighted.  
> > Please learn how to indent properly.  Again, the more readable your code
> > is, the better are your chances that someone will actually read it.
> 
>    Thanks for pointing out. I will follow accordingly.
> 
> > You mean, sorting the hash *keys*.
> 
> I think by value. i.e. $Fnd{$Lic}{$cF}{mFullScanTime} = "20030317090000"
> so I need to sort by the scan times on the right hand side of equal sign.
> 
> > > How can I have the hash sorted by my requirement?
> > 
> > By supplying the corresponding comparison routinei (untested):
> > 
> >     sort { $Fnd{$a}{$Cf}{mFullScanTime} <=> $Fnd{$b}{$Cf}{mFullScanTime} }
> >         keys %Fnd;
> > 
> 
> One typical example is
> 
> $Fnd{"00123"}{"1"}{mFullScanTime} = ...
> $Fnd{"00123"}{"2"}{mFullScanTime} = ...
> $Fnd{"00123"}{"3"}{mFullScanTime} = ...
> $Fnd{"00123"}{"4"}{mFullScanTime} = ...
> $Fnd{"12345"}{"1"}{mFullScanTime} = ...
> $Fnd{"12346"}{"1"}{mFullScanTime} = ...
> 
> Since, $cF is  a variable that changes everytime, I don't know how
> to pass the $cF inside the sort routine. So, I need to know how
> I can pass the $cF inside the sort routine, so that the sort routine
> can refer to each and every mFullScanTime of $Lic and $cF put
> together and return the sorted result.

The operative term here is "put together".  Apparently, every hash
entry can have multiple mFullScanTime's.  The question is, how are
you going to use these for sorting?  Pick one?  If so, which one?
Use the average?  Something else?

Without an answer to this there isn't much I can suggest.

Anno


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

Date: 12 Nov 2003 01:04:41 -0800
From: rvw_torch@hotmail.com (Torch)
Subject: Very newbie Q anout $,@ and %
Message-Id: <d774347.0311120104.6ac9b18e@posting.google.com>

I know that 
$ is used to declare variables
@ is used to declare arrays
% is used to declare ???????


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

Date: Wed, 12 Nov 2003 09:13:15 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Very newbie Q anout $,@ and %
Message-Id: <slrnbr3uda.1hr.ak+usenet@otaku.freeshell.org>

In article <d774347.0311120104.6ac9b18e@posting.google.com>, Torch wrote:
> I know that 
> $ is used to declare variables
> @ is used to declare arrays
> % is used to declare ???????

% is used to denote a hash (associative array).

-- 
Andreas Kähäri


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

Date: Wed, 12 Nov 2003 09:28:24 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Very newbie Q anout $,@ and %
Message-Id: <Xns94316A47A9F10elhber1lidotechnet@62.89.127.66>

rvw_torch@hotmail.com (Torch) wrote in 
news:d774347.0311120104.6ac9b18e@posting.google.com:

> I know that 
> $ is used to declare variables
> @ is used to declare arrays
> % is used to declare ???????


perldoc perldata


-- 
Cheers,
Bernard


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

Date: Wed, 12 Nov 2003 11:27:07 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Why Camel is Better than Perldoc
Message-Id: <bosidp$1hse4b$1@ID-191136.news.uni-berlin.de>

"Sara" <genericax@hotmail.com> wrote in message
news:776e0325.0311111107.3b46dc8d@posting.google.com...> grrrrr....> >
tuxy> perldoc regex>    No documentation found for "regex".You are not using
perldoc properly.   $ perldoc Some::Module
   $ perldoc -f functionName
   $ perldoc -q "How do I send mail?"

For more details try
	perldoc -h-- 




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

Date: Wed, 12 Nov 2003 05:24:11 GMT
From: "Shaun Clowes" <delius@no.spam.for.me.progsoc.org>
Subject: Re: Win32::OLE and CDO Message Filters
Message-Id: <%tjsb.267$z31.7146@news.optus.net.au>


"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3fb16cd8.4933820@news.erols.com...
> "Shaun Clowes" <delius@no.spam.for.me.progsoc.org> wrote:
>
> You have three different techniques for assigning a value to the
> object's property.  OLE is not complaining about any of them.

Yes, but none are having any effect.

> You have one technique for looking at the property's value.  Each time
> that technique is used, OLE complains about a missing "Size" method, and
> perl complains about printing uninitialized values.

I've tried every other combination too.

> A look at the MessageFilter object docs says "Size" is a property of the
> object, not a method.

Yes, but Win32::OLE automagically does the right thing here. That's not my
problem.

Cheers,
Shaun




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

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


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