[28161] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9525 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 26 06:05:42 2006

Date: Wed, 26 Jul 2006 03:05:05 -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           Wed, 26 Jul 2006     Volume: 10 Number: 9525

Today's topics:
        anyone here running maypole, is it awesome? <bootiack@yahoo.com>
        anyone here tried higher order perl by dominus? I found <bootiack@yahoo.com>
    Re: anyone here tried higher order perl by dominus? I f <john@castleamber.com>
        Comparing values of multiple hash keys <jwcarlton@gmail.com>
    Re: Comparing values of multiple hash keys <jwcarlton@gmail.com>
    Re: Comparing values of multiple hash keys usenet@DavidFilmer.com
    Re: Getting Net::SFTP handle takes FOR-FLIPPIN-EVER usenet@DavidFilmer.com
    Re: Getting Net::SFTP handle takes FOR-FLIPPIN-EVER <sisyphus1@nomail.afraid.org>
    Re: Handling KILL signal in a perl script <josef.moellers@fujitsu-siemens.com>
        has anyone hre tried gantry? is it nice? <bootiack@yahoo.com>
    Re: How to send utf-8 data using LWP::UserAgent? <g111@netcologne.de>
        new CPAN modules on Wed Jul 26 2006 (Randal Schwartz)
    Re: RExp matchs many times,how can i get the matched co <aukjan@gmail.com>
    Re: RExp matchs many times,how can i get the matched co anno4000@radom.zrz.tu-berlin.de
    Re: Semantics of threads <benmorrow@tiscali.co.uk>
    Re: Use MSXML in perl without registration <sisyphus1@nomail.afraid.org>
    Re: using session managment in perl <madan.narra@gmail.com>
        What is the right syntax? <chris-newman@bigpond.com>
    Re: What is the right syntax? <aukjan@gmail.com>
    Re: What is the right syntax? anno4000@radom.zrz.tu-berlin.de
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 25 Jul 2006 21:18:06 -0700
From: "gavino" <bootiack@yahoo.com>
Subject: anyone here running maypole, is it awesome?
Message-Id: <1153887486.000526.252050@i42g2000cwa.googlegroups.com>

maypole by simon



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

Date: 25 Jul 2006 21:19:57 -0700
From: "gavino" <bootiack@yahoo.com>
Subject: anyone here tried higher order perl by dominus? I found it free online and it seems very interesting
Message-Id: <1153887597.454519.128160@h48g2000cwc.googlegroups.com>

It says how perl is not limited to being a c clone.
And I am wondering if perl is a good way for me to get into programming
or should I go straight to something supposedly powerful like lisp?
smalltalk or haskell?



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

Date: 26 Jul 2006 04:49:47 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: anyone here tried higher order perl by dominus? I found it free online and it seems very interesting
Message-Id: <Xns980BF26779DF2castleamber@130.133.1.4>

"gavino" <bootiack@yahoo.com> wrote:

> It says how perl is not limited to being a c clone.
> And I am wondering if perl is a good way for me to get into programming
> or should I go straight to something supposedly powerful like lisp?
> smalltalk or haskell?

HOP is not a beginners book. You might want to start with Learning Perl.
Also because IMO HOP has some weird coding style here and there.

In what way is Lisp/Smalltalk/Haskell more powerfull compared to Perl?

-- 
John Bokma          Freelance software developer
                                &
                    Experienced Perl programmer: http://castleamber.com/


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

Date: 25 Jul 2006 23:50:26 -0700
From: "Jason" <jwcarlton@gmail.com>
Subject: Comparing values of multiple hash keys
Message-Id: <1153896626.396663.20020@s13g2000cwa.googlegroups.com>

In the past I've written a simple search engine and have been using it
for awhile, but now I'm trying to make it a little more intuitive.

Originally, the script was simple. Take a keyword entered by a form,
compare it to each value of an array (@data), and return any value
containing the entry:

