[22435] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4656 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 3 14:13:02 2003

Date: Mon, 3 Mar 2003 11:10:12 -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           Mon, 3 Mar 2003     Volume: 10 Number: 4656

Today's topics:
    Re: NEWBIE: PerlNET <dthomson@NOSPAMusers.sf.net>
    Re: NEWBIE: PerlNET <jasonhood@tiscali.co.uk>
    Re: NEWBIE: PerlNET <dthomson@NOSPAMusers.sf.net>
    Re: NEWBIE: PerlNET <flavell@mail.cern.ch>
    Re: NEWBIE: PerlNET (Jay Tilton)
    Re: NEWBIE: PerlNET <newsfeed2@boog.co.uk>
    Re: NEWBIE: PerlNET <jasonhood@tiscali.co.uk>
    Re: NEWBIE: PerlNET <ubl@schaffhausen.de>
    Re: PDF::Create Problem <bart.lateur@pandora.be>
    Re: Perl Mysql uploading a image in a database. <simon.andrews@bbsrc.ac.uk>
        Program Flow.. (Nirmesh Jain)
    Re: Program Flow.. <goldbb2@earthlink.net>
        Question about inline. (Brian Snyder)
    Re: recursively adding arrays of arrays <jhayden@usa.com>
    Re: recursively adding arrays of arrays <jhayden@usa.com>
    Re: recursively adding arrays of arrays <jhayden@usa.com>
    Re: recursively adding arrays of arrays <goldbb2@earthlink.net>
        Stolen! <nobody@nox.lemuria.org>
    Re: Stolen! <newsfeed2@boog.co.uk>
    Re: Stolen! <ian@WINDOZEdigiserv.net>
    Re: The perl CD bookshelf <jpagnew@vcu.edu>
    Re: The perl CD bookshelf <jurgenex@hotmail.com>
        XML::DOM setData() issue <babernat@purdue.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 04 Mar 2003 00:36:05 +1000
From: Derek Thomson <dthomson@NOSPAMusers.sf.net>
Subject: Re: NEWBIE: PerlNET
Message-Id: <3e636839$0$27766$afc38c87@news.optusnet.com.au>

Jason Hood wrote:
> Hi,
> 
> Im looking into PerlNET as a solution.
> 
> I've installed activestate perl, the PDK and visual perl.
> When i use this command.
> 
> use namespace "System";
> 
> it tells me that namespace.pm cannot be found.

I don't know anything about .NET (since I'm uninterested in non-portable 
and proprietary technology that merely reinvents the wheel), but I can 
tell you why this isn't working in Perl.

Firstly, what made you think this would work at all?

"use namespace" is a C++ declaration, not to be confused with Perl's 
"use" statement which performs a function analagous to Java's "import". 
You are telling Perl to import a module named "namespace". That explains 
the error that you get.

And I've never heard of a "System" module for Perl.

Perhaps you meant:

use System;

??

Now, when I do that, I get a "System.pm not found" of course, but 
perhaps there's a System module on this PerlNET thing. What are you 
really trying to do?

What is PerlNET anyway? I'm assuming it's not a re-implementation of 
Perl that runs on the CLI, as they couldn't even get something simple 
like Python working on that! Python.NET is as dead as a dodo, last I 
heard, and turned out just to be a marketing exercise, to make people 
think that the CLI would do what the JVM does so well already with Jython.

Regards,
Derek.



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

Date: Mon, 3 Mar 2003 14:46:53 -0000
From: "Jason Hood" <jasonhood@tiscali.co.uk>
Subject: Re: NEWBIE: PerlNET
Message-Id: <3e636a7c$1_1@mk-nntp-2.news.uk.tiscali.com>

Hi Derek,

Sorry to hear you dont like .NET

Activestate documentation made me believe this would work.
PerlNET is activestates implementation of Perl for .NET

Thankyou for the lesson, but im fully aware of what the use statement is
for.

WARNING: Such venomous hatred towards Microsoft will only serve to give YOU
heartburn.

Jason

"Derek Thomson" <dthomson@NOSPAMusers.sf.net> wrote in message
news:3e636839$0$27766$afc38c87@news.optusnet.com.au...
> Jason Hood wrote:
> > Hi,
> >
> > Im looking into PerlNET as a solution.
> >
> > I've installed activestate perl, the PDK and visual perl.
> > When i use this command.
> >
> > use namespace "System";
> >
> > it tells me that namespace.pm cannot be found.
>
> I don't know anything about .NET (since I'm uninterested in non-portable
> and proprietary technology that merely reinvents the wheel), but I can
> tell you why this isn't working in Perl.
>
> Firstly, what made you think this would work at all?
>
> "use namespace" is a C++ declaration, not to be confused with Perl's
> "use" statement which performs a function analagous to Java's "import".
> You are telling Perl to import a module named "namespace". That explains
> the error that you get.
>
> And I've never heard of a "System" module for Perl.
>
> Perhaps you meant:
>
> use System;
>
> ??
>
> Now, when I do that, I get a "System.pm not found" of course, but
> perhaps there's a System module on this PerlNET thing. What are you
> really trying to do?
>
> What is PerlNET anyway? I'm assuming it's not a re-implementation of
> Perl that runs on the CLI, as they couldn't even get something simple
> like Python working on that! Python.NET is as dead as a dodo, last I
> heard, and turned out just to be a marketing exercise, to make people
> think that the CLI would do what the JVM does so well already with Jython.
>
> Regards,
> Derek.
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003




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

Date: Tue, 04 Mar 2003 00:58:20 +1000
From: Derek Thomson <dthomson@NOSPAMusers.sf.net>
Subject: Re: NEWBIE: PerlNET
Message-Id: <3e636d70$0$27770$afc38c87@news.optusnet.com.au>

Jason Hood wrote:
> Hi Derek,
> 
> Sorry to hear you dont like .NET

I don't know much about it apart from the hype, except it only runs on 
Windows. Since I only run sensible OSes that rules it out for me for the 
time being.

When it runs on a reasonable OS, and MS de-patent all the bits of it 
they have locked up, I'll become interested. Until then, I can only 
assume it's Microsoft's hateful reaction to their failure to destroy 
Java. By re-doing Java and locking everyone into their "solution".

> 
> Activestate documentation made me believe this would work.
> PerlNET is activestates implementation of Perl for .NET

So, have they implemented Perl on the CLI, or is this just using the 
existing Perl implementation through some kind of .NET interface so that 
ActiveState get some more buzzword compliance?

Have your considered Visual Basic? I gather it works with .NET just fine.

> 
> Thankyou for the lesson, but im fully aware of what the use statement is
> for.

Clearly not, if you expected "use namespace ..." to work. But, you just 
can't help some people!

> 
> WARNING: Such venomous hatred towards Microsoft will only serve to give YOU
> heartburn.

Why? I don't use their products at all. I just have silly people telling 
me I must use their poor software for no good reason.

And stating the facts is not hatred. Unless Python.NET has been raised 
from the dead, it is axiomatic that the JVM runs Python better than the CLI.

Regards,
Derek.



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

Date: Mon, 3 Mar 2003 16:20:44 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: NEWBIE: PerlNET
Message-Id: <Pine.LNX.4.53.0303031618180.20847@lxplus081.cern.ch>

On Mon, Mar 3, Jason Hood wibbled incoherently atop a fullquote:

> Hi Derek,
>
> Sorry to hear you dont like .NET
>
> Activestate documentation made me believe this would work.
> PerlNET is activestates implementation of Perl for .NET
>
> Thankyou for the lesson, but im fully aware of what the use statement is
> for.
>
> WARNING: Such venomous hatred towards Microsoft will only serve to give YOU
> heartburn.

Looks like March is going to be a big-plonk month, based on the first
few days.


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

Date: Mon, 03 Mar 2003 16:25:57 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: NEWBIE: PerlNET
Message-Id: <3e637527.29318681@news.erols.com>

Derek Thomson <dthomson@NOSPAMusers.sf.net> wrote:

: Jason Hood wrote:
: > Hi,
: > 
: > Im looking into PerlNET as a solution.
: > 
: > I've installed activestate perl, the PDK and visual perl.
: > When i use this command.
: > 
: > use namespace "System";
: > 
: > it tells me that namespace.pm cannot be found.
: 
: I don't know anything about .NET (since I'm uninterested in non-portable 
: and proprietary technology that merely reinvents the wheel), but I can 
: tell you why this isn't working in Perl.

By your own admission of unfamiliarity, you are making guesses.
 
: Firstly, what made you think this would work at all?

Because it is in lots of Activestate PDK sample code.

The use namespace "System"; pragma tells Perl to look up types in the
System namespace.
 