$var = param('keyword');
foreach $key (@data) {
  if ($key =~ /$var/i) { push (@founddata, $key); }
}


But now I'm trying to allow for multi-word phrases, which is a bit more
complex. I couldn't find how others are doing it, so I'm winging it on
my own. I started by splitting $var by the whitespace into an array,
counting the number of instances that $var appeared in the $key, then
adding the results to a hash value:

my (%founddata, @keywords);
my $var = param('keyword');

$var =~ s/(?:,|'|\.)//g; # Remove comma, apostrophe, or period
@keywords = split(/ /, $var);

foreach my $key (@data) {
  foreach my $term (@keywords) {
    my @matches = $var =~ /($term)/ig;
    my $size = @matches;
    if ($size > 0) { $founddata{$term} .= $size::$key . "|"; }
  }
}


Let's say that @data = ("Men", "Women", "Children", "Pets",
"Monsters"), and someone searches for "m n" (without the quotes, of
course, because so far I'm not worrying about strict phrases). The
results would be:

$keywords[0] = m;
$keywords[1] = n;

$founddata{'m'} = 1::Men|1::Women|1::Monsters;
$founddata{'n'} = 1::Men|1::Women|1::Children|2::Monsters;


Now, how do I compare the two keys "m" and "n" to both remove any value
that's not in both (ie, Children), and then add the rest together to
create something like 2::Men|2::Women|3::Monsters?

In my mind, I would take the result of this, split it by | into an
array, sort it so that Monsters is first, then split it by :: to remove
the numbers (leaving the final values sorted by the number of
instances), unless you guys know an easier route.

TIA,

Jason



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

Date: 26 Jul 2006 00:54:06 -0700
From: "Jason" <jwcarlton@gmail.com>
Subject: Re: Comparing values of multiple hash keys
Message-Id: <1153900446.008917.47240@i42g2000cwa.googlegroups.com>

> $founddata{'n'} = 1::Men|1::Women|1::Children|2::Monsters;

Whoops, I screwed up there. I was trying to think of a word with the
letter "n" in it twice; don't know why I thought that Monsters did
(other than the fact that I posted at 3am).

So obviously this would not be 2::Monsters, it would be 1::Monsters.
But for the sake of discussion, pretend that "Monsters" was a word with
2 n's in it ;-)

- J



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

Date: 26 Jul 2006 01:54:17 -0700
From: usenet@DavidFilmer.com
Subject: Re: Comparing values of multiple hash keys
Message-Id: <1153904057.270739.251650@b28g2000cwb.googlegroups.com>

Jason wrote:

> $founddata{'m'} = 1::Men|1::Women|1::Monsters;
> $founddata{'n'} = 1::Men|1::Women|1::Children|2::Monsters;
>
>
> Now, how do I compare the two keys "m" and "n" to both remove any value
> that's not in both (ie, Children), and then add the rest together to
> create something like 2::Men|2::Women|3::Monsters?
>
> In my mind, I would take the result of this, split it by | into an
> array, sort it so that Monsters is first, then split it by :: to remove
> the numbers (leaving the final values sorted by the number of
> instances), unless you guys know an easier route.

I think you are making this harder than it needs to be (and less
efficient, too).

A common mistake, especially among less experienced programmers, is to
try to build up a bunch of stuff and then post-process it (this is
often manifested by slurping a file into an array and then looping over
the array, which is almost always silly).  In your case, you are taking
multiple input values and looping them against your data list to build
up individual arrays, and then trying to post-process those arrays to
get meaningful data. This is rather inefficent, because you must loop
over your data list multiple times (which is backwards, because your
data list is presumably large and your input list is presumably small).

Instead, turn it inside-out.  Don't construct outside loops over your
input lists.  Instead, loop over your data list (once). For each item
in the data list, calculate the value of it's match to your criteria
(and ignore that element if it fails to meet your criteria).

This way, you fully resolve (or ignore) the value of each item in @data
one element at a time. Thus, you never need to post-process anything,
because everything you want to know is known when you finish the
outside loop around @data.

Consider this code:

#!/usr/bin/perl
   use strict; use warnings;

   my @data     = qw{ Men Women Children Pets Monnsters };
   my %keywords = ( 0 => 'm', 1 => 'n');
   my @results  = ();

WORD:
   foreach my $word(@data) {   #outside loop around word database
      my $count = 0;
      foreach my $keyword( values %keywords ) {  #inside loop
         next WORD unless $word =~ /$keyword/i;  #fail criteria-reject
         while ($word =~ /$keyword/ig) { $count++ } #perldoc -q count
      }
      push @results, "${count}::$word";
   }
   print join("|", @results), "\n";
   
__END__


-- 
David Filmer (http://DavidFilmer.com)



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

Date: 26 Jul 2006 02:10:57 -0700
From: usenet@DavidFilmer.com
Subject: Re: Getting Net::SFTP handle takes FOR-FLIPPIN-EVER
Message-Id: <1153905057.461233.301160@h48g2000cwc.googlegroups.com>

Sisyphus wrote:
> Somewhere in the Net::SFTP source there is presumably something like:
> use Math::BigInt lib => 'GMP';

There is no such line anywhere within my ../site_perl/5.8.6/Net
directory structure, including Net::SFTP and Net::SSH::Perl.  Which
further compounds my confusion........

> (I have a vague notion that a message is written
> to stderr if Math::BigInt::GMP is not found, telling you that the program is
> reverting to pure perl routines - but I'm not entirely sure about that.)

That would have been nice in helping me solve my problem, but no such
message came on STDERR before I installed the GMP module.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Wed, 26 Jul 2006 19:41:39 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Getting Net::SFTP handle takes FOR-FLIPPIN-EVER
Message-Id: <44c739be$0$1209$afc38c87@news.optusnet.com.au>


<usenet@DavidFilmer.com> wrote in message
news:1153905057.461233.301160@h48g2000cwc.googlegroups.com...
> Sisyphus wrote:
> > Somewhere in the Net::SFTP source there is presumably something like:
> > use Math::BigInt lib => 'GMP';
>
> There is no such line anywhere within my ../site_perl/5.8.6/Net
> directory structure, including Net::SFTP and Net::SSH::Perl.  Which
> further compounds my confusion........
>

Sorry .... sloppiness on my part. More likely it's in one of the modules
loaded by Net::SFTP/Net::SSH::Perl.

After a quick investigation, I think it's Crypt::DH:

use Math::BigInt lib => "GMP,Pari";

That will look for Math::BigInt::GMP. If it can't find that, it will look
for Math::BigInt::Pari. And if that can't be found, it reverts to pure perl
Math::BigInt. That's with Crypt::DH-0.06. With Crypt::DH-0.03 the module
simply read:

use Math::Pari qw( PARI floor pari2num Mod lift pari2pv );

Hence, we can see how, with earlier versions of Crypt::DH, the specific
issue that confronted you would not arise.

Cheers,
Rob




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

Date: Wed, 26 Jul 2006 08:38:41 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Handling KILL signal in a perl script
Message-Id: <ea72os$dvr$1@nntp.fujitsu-siemens.com>

A. Sinan Unur wrote:
> "Paul Lalli" <mritty@gmail.com> wrote in news:1153835306.539633.129170
> @h48g2000cwc.googlegroups.com:
>=20
>=20
>>Swarup Baran wrote:
>>
>>>What i need to handle is if this perl process gets a kill process
>>>either because of a manual  kill or machine reboot etc. I should be
>>>able to trap it, clean up if any resources and then EXIT.
>>
>>My understanding is that SIGKILL is very specifically *not* trappable.
>>Otherwise, it would be possible to write a program that simply cannot
>>be stopped (short of rebooting the machine).=20
>=20
>=20
> IIRC, On the *nix machines I have run, issuing the reboot command from =
the=20
> prompt, results in the OS sending a SIGHUP, followed by a KILL. Presuma=
bly,=20
> the SIGHUP is to allow processes to clean up.

issuing the "reboot" command sends a message to the "init" process to=20
enter runlevel 6. Init then takes over and works through the shutdown=20
scripts, one of which tries to stop applications in a leveled approach,=20
as you describe it.

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: 25 Jul 2006 21:39:24 -0700
From: "gavino" <bootiack@yahoo.com>
Subject: has anyone hre tried gantry? is it nice?
Message-Id: <1153888764.500654.243850@h48g2000cwc.googlegroups.com>

gantry looksed bombastic



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

Date: Wed, 26 Jul 2006 11:22:25 +0200
From: Gert Brinkmann <g111@netcologne.de>
Subject: Re: How to send utf-8 data using LWP::UserAgent?
Message-Id: <ea7c8i$mgo$1@newsreader2.netcologne.de>


Thank you, Peter, for your answer.

Peter J. Holzer wrote:
> You are not providing a complete script to demonstrate your problem.

Yes, Sorry. I have been so sure that the input to LWP was correct... but it
is not.

> Where does $xml_data come from? How do you know that it contains UTF-8?

I did a check via dumping data into a file:

-----------------
binmode $fh;
print $fh "isutf8=",(Encode::is_utf8($text,0)?1:0), "; correct="
(Encode::is_utf8($text,1)?1:0),"; debugprint=$text\n";
-----------------

the result was:
-----------------
isutf8=1; correct=1; ...gört...
-----------------

I just did notice the utf-8 flag and the utf-8-is-correct-flag. But now
after rechecking with your hexdump printout I see that it is a mistake
that "gört" is printed out readable.

Why does the is_utf8($text,1) routine tell me, that the utf-8 String is
correct utf-8 even if there is an iso-latin "ö" in the string?

Hmm, now I have to search why the "ö" is not correctly set as utf-8. This
charset/encoding topic is so unbelievable complicated.

Thank you again,
Gert



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

Date: Wed, 26 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jul 26 2006
Message-Id: <J2zuE7.1FL9@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Catalyst-Plugin-FormValidator-Simple-Auto-0.07
http://search.cpan.org/~typester/Catalyst-Plugin-FormValidator-Simple-Auto-0.07/
Smart validation with FormValidator::Simple
----
Catalyst-Plugin-StackTrace-0.06
http://search.cpan.org/~jguenther/Catalyst-Plugin-StackTrace-0.06/
Display a stack trace on the debug screen
----
DBD-Oracle-1.18a
http://search.cpan.org/~pythian/DBD-Oracle-1.18a/
Oracle database driver for the DBI module
----
DBIx-Class-Schema-Loader-0.03006
http://search.cpan.org/~blblack/DBIx-Class-Schema-Loader-0.03006/
Dynamic definition of a DBIx::Class::Schema
----
Data-Hierarchy-0.30
http://search.cpan.org/~clkao/Data-Hierarchy-0.30/
Handle data in a hierarchical structure
----
Data-Validate-0.06
http://search.cpan.org/~sonnen/Data-Validate-0.06/
common data validation methods
----
Data-Validate-MySQL-0.03
http://search.cpan.org/~sonnen/Data-Validate-MySQL-0.03/
validate against MySQL data types
----
Devel-PPPort-3.09_02
http://search.cpan.org/~mhx/Devel-PPPort-3.09_02/
Perl/Pollution/Portability
----
Encode-JavaScript-UCS-0.01
http://search.cpan.org/~miyagawa/Encode-JavaScript-UCS-0.01/
JavaScript unicode character encoding
----
Excel-Template-0.27
http://search.cpan.org/~rkinyon/Excel-Template-0.27/
Excel::Template
----
FLV-Info-0.11
http://search.cpan.org/~clotho/FLV-Info-0.11/
Extract metadata from Macromedia Flash Video files
----
File-Read-0.0601
http://search.cpan.org/~saper/File-Read-0.0601/
Unique interface for reading one or more files
----
Gnome2-GConf-1.032
http://search.cpan.org/~ebassi/Gnome2-GConf-1.032/
Perl wrappers for the GConf configuration engine.
----
HTML-EscapeEvil-AllowAll-0.05
http://search.cpan.org/~holly/HTML-EscapeEvil-AllowAll-0.05/
Escape tag.but all tag allow
----
Hash-Tally-0.01
http://search.cpan.org/~adapay/Hash-Tally-0.01/
Compute the tallies of hash values
----
Imager-0.52
http://search.cpan.org/~tonyc/Imager-0.52/
Perl extension for Generating 24 bit Images
----
InSilicoSpectro-Databanks-0.0.2
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.2/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
Lingua-Stem-0.82
http://search.cpan.org/~snowhare/Lingua-Stem-0.82/
Stemming of words
----
Mail-LocalDelivery-0.30_01
http://search.cpan.org/~rjbs/Mail-LocalDelivery-0.30_01/
Deliver mail to a local mailbox
----
OODoc-0.92
http://search.cpan.org/~markov/OODoc-0.92/
object oriented production of code related documentation
----
Perl6-Say-0.05_004
http://search.cpan.org/~jkeenan/Perl6-Say-0.05_004/
print -- but no newline needed
----
Pugs-Compiler-Rule-0.12
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.12/
Compiler for Perl 6 Rules
----
RT-Client-REST-0.12
http://search.cpan.org/~dmitri/RT-Client-REST-0.12/
talk to RT installation using REST protocol.
----
String-Work-1.00
http://search.cpan.org/~kostya/String-Work-1.00/
Module of work with the string
----
Test-Dependencies-0.08
http://search.cpan.org/~zev/Test-Dependencies-0.08/
Ensure that your Makefile.PL specifies all module dependencies
----
Test-Number-Delta-1.00
http://search.cpan.org/~dagolden/Test-Number-Delta-1.00/
Compare if the difference between two numbers is within a specified amount
----
Test-Use-0.03
http://search.cpan.org/~ishigaki/Test-Use-0.03/
do use_ok() for all modules MANIFESTed
----
Test-UseAllModules-0.04
http://search.cpan.org/~ishigaki/Test-UseAllModules-0.04/
do use_ok() for all modules MANIFESTed
----
Test-WWW-Mechanize-Object-0.01
http://search.cpan.org/~hdp/Test-WWW-Mechanize-Object-0.01/
run mech tests by making requests on an object
----
Tie-Cycle-Sinewave-0.03
http://search.cpan.org/~dland/Tie-Cycle-Sinewave-0.03/
Cycle through a series of values on a sinewave
----
URI-Fetch-0.08
http://search.cpan.org/~btrott/URI-Fetch-0.08/
Smart URI fetching/caching
----
XML-Flow-0.80
http://search.cpan.org/~zag/XML-Flow-0.80/
Store (restore) perl data structures in XML stream.
----
o2sms-3.16
http://search.cpan.org/~mackers/o2sms-3.16/
A module to send SMS messages using the website of O2 Ireland
----
prefork-1.01
http://search.cpan.org/~adamk/prefork-1.01/
Optimized module loading for forking or non-forking processes
----
version-0.66
http://search.cpan.org/~jpeacock/version-0.66/
Perl extension for Version Objects
----
version-0.661
http://search.cpan.org/~jpeacock/version-0.661/
Perl extension for Version Objects


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 26 Jul 2006 07:17:46 +0200
From: Aukjan van Belkum <aukjan@gmail.com>
Subject: Re: RExp matchs many times,how can i get the matched content?
Message-Id: <6e69e$44c6fad0$c2abfc64$32565@news1.tudelft.nl>

Ben Morrow wrote:

> 
> It's not an array, it's a list.
>
ok: s/array/list/gs
:-)


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

Date: 26 Jul 2006 09:23:24 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: RExp matchs many times,how can i get the matched content?
Message-Id: <4ioqkcF4mjpoU2@news.dfncis.de>

Aukjan van Belkum  <aukjan@gmail.com> wrote in comp.lang.perl.misc:
> Ben Morrow wrote:
> 
> > 
> > It's not an array, it's a list.
> >
> ok: s/array/list/gs

The /s modifier has no effect, it shouldn't be there.

Anno


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

Date: Wed, 26 Jul 2006 05:10:46 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Semantics of threads
Message-Id: <6j6jp3-01h.ln1@osiris.mauzo.dyndns.org>


Quoth Bo Lindbergh <blgl@stacken.kth.se>:
> In article <2flip3-m8d.ln1@osiris.mauzo.dyndns.org>,
>  Ben Morrow <benmorrow@tiscali.co.uk> wrote:
> 
> > Quoth Bo Lindbergh <blgl@stacken.kth.se>:
> > > 
> > > Really?  I looked at the source and found no attempts to block other
> > > threads from running between the fork and the exec.
> > 
> > I think you're suffering from the same misconception as I was: fork
> > doesn't duplicate all the threads in the process, only the calling
> > thread.
> 
> So you claim that it's a documentation error: the "some UNIX systems
> copy all the current threads into the child process" part should be
> removed from perlthrtut?

Err.... dunno. I know that's the case with pthreads as specced, but I
also know a lot of (mostly older) Unices don't follow (or predate) the
standard. I would be inclined to trust p5p to be more likely to get this
stuff right than me; and you *are* supposed to be able to call system
from a threaded Perl program, so I'd be seriously surprised if there's a
major problem with it hasn't been spotted yet.

Ben

-- 
I touch the fire and it freezes me,               [benmorrow@tiscali.co.uk]
I look into it and it's black.
Why can't I feel? My skin should crack and peel---
I want the fire back...                     Buffy, 'Once More With Feeling'


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

Date: Wed, 26 Jul 2006 18:07:25 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Use MSXML in perl without registration
Message-Id: <44c723a8$0$25358$afc38c87@news.optusnet.com.au>


"Ben Morrow" <benmorrow@tiscali.co.uk> wrote in message
news:eo8gp3-rh.ln1@osiris.mauzo.dyndns.org...
>
> Quoth "Sisyphus" <sisyphus1@nomail.afraid.org>:
> >
> > "Vinay" <shah.vinay@gmail.com> wrote in message
> > news:1153782403.410656.21810@75g2000cwc.googlegroups.com...
> > > I would like to use MSXML4.0 in my perl script, but not have it
> > > register on my machine. The way to do that is explained for C++ at
this
> > > link:
> > > http://www.perfectxml.com/articles/msxml/TipsAugust02.asp
> > > I am finding it difficult to port it over to perl. Anyone has any clue
> > > for the same? What steps do I need to take?
> > >
> >
> > You could use Inline::CPP to run that code from perl .... but only if
you
> > have a C++ compiler.
>
> But what would be the point of that? The point is to write Perl :).
>
> Note you could probably make mingw work with some effort... and you can
> precompile the module. I would probably *not* use Inline, but just write
> an XS module in C++ if I was going down that route.
>

Yeah - I just wanted to make the OP aware of the Inline::CPP module as an
option - but I didn't want to take the time to get too involved in providing
details, given that I didn't even know if the OP was prepared to go down
that route.

As to whether you use Inline or you write the XS module yourself, it boils
down to whether you want Inline to write the XS code for you ... or whether
you .... ummm .... want to write the XS code yourself. (I'd be using Inline
as I'm not all that proficient in writing XS code.) One advantage with
Inline is that running/debugging/fixing the functions as you develop them is
easy. One disadvantage with Inline is that, when it comes to converting that
script to a module there are some (fairly easily negotiated) hoops to jump
through.

> > Otherwise you can use the Win32::API module.
> >
> > With Win32::API, I envisage that there's no need to call LoadLibrary,
> > GetProcessAddress, and FreeLibrary. Instead you just access the
functions
> > from the dll directly. (However, I'm not sure if that's correct - given
that
> > you're dealing with COM objects.)
>
> That is correct insofar as calling Win32 APIs (or: C functions in DLLs
> with the __stdcall calling convention) goes: the Win32::API
> instantiation process does the LoadLibrary for you. However, you can't
> call C++ member functions at all, so you can't translate that code.
>

Oh .... bummer. Wasn't aware of that - thanks for correcting. (I try to
avoid Win32::API - usually go the XS route.) Is there some C-style way of
accessing those member functions with Win32::API ? Or does "you can't
translate the code" really *mean* "you can't translate the code" :-)

Cheers,
Rob





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

Date: 25 Jul 2006 21:19:02 -0700
From: "madan" <madan.narra@gmail.com>
Subject: Re: using session managment in perl
Message-Id: <1153887541.964509.257610@i42g2000cwa.googlegroups.com>

guyz please...

i was just asking for help from u but not to argue that the message is
totally out of subject from this group....

the main thing is i am doing on perl as well as CGI....

think CGI.pm is part of perl and how does that move away from this
group topic....

if at all u know the logic please do post ...but dont just say its
totally junk for this group..

k..i am using perl 5.6 on windows using apache server....

i need to create sessions but not using cookies...

please help me on this how to go with it...

thanks in advance..

madan



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

Date: Wed, 26 Jul 2006 08:39:02 GMT
From: Chris Newman <chris-newman@bigpond.com>
Subject: What is the right syntax?
Message-Id: <0001HW.C0ED659E001C4042F0284500@news.bigpond.com>


@names = {"a","b","c"};

@occup = {"d","e","f'};

foreach $i @names {

print ("$names[i], $occup[i]  \n");

}

The result I am after follows

a,d
be
cf

I suspect that $i returns the value stored in each element in the array not 
the index .  How do I change the code to make this happen?

Thanks



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

Date: Wed, 26 Jul 2006 10:51:10 +0200
From: Aukjan van Belkum <aukjan@gmail.com>
Subject: Re: What is the right syntax?
Message-Id: <7aebf$44c72cd4$c2abfc64$3239@news1.tudelft.nl>

Chris Newman wrote:
> @names = {"a","b","c"};

For a list assignment use: my @names = ( "a","b","c");
	or better:         my @names = qw( a b c );

> @occup = {"d","e","f'};
ditto
> 
> foreach $i @names {
> 
> print ("$names[i], $occup[i]  \n");
> 
> }
> 
> The result I am after follows
> 
> a,d
> be
> cf

intentionally without the comma for the last two sets??


hmmm... did you run this code??? this doesn't work.. Please inlcude:
   use strict;
   use warnings;
in your code and try to make it work first, before you post here!

Try with the hints, and then ask again if you are still having 
problems.. (might be usefull to read the posting guidlines, which are 
posted in this newsgroup)

Aukjan


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

Date: 26 Jul 2006 09:17:43 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: What is the right syntax?
Message-Id: <4ioq9nF4mjpoU1@news.dfncis.de>

Chris Newman  <chris-newman@bigpond.com> wrote in comp.lang.perl.misc:
> 
> @names = {"a","b","c"};
> 
> @occup = {"d","e","f'};
> 
> foreach $i @names {

That doesn't compile.  Please don't present code with syntax errors,
you can easily avoid that.

> print ("$names[i], $occup[i]  \n");
> 
> }
> 
> The result I am after follows
> 
> a,d
> be
> cf
> 
> I suspect that $i returns the value stored in each element in the array not 
> the index .  How do I change the code to make this happen?

One way is the module List::MoreUtils (from CPAN).  The function
pairwise() does exactly what you want.

Anno


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

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


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