: "use namespace" is a C++ declaration, 

So?  

It may be inferred that the pragma's name was chosen to make C++
programmers more comfortable, but it's valid Perl.  All it needs is to
find namespace.pm.

: You are telling Perl to import a module named "namespace". That explains 
: the error that you get.

The error is that namespace.pm cannot be found, not that the OP is
trying to get Perl to run C++ code.

Reasonably, this pragma would be part of the Activestate PDK.  Since
it cannot be found, the PDK has been improperly installed.

The OP may wish to contact Activestate's support on this issue.  They
should be able to provide a solution to the difficulty with minimal
guesswork and FUD.

: And I've never heard of a "System" module for Perl.
:
: Perhaps you meant:
:
: use System;

You are trying to intuit meanings that are not there.

: What is PerlNET anyway? 

It stitches Perl into the .NET framework.  Advocacy issues have no
relevance to the OP's technical difficulty.



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

Date: Mon, 3 Mar 2003 16:58:04 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: NEWBIE: PerlNET
Message-Id: <U5M8a.11064$EN3.87505@newsfep4-glfd.server.ntli.net>

Alan J. Flavell wrote:
> Looks like March is going to be a big-plonk month, based on the first
> few days.

If asking a valid question related to Perl, if not the standard distribution, is
considered 'plonk' in c.l.p.m, then I certainly look forward to seeing many more
on-topic posts full of Microsoft bashing and FUD.

Pete




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

Date: Mon, 3 Mar 2003 17:22:13 -0000
From: "Jason Hood" <jasonhood@tiscali.co.uk>
Subject: Re: NEWBIE: PerlNET
Message-Id: <3e638ee4$1_2@mk-nntp-2.news.uk.tiscali.com>

> The OP may wish to contact Activestate's support on this issue.  They
> should be able to provide a solution to the difficulty with minimal
> guesswork and FUD.
>

Thanks fopr everyones comments, i've re-installed the PDK a couple of times
with no joy, and have contacted activestate.

I'll post the response here in case anyone else has a similar problem.

Cheers,

Jason


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003




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

Date: Mon, 03 Mar 2003 17:48:15 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: NEWBIE: PerlNET
Message-Id: <b40472$dgf$1@news.dtag.de>

Jason Hood wrote:
> Hi,
> 
> Im looking into PerlNET as a solution.
> 
> I've installed activestate perl, the PDK and visual perl.
> When i use this command.
> 
> use namespace "System";
> 
> it tells me that namespace.pm cannot be found.

Why did you multipost to clp.moderated?

use namespace "System";

translates roughly to:

BEGIN {
	require "namespace.pm"; # which could be written as
                                 # require namespace
	namespace->import("System");
}

Perl looks for namespace.pm and can't find it. If the docs tell you it 
should work the docs are wrong. We don't have the docs, so we can't tell 
you.

I don't know the namespace module (the one on CPAN), but its rather 
unlikely that that's the one you are referring to, because then your 
usage would not make sense at all.

Maybe your installation is incomplete or you forgot to tell perl to look 
at the right places.

->malte


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

Date: Mon, 03 Mar 2003 17:30:53 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: PDF::Create Problem
Message-Id: <ps376vokgodqprp122prsjcsghvvimv45e@4ax.com>

Sébastien Cottalorda wrote:

>I encoutered problem using PDF::Create Module on win32 Platform:
>        Win2000 Server with ActivePerl 5.6.1
>
>I manage without any problem to create PDF files and:
>        - With Acrobat Reader, read and print them.
>        - With Ghostscript 7.34 or Ghostscript 8.00 => NO WAY
>
>I always get :
>"Error: syntaxerror in readxref ... Unrecoverable error exit code 1".
>
>No problems with the same module but using Linux version.

>If someone has a clue ?

I have a clue, though I'm not familiar with this module. My idea is that
the handle to which the file must be saved, should have been binmode()d,
but hasn't been. Therefore, you'd get corrupt line endings. Are you sure
Acrobat Reader doesn't complain a bit like "this file is corrupt, trying
to repair it..."?

As I said, I'm not familiar with this module. I don't know if you can
enforce binmode on the output handle. Perhaps it's just a bug in this
module.

I just looked at the source, there's no "binmode" in it. Under the line

    my $fh = new FileHandle "> $self->{'filename'}";

add

   binmode $fh;


p.s. I consider it very impolite to request follow-ups to be *just* sent
to poster. I'm not your personal helpdesk. This should be an open
discussion, to the benefit of everyone. So I'm bypassing your request,
and post a follow-up anyway.

-- 
	Bart.


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

Date: Mon, 03 Mar 2003 16:49:04 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Perl Mysql uploading a image in a database.
Message-Id: <3E638780.7A79840F@bbsrc.ac.uk>

niels wrote:
> 
> Hello there,
> 
> I'm trying to upload a image from a html form to a mysql database.
> 
> For some reason i can't manage to do this right. Don't tell me to save
> the image in a directory and save a url in the database. I just don't
> want that.

Make sure that both your incoming and outgoing filehandles have had
binmode applied to them (perldoc -f binmode), also make sure that the
field you are storing your data in is of a type which can safely store
binary data (probably some kind of blob, but see your database manual
for this).

> $afbeelding=$dbh->quote($afbeelding);

When you're doing your updates you should be using placeholders and not
the separate quote method.  From perldoc DBI:

	"When trying to insert long or binary values, placeholders
	should be used since there are often limits on the maximum
	size of an `INSERT' statement and the the quote entry
	elsewhere in this document method generally can't cope
	with binary data.  See the Placeholders and Bind Values
	entry elsewhere in this document."

> Sometimes, he saves the image right. sometimes i get an error.

 ..and that error would be??  You don't show us the actual sql execution,
but make sure that when you run your insert statement you check for
errors, and print $dbh->errstr() if it fails.


> To show the image i use this. 
>
> $reclame_imgno=shift;
>
> print "Content-Type: image/jpeg\n\n";
> print "$reclame_imgno";

This will corrupt your image.  First, no binmode on STDOUT, and second
you print $reclame_imgno as part of the image.  After you've put out
your content header you must ONLY print your binary data.


> my $reclamesth=Execute_Query("select image from imgarchief where
> img_id=$reclame_imgno");

No quoting of $reclame_imgno, and we don't see the sql execution code.

> while($return=$reclamesth->fetchrow)
> {
> print $return;
> }

Eh?  Why the while loop if you only want to ever return one image? 
Also, assuming that you're using DBI, then fetchrow on its own isn't a
method.  Maybe you meant something like...

my $sth = $dbh->prepare("select image from imarchief where img_id=?");

$sth->execute($reclame_imgno) || die $dbh->errstr();

my ($return) = $sth -> fetchrow_array();

unless ($return) {
    die "No image returned";
}

binmode STDOUT;

print $return;



Hope this helps

Simon.


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

Date: 3 Mar 2003 09:33:59 -0800
From: njain2@cse.buffalo.edu (Nirmesh Jain)
Subject: Program Flow..
Message-Id: <5840cd68.0303030933.41b301c9@posting.google.com>

Hi,

I am trying to execute a code that uses Forking from
Parallel::ForkManager module. After executing $pm->finish for every
child, my flow goes to start of the program rather than waiting for
all the children to get executed.

I am not able to understand, how my program is going to start every
time after it executes a child.

I would really appreciate if someone can suggest me the error. Snippet
of code is enclosed below.

Thanks,
Nirmesh


my output in checkfile.log looks like:

In File Parser...
ABOUT TO WRITE PROGRess Report
PROGRess Report Written
Exec Children...
In Child.. Value of PID = 0
Child number 1 Fork
Children number = 1
After Executing function..
Finishing Child...
In File Parser...
ABOUT TO WRITE PROGRess Report
PROGRess Report Written
Exec Children...
In Child.. Value of PID = 0
Child number 3 Fork
Children number = 3
After Executing function..
Finishing Child...
In File Parser...
ABOUT TO WRITE PROGRess Report
PROGRess Report Written
In Number of FILES...
 .
 .
 .


****************** Snippet of Code ************************

use Parallel::ForkManager;

#Start of Program...
$checkfilelog = 'checkfile.log';

open(CHECKFILELOG, ">>$checkfilelog");
print CHECKFILELOG "In File Parser...\n";
print CHECKFILELOG "ABOUT TO WRITE PROGRess Report\n";
 # Call to Progress Report Function....
print CHECKFILELOG "PROGRess Report Written\n";

 #some processing...
    .
    .
    .
    .

  
 print CHECKFILELOG "Exec Children...\n";
  
 for ($child=0;$child<=$#Header;$child++) 
 {
    my $pid = $pm->start($Header[$child]) and next;	
    print CHECKFILELOG "In Child.. Value of PID = $pid\n";
    print CHECKFILELOG "Child number $child Fork\n";
    my $seqid = $maxseqid + $child;	       
    $dbpar = 'DBI:Ingres:' . $db;
    $dbh = DBI->connect ($dbpar) or return (0, "Cannot connect");	
    if($Mode[$child] eq 'F') {
        
        # Call to some function...
        my ($retval, $errtext) = &call_to_function(.......);
       
        print CHECKFILELOG "After Executing function..\n"      	
	if ($retval == 0) { &abort_fp ($runid, $howinv, $errtext) }
    }
   # This line is added to disconnect child from database once it's
done
   $dbh->disconnect or &abort_fp($runid, $howinv, "Error
disconnecting");
   $pm->finish($child); #Finishing child
   print CHECKFILELOG "AFter Finish... Value of PID = $pid\n";
  }

   print CHECKFILELOG "Waiting for Children..\n";
   $pm->wait_all_children;	 #Wailt until all children are done


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

Date: Mon, 03 Mar 2003 13:17:44 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Program Flow..
Message-Id: <3E639C48.5159ECC6@earthlink.net>

Nirmesh Jain wrote:
[snip]
>  for ($child=0;$child<=$#Header;$child++)
>  {
>     my $pid = $pm->start($Header[$child]) and next;
>     print CHECKFILELOG "In Child.. Value of PID = $pid\n";

In the child, the $pid variable will be zero.  If you want the
child process's actual pid here, print out the $$ variable.

>     print CHECKFILELOG "Child number $child Fork\n";
>     my $seqid = $maxseqid + $child;
>     $dbpar = 'DBI:Ingres:' . $db;
>     $dbh = DBI->connect ($dbpar) or return (0, "Cannot connect");
>     if($Mode[$child] eq 'F') {
> 
>         # Call to some function...
>         my ($retval, $errtext) = &call_to_function(.......);
> 
>         print CHECKFILELOG "After Executing function..\n"
>         if ($retval == 0) { &abort_fp ($runid, $howinv, $errtext) }
>     }
>    # This line is added to disconnect child from database once it's
> done
>    $dbh->disconnect or &abort_fp($runid, $howinv, "Error
> disconnecting");
>    $pm->finish($child); #Finishing child
>    print CHECKFILELOG "AFter Finish... Value of PID = $pid\n";
>   }

The $pm->finish() internally calls exit.  The line of code which prints
out "After finish..." is never reached!

Also.... You may have better performance if you could create the
database connection in the parent, and set the InactiveDestroy
attribute on the database handle in the child.  That is:

   my $dbh = DBI->connect("DBI:Ingres:$db")
      or die $DBI::errstr;
   $dbh->{RaiseError} = 1;
   for my $i (0 .. $#Header) {
      if( $Mode[$i] ne 'F' ) {
         print CHECKFILELOG "Skipping child # $i, mode != F\n";
         next;
      }
      my $run_on_finish_info = $Header[$i];
      $pm->start($run_on_finish_info) and next;
      print CHECKFILELOG "In child number $i, PID = $$\n";
      $dbh->{InactiveDestroy} = 1;
      my ($retval, $errtext) = &call_to_function(.......);
      abort_fp($runid, $howinv, $errtext) unless $retval;
      undef $dbh;
      print CHECKFILELOG "About to finish child $i, PID $$\n";
      $pm->finish(0); # zero indicates success.
      # Since $pm->finish calls exit, this line is not reached.
   }

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: 3 Mar 2003 08:41:43 -0800
From: bsnyder030174@yahoo.com (Brian Snyder)
Subject: Question about inline.
Message-Id: <668c9529.0303030841.3244647b@posting.google.com>

Hi all.  Im exploring different ways of linking C and perl together,
Ive played around with swig a bit, and now i'm playing around with
inline.  I have a problem though, which I'm hoping someone can give me
some tips about:

I copied the function found in this tutorial :
http://www.perl.com/pub/a/2001/02/inline.html

The function is the following:

use Inline C => << 'END_C';
void greet(){
  printf("Hello, world\n");
}
END_C

greet;


(Of course I added the #!/usr/bin/perl as the first line).

Anyway, when I run the script I get no output at all.  It doesn't
print the hello, world and it doesnt print any errors.

I havent installed my own module before, but if perl couldnt find the
inline module, I believe it would have given me an error... I
installed it by downloading the source from cpan and moving the file
directly into /usr/lib/perl5/site_perl/5.6.0 directory.

I am using linux RH8.0 and perl5.6.0

Thanks in advance for any tips,
  ---brian


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

Date: Mon, 3 Mar 2003 12:20:24 -0500
From: "ravlin" <jhayden@usa.com>
Subject: Re: recursively adding arrays of arrays
Message-Id: <t9M8a.122$DF5.3331@chrome-fe.eng.netapp.com>

Hmm.  That's interesting.  Maybe I'll try it and see what happens.  Thanks a
lot!

"Stefan" <someone@somewhere.nl> wrote in message
news:3e60f027$0$156$e4fe514c@dreader7.news.xs4all.nl...
> "ravlin" <jhayden@usa.com> schreef in bericht
> news:pG28a.57211$If5.3162089@twister.southeast.rr.com...
> > Hi all,
> >
> > I'm thinking there's an easy solution to this problem.  I've been trying
> to
> > come up with it for the last couple days, but haven't been able to.  I'm
> > trying to write a function that will parse a file. This file contains a
> list
> > of tests I want to run.  Everytime it comes to a line with a "{", I want
> to
> > start a new array so as I go deeper into blocks of data, I can keep
things
> > sorted out.  I'm probably confusing you, so let me give you an example.
> > Everything to the right of the # is what I want the value to be in perl.
> >
> > {                             # $testgroup[0]
> >     var1=1                # $testgroup[0]{'vars'}[0] = "var1=1"
> >     var2=2                # $testgroup[0]{'vars'}[1] = "var2=2"
> >     {                         # $testgroup[0][0]
> >         {                     # $testgroup[0][0][0]
> >             var3=3        # $testgroup[0][0][0]{'vars'}[0] = "var3=3"
> >             {                 # $testgroup[0][0][0][0]
> >                 test1       # $testgroup[0][0][0][0]{'test'}[0] =
"test1"
> >                 test2       # $testgroup[0][0][0][0]{'test'}[1] =
"test2"
> >             }
> >             {                 # $testgroup[0][0][0][1]
> >             }
> >         }
> >         {                     # $testgroup[0][0][1]
> >             test3           # $testgroup[0][0][1][0]{'test'}[0] =
"test3"
> >             test4           # $testgroup[0][0][1][0]{'test'}[1] =
"test4"
> >         }
> >     }
> > }
> >
> > This is a simple example.  Basically, each test will pick up different
> > values depending on where they are located in this file.  So the
variable
> > var1 and var2 will be seen by all 4 tests, but var3 will only be seen by
> > test1 and test2, but not test3 and test4.  So, the scope of each test is
> > important.  I'm not a great perl programmer so maybe I'm going about it
> all
> > wrong and don't want to use arrays of arrays (of hashes).  It seems
pretty
> > straight forward to me looking at the example I have, but I just can't
> > figure out he code to keep adding on more arrays (and then taking them
off
> > as the blocks close).  Thanks for ANY help or direction you can give me.
> >
> > Jon
>
>
> I wouldn't go there since it's getting you nowhere. I couldn't even figure
> out what you're trying to accomplish.
>
> Instead of building arrays-of-arrays-of-arrays-etc try generating a
keyword
> for a associative hashed array. Much easier to "dump" too when your
> debugging. The value  don't need to be strings but can be arrays too.
> When in your example an array is identified as
> $testgroup[0][0][1][0]{'test'}[0]  the keyword would be (for example using
> underscores) "0_0_1_0_test_0".
>
> It doesn't do a thing for your test-scope.s That's something which you
need
> to implement in the logics of your program.
>
> Just an idea - hopefully it will guide you in the right direction.
>
> Stefan
>
>
>




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

Date: Mon, 3 Mar 2003 12:23:40 -0500
From: "ravlin" <jhayden@usa.com>
Subject: Re: recursively adding arrays of arrays
Message-Id: <xcM8a.123$DF5.3331@chrome-fe.eng.netapp.com>

Thanks Anno.  I took a look at the module.  It's pretty powerful.  The
problem is I spent all day looking at it and I still don't understand how to
use it :-(  It think it's above my understanding of perl right now.  The
documentation on it seemed confusing and I searched the web for good
examples and couldn't really find anything.  I kinda got the idea that all
it will do is parse it, but I still have to come up with a way to solve my
problem.  I wasn't sure how to keep track of nested blocks of data in my
config file.  Oh, well.  Thanks for the suggestion.

Jon

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:b3qq61$4cd$2@mamenchi.zrz.TU-Berlin.DE...
> ravlin <jhayden@usa.com> wrote in comp.lang.perl.misc:
> > Hi all,
> >
> > I'm thinking there's an easy solution to this problem.  I've been trying
to
> > come up with it for the last couple days, but haven't been able to.  I'm
> > trying to write a function that will parse a file.
>
> So you want to write a parser.
>
> >                                                    This file contains a
list
> > of tests I want to run.  Everytime it comes to a line with a "{", I want
to
> > start a new array so as I go deeper into blocks of data, I can keep
things
> > sorted out.  I'm probably confusing you, so let me give you an example.
> > Everything to the right of the # is what I want the value to be in perl.
> >
> > {                             # $testgroup[0]
> >     var1=1                # $testgroup[0]{'vars'}[0] = "var1=1"
> >     var2=2                # $testgroup[0]{'vars'}[1] = "var2=2"
> >     {                         # $testgroup[0][0]
>
> These are nested structures.  Use Parse::RecDescent.
>
> [snip rest]
>
> Anno




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

Date: Mon, 3 Mar 2003 12:37:09 -0500
From: "ravlin" <jhayden@usa.com>
Subject: Re: recursively adding arrays of arrays
Message-Id: <9pM8a.124$DF5.3515@chrome-fe.eng.netapp.com>


"Abigail" <abigail@abigail.nl> wrote in message
news:slrnb63rso.4ov.abigail@alexandra.abigail.nl...
> ravlin (jhayden@usa.com) wrote on MMMCDLXIX September MCMXCIII in
> <URL:news:pG28a.57211$If5.3162089@twister.southeast.rr.com>:
> ||
> ||      var2=2                # $testgroup[0]{'vars'}[1] = "var2=2"
>
> Ok, so $testgroup [0] is a reference to a hash.
>
> ||      {                         # $testgroup[0][0]
>
> But now, $testgroup [0] is a reference to an array.
>
> What's it going to be?

Ah, yes, I see the dilema.  I probably meant something like:

$testgroup[0]{'vars'}[1] = "var2=2"
and
$testgroup[0][1]

I guess, don't look so much at what the values should be.  maybe a solution
or idea on how to solve my problem.  How do I keep track of nested blocks of
data and to keep the data local to it's scope.  I know this is a lot to
ask...sorry.  Any pointers would be appreciated.

Thanks,

Jon


>
>
>
> Abigail
> --
> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"




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

Date: Mon, 03 Mar 2003 13:43:32 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: recursively adding arrays of arrays
Message-Id: <3E63A254.73916211@earthlink.net>

ravlin wrote:
[snip]

How about you manually construct a bit of perl code which produces the
same data structure as you want your sample data to produce.

Your data was something like:
{
   var1=var1
   var2=var2
   {
      {  var3=var3
         {  test1
            test2 }
         { } }
      {  test3
         test4 } } }

(Yes, I know I'm ommitting a lot of whitespace.  So sue me.)

I *think* (but am not entirely sure) that you want this to produce:

my @testgroup = (
   { 'vars' => [ qw( var1=var1 var2=var2 ) ] },
   [  {},
      [  { 'vars' => [ qw( var3=var3 ) ] },
         [  { 'test' => [ qw( test1 test2 ) ] } ]
         [ ] ],
      [  { 'test' => [ qw( test3 test4 ) ] } ] ] );

So, each level consists of a hashref (as it's first element), and, for
each "{" ... "}" group immediately within it, an arrayref.

Is this right?


-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


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

Date: Mon,  3 Mar 2003 17:10:08 +0100 (CET)
From: Anonymous <nobody@nox.lemuria.org>
Subject: Stolen!
Message-Id: <8b3f02ccc2d6f2759ae56a378df99b63@nox.lemuria.org>

Those Bastards!

Those Bastards at Tampax have named their new product

Pearl!

Yikes!  So I'm watching (just listening really) to
L&O C.I., Dragnet, whatever with my nose in the Book,
"Programming Perl" by Larry Wall, et al, and I hear
"Perl".  So I look up at the screen and there they are!
Pretty girls selling tampons.  Eeuuuwwww!

Those Bastards!  Can't even watch TV anymore.



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

Date: Mon, 3 Mar 2003 16:55:19 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Stolen!
Message-Id: <T5M8a.11063$EN3.87505@newsfep4-glfd.server.ntli.net>

> Yikes!  So I'm watching (just listening really) to
> L&O C.I., Dragnet, whatever with my nose in the Book,
> "Programming Perl" by Larry Wall, et al, and I hear
> "Perl".  So I look up at the screen and there they are!
> Pretty girls selling tampons.  Eeuuuwwww!

Well when those jumped up PHP programmers tell me to shove Pe(a)rl up my ass, at
least I know it'll be hygenic from now on.

Pete




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

Date: Mon, 03 Mar 2003 17:23:24 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Stolen!
Message-Id: <eq376vo9k598o5hhc4tqdeq0061nsbh19j@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on Mon, 3 Mar 2003 16:55:19 -0000, "Peter
Cooper" <newsfeed2@boog.co.uk> managed to scribble:

> > Yikes!  So I'm watching (just listening really) to
> > L&O C.I., Dragnet, whatever with my nose in the Book,
> > "Programming Perl" by Larry Wall, et al, and I hear
> > "Perl".  So I look up at the screen and there they are!
> > Pretty girls selling tampons.  Eeuuuwwww!
> 
> Well when those jumped up PHP programmers tell me to shove Pe(a)rl
> up my ass, at least I know it'll be hygenic from now on.
> 
> Pete
> 


They aint all jumped up =P

Personally, I changed from Perl to PHP for Web development, but
wouldn't drop Perl for system scripting for anything on the market at
present.

If it's not ASP... it can't be all bad.. and each to their own =)



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPmOPi2fqtj251CDhEQJXMQCcD3W2KPhAChJQC9aD5tJisuRnWgwAnA0n
gSGSZhqxLjo5C6OE3MwhI8OG
=73Wf
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: Mon, 03 Mar 2003 09:42:29 -0500
From: Jim Agnew <jpagnew@vcu.edu>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Subject: Re: The perl CD bookshelf
Message-Id: <3E6369D4.A1EE83AF@vcu.edu>

I'm not sure, but if you *BOUGHT* your originial copy, wouldn't getting
a friend to burn you one be legal under "fair use"??, like a backup
copy? That's the *FIRST* thing i didn with my Perl CD bookshelf, but I
do not let people know i have it, either the copy or the original. I'm
so tired of explaining why they can't have copies of my whatever...

Randal, can you comment?

Jim

"Randal L. Schwartz" wrote:
> 
> >>>>> "Peter" == Peter Cooper <newsfeed2@boog.co.uk> writes:
> 
> Peter> BTW, I was looking on Google for some Perl related stuff earlier, and found what
> Peter> I wanted.. then realised I was in an online rip off of the Perl CD Bookshelf.
> Peter> It's a Russian site. Not very hard to find, this exercise is left to the reader
> Peter> :-)
> 
> Please report those when you find them to <infringement@oreilly.com>.
> 
> Otherwise, O'Reilly doesn't make their money, and I don't make my
> money, and I don't get to write more books.
> 
> --
> 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!

-- 
"4,000 years ago I made a mistake."  Elrond Half-Elven, in "Fellowship
of the Ring"


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

Date: Mon, 03 Mar 2003 15:28:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: The perl CD bookshelf
Message-Id: <TwK8a.62974$ep5.44781@nwrddc02.gnilink.net>

Jim Agnew wrote:
> I'm not sure, but if you *BOUGHT* your originial copy, wouldn't
> getting a friend to burn you one be legal under "fair use"??,

That would very much depend upon in which country this backup is created.
For example in Germany creating a copy (of anything) for personal use is
legal provided you aquired the original legally. This even includes giving a
copy to your friends for personal use.
And no, Napster is not legal in Germany because those trading partners there
don't qualify as "friends and family".

jue




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

Date: Mon, 3 Mar 2003 13:52:38 -0500
From: "Brian Abernathy" <babernat@purdue.edu>
Subject: XML::DOM setData() issue
Message-Id: <b4088e$8he$1@mozo.cc.purdue.edu>

I'm new to XML and OO programming, that said I have an XML doc with empty
tags that I would like to update with values.  However, the
XML::DOM::Text::setData method requires a text object to exist before it can
use the setData method.  How can I update empty tags that do not contain
existing values?  Thanks.

Brian




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

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


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