[28997] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 241 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 20 11:10:24 2007

Date: Tue, 20 Mar 2007 08:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 20 Mar 2007     Volume: 11 Number: 241

Today's topics:
    Re: "Casting" a split into an array <wyzelli@yahoo.com>
    Re: "Casting" a split into an array <fabrice.baro@gmail.com>
        [cross-posting] perl-gtk installation failing on Solari <emailatishay@gmail.com>
        bigint and eval <iler.ml@gmail.com>
    Re: bigint and eval anno4000@radom.zrz.tu-berlin.de
    Re: bigint and eval <iler.ml@gmail.com>
    Re: bigint and eval anno4000@radom.zrz.tu-berlin.de
    Re: bigint and eval <paduille.4060.mumia.w+nospam@earthlink.net>
    Re: checking for filehandle <bik.mido@tiscalinet.it>
    Re: eq and =? problem? Geoff Cox
    Re: eq and =? problem? <bik.mido@tiscalinet.it>
    Re: eq and =? problem? <bik.mido@tiscalinet.it>
    Re: eq and =? problem? <tadmc@augustmail.com>
    Re: eq and =? problem? Geoff Cox
    Re: I dotn understand this error <nospam-abuse@ilyaz.org>
    Re: I dotn understand this error <hackeras@gmail.com>
    Re: I dotn understand this error <hackeras@gmail.com>
    Re: I dotn understand this error <hackeras@gmail.com>
    Re: I dotn understand this error <bik.mido@tiscalinet.it>
    Re: I dotn understand this error <bik.mido@tiscalinet.it>
    Re: No -e allowed in setuid scripts? <stembe@gmail.com>
    Re: passing passords to pgsql/pg_create/pg_dump program <njus@larshaugseth.com>
        perl: adding lines and replacing stings <samdaniels@gmail.com>
    Re: Question about scoping <megapode@gmail.com>
        Server/Clients system <deadpickle@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Mar 2007 10:32:07 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: "Casting" a split into an array
Message-Id: <HKOLh.13803$8U4.13512@news-server.bigpond.net.au>

"John W. Krahn" <someone@example.com> wrote in message 
news:O1KLh.130871$cE3.3947@edtnps89...
> Fabrice Baro wrote:
>> Thank you all,
>>
>> I wasn't that clear on what I wanted, sorry about that.
>> What I wanted was to split a string individually by character and
>> assign them to an array*; this array was to be assigned in the hash;
>> The solution that worked for me was Mirco's:
>> $hash{$key} = [ split '', $seq ];
>>
>> xhos's suggestion:
>> ( $hash{$key} ) = split "", $seq;
>> seems to assign only the first letter of $seq to the hash.
>>
>> * hence the null splitting pattern ""; the reason I do this is to be
>> able to access each letter by index C++-style, e.g. $seq[0].
>> Is there a way to do this with perl ? The only indexing I found is
>> with substr(), but this function has little use for this case.
>
> What do you intend to do with the individual letters.  There is probably a
> better way to do it in Perl without using split.

Exactly..

I have previously seen a string split into characters and then compared 
character by character with another string (as you would in C) rather than 
just comparing the two strings (as you do in Perl).

This has the feel of an X-Y to me...

P
-- 




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

Date: 20 Mar 2007 07:49:06 -0700
From: "Fabrice Baro" <fabrice.baro@gmail.com>
Subject: Re: "Casting" a split into an array
Message-Id: <1174402146.567952.111460@d57g2000hsg.googlegroups.com>

> the reason I do this is to be able to access each letter by index C++-style
I want to randomly select a certain number of letters among my
string.
I'm planning to shuffle an index and pick the desired number of
letters.

Original:
0 1 2 3 4 5 <- index
L G R D T I <- letters

Shuffle:
4 2 5 1 0 3
T R I G
      ^
      Pick until here

Does anyone see a better way ?



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

Date: 20 Mar 2007 04:37:09 -0700
From: "kumar" <emailatishay@gmail.com>
Subject: [cross-posting] perl-gtk installation failing on Solaris
Message-Id: <1174390629.263803.147930@e1g2000hsg.googlegroups.com>

--------cross posting from comp.lang.perl.modules because this is a
high activity group---------

Hi All,

I might be asking a very dumb quesion, but I am new to perl and perl-
modules.

I am using Solaris Nevada (Solaris 11). I am running Java Desktop
System. So I assume I have GTK installed on my system.

When I try to install perl-gtk on my system, I am getting following
error
----------
[0] root@ak47:Gtk-Perl-0.7009# perl Makefile.PL
[16:39:30]
Can't exec "imlib-config": No such file or directory at Makefile.PL
line 141.
Can't exec "gdk-pixbuf-config": No such file or directory at
Makefile.PL line 141.
Can't exec "gnome-config": No such file or directory at Makefile.PL
line 141.
Can't exec "gnome-config": No such file or directory at Makefile.PL
line 141.
Submodule gdkimlib is needed to build gnome but it appears
it's misdetected or not selected for compilation.
Available modules: gtk gtkglarea gdkimlib gdkpixbuf gtkhtml gtkxmhtml
gnome glade applets gnomeprint.

You can disable the inclusion of a module using --without-pkgname.
If a package is misdetected and you still want it to compile
use --with-pkgname-force.
To disable autodetection of modules use --without-guessing.
---------------------

What could be the problem. I have not tried to install GTK beacause it
has to be there as Java Desktop System (JDS) of solaris is based on
Gnome.

I also tried to use CPAN to install perl-gtk but could not succeed.
When I say 'test Gtk', I got the same error.

Please suggest what should I do next?

regards



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

Date: 20 Mar 2007 06:47:17 -0700
From: "Yakov" <iler.ml@gmail.com>
Subject: bigint and eval
Message-Id: <1174398437.456702.305460@e65g2000hsc.googlegroups.com>

When I add 'use bigint' to the working program, it stops working.

I tracked the problem to eval(). eval() (evaluates simple arithmetic
expression gioven as string) works without bigint, but stops working
when bigint is added:

     perl -e '$expr="1+2"; print eval($expr)' # prints 3 as expected
-- works

     perl -e 'use bigint; $expr="1+2"; print eval($expr)' #prints
nothing
-- stops working when 'use bigint' is added

How do I fix eval() in the presence of  'use bigint' ?

Thanks
Yakov



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

Date: 20 Mar 2007 14:07:21 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: bigint and eval
Message-Id: <56a84pF2887ceU1@mid.dfncis.de>

Yakov <iler.ml@gmail.com> wrote in comp.lang.perl.misc:
> When I add 'use bigint' to the working program, it stops working.
> 
> I tracked the problem to eval(). eval() (evaluates simple arithmetic
> expression gioven as string) works without bigint, but stops working
> when bigint is added:
> 
>      perl -e '$expr="1+2"; print eval($expr)' # prints 3 as expected
> -- works
> 
>      perl -e 'use bigint; $expr="1+2"; print eval($expr)' #prints
> nothing
> -- stops working when 'use bigint' is added
> 
> How do I fix eval() in the presence of  'use bigint' ?

Start with finding out what went wrong in th first place.  Print $@
after the eval.

Anno


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

Date: 20 Mar 2007 07:12:52 -0700
From: "Yakov" <iler.ml@gmail.com>
Subject: Re: bigint and eval
Message-Id: <1174399972.280207.239900@e1g2000hsg.googlegroups.com>

On Mar 20, 10:07 am, anno4...@radom.zrz.tu-berlin.de wrote:
> Yakov <iler...@gmail.com> wrote in comp.lang.perl.misc:
>
> > When I add 'use bigint' to the working program, it stops working.
>
> > I tracked the problem to eval(). eval() (evaluates simple arithmetic
> > expression gioven as string) works without bigint, but stops working
> > when bigint is added:
>
> >      perl -e '$expr="1+2"; print eval($expr)' # prints 3 as expected
> > -- works
>
> >      perl -e 'use bigint; $expr="1+2"; print eval($expr)' #prints
> > nothing
> > -- stops working when 'use bigint' is added
>
> > How do I fix eval() in the presence of  'use bigint' ?
>
> Start with finding out what went wrong in th first place.  Print $@
> after the eval.
>
> Anno

'print $@' prints
error isConstant(undef): $^H{integer} is not defined at (eval 5) line
1, at end of line
Constant(undef): $^H{integer} is not defined at (eval 5) line 1, at
end of line

Yakov



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

Date: 20 Mar 2007 14:19:42 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: bigint and eval
Message-Id: <56a8ruF2887ceU2@mid.dfncis.de>

Yakov <iler.ml@gmail.com> wrote in comp.lang.perl.misc:
> On Mar 20, 10:07 am, anno4...@radom.zrz.tu-berlin.de wrote:
> > Yakov <iler...@gmail.com> wrote in comp.lang.perl.misc:
> >
> > > When I add 'use bigint' to the working program, it stops working.
> >
> > > I tracked the problem to eval(). eval() (evaluates simple arithmetic
> > > expression gioven as string) works without bigint, but stops working
> > > when bigint is added:
> >
> > >      perl -e '$expr="1+2"; print eval($expr)' # prints 3 as expected
> > > -- works
> >
> > >      perl -e 'use bigint; $expr="1+2"; print eval($expr)' #prints
> > > nothing
> > > -- stops working when 'use bigint' is added
> >
> > > How do I fix eval() in the presence of  'use bigint' ?
> >
> > Start with finding out what went wrong in th first place.  Print $@
> > after the eval.
> >
> > Anno
> 
> 'print $@' prints
> error isConstant(undef): $^H{integer} is not defined at (eval 5) line
> 1, at end of line
> Constant(undef): $^H{integer} is not defined at (eval 5) line 1, at
> end of line

It looks like the bigint pragma only works with perl5.9.* and better.
That's arguably a bug, the module should check the version.

Anno


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

Date: Tue, 20 Mar 2007 15:04:07 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: bigint and eval
Message-Id: <HJSLh.15118$Jl.1991@newsread3.news.pas.earthlink.net>

On 03/20/2007 08:47 AM, Yakov wrote:
> When I add 'use bigint' to the working program, it stops working.
> 
> I tracked the problem to eval(). eval() (evaluates simple arithmetic
> expression gioven as string) works without bigint, but stops working
> when bigint is added:
> 
>      perl -e '$expr="1+2"; print eval($expr)' # prints 3 as expected
> -- works
> 
>      perl -e 'use bigint; $expr="1+2"; print eval($expr)' #prints
> nothing
> -- stops working when 'use bigint' is added
> 
> How do I fix eval() in the presence of  'use bigint' ?
> 
> Thanks
> Yakov
> 

For reasons that I haven't figured out yet, the "use bigint;" has to be 
within the eval():

perl -le 'print eval("use bigint; 1+2")'

Maybe Perl is using a source filter to change ordinary Perl numbers into 
something else.



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

Date: Tue, 20 Mar 2007 11:41:34 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: checking for filehandle
Message-Id: <vfevv21jo5svoa6nnfbsv35qggvd54pfej@4ax.com>

On Tue, 20 Mar 2007 08:26:19 +0100, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:

>I prefer to have it called Perl5 version 10. Perl5 will not die, Perl6
>will have her own life.

Yes of course, as far as the second statement goes, but the former
would imply a very nonstandard use anyway...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 20 Mar 2007 10:21:15 +0000
From: Geoff Cox
Subject: Re: eq and =? problem?
Message-Id: <s5dvv2ljsj2sa8jdnqitmsmrl9cvivl45e@4ax.com>

On Tue, 20 Mar 2007 10:41:29 +0100, Adrian Ulrich
<adrian_200503@blinkenlights.ch> wrote:

>
>> Any ideas please?
>
>This works just fine for me.
>
>How about providing the full script or a simple testcase?

Adrian,

Thanks for your reply . odd!

I will try again myself. As it stands I am taking info from a MySQL
data base, a collection of php files and html files so not easy to
come up with a simple test case but will give this a try.

I found a solution by changing the bp to bisplans to avoid any
confusion between bp and bplann.

How did you test out the code I posted?!

Cheers

Geoff


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

Date: Tue, 20 Mar 2007 11:50:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: eq and =? problem?
Message-Id: <vpevv29lsqplqie8b9mj2fs0i9dgd68sms@4ax.com>

[removed clp from the Newsgroups header]


On Tue, 20 Mar 2007 08:34:52 +0000, Geoff Cox wrote:

>It would seem that the following code does not distinguish between the
>"bp" and the "bplanning". I thought that using eq and not =~ would
>work.

Often when people ask this question, they forgot (or don't know) to
chomp(). Hard to say in your case.

>Any ideas please?

Prepare a minimal but *complete* (as opposed to a code *excerpt* as in
your case) example exhibiting the problem.

>    elsif ( $path eq
>"docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
>        intro($path);
>        appliedbusinessclassroomnotesedexcelunit2bp($path);

Incidentally, do you really feel comfortable with such sub names?

>    }
>
>    elsif ( $path eq
>"docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
>        intro($path);
>        appliedbusinessclassroomnotesedexcelunit2bplanning($path);
>    }

Seems like there would be some code to factor out and made more terse,
especially if you have a very long chain of such elsif's, in which
case you would probably have a better time finding a more appropriate
solution, i.e. a dispatch table.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 20 Mar 2007 11:56:53 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: eq and =? problem?
Message-Id: <d5fvv2tjfupt3684sui7v81sqe8jpv8he3@4ax.com>

[Removed clp from the Newsgroups header]


On Tue, 20 Mar 2007 10:21:15 +0000, Geoff Cox wrote:

>I will try again myself. As it stands I am taking info from a MySQL
>data base, a collection of php files and html files so not easy to
>come up with a simple test case but will give this a try.

Is the "where" you get your info from all that relevant? It would all
be in a string after all. So just input your string from STDIN
instead.

>I found a solution by changing the bp to bisplans to avoid any
>confusion between bp and bplann.

?!?

>How did you test out the code I posted?!

Presumably by putting it into a complete but minimal script that
inputs the data and defines the subs.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 20 Mar 2007 05:55:00 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: eq and =? problem?
Message-Id: <slrnevvfc4.qho.tadmc@tadmc30.august.net>


[ comp.lang.perl is no longer a newsgroup. Please do not attempt
  to post there.
]


Geoff Cox <Geoff> wrote:
> Hello,
>
> It would seem that the following code does not distinguish between the
> "bp" and the "bplanning". I thought that using eq and not =~ would
> work.
>
> Any ideas please?


One idea would be to give us a short and complete program that we
can run that illustrats the problem you are having.

Have you seen the Posting Guidelines that are posted here frequently?


>     elsif ( $path eq
> "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
>         intro($path);
>         appliedbusinessclassroomnotesedexcelunit2bp($path);
>     }
>
>     elsif ( $path eq
> "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
>         intro($path);
>         appliedbusinessclassroomnotesedexcelunit2bplanning($path);
>     }

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

my $path = 'docs/applied-business/as/classroom-notes/edexcel/unit2/bp';

if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp")
    { print "bp\n" }
else
    { print "NO bp\n" }


$path = 'docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning';

if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning")
    { print "bplanning\n" }
else
    { print "NO bplanning\n" }
-----------------------------------------------


Works fine for me...


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


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

Date: Tue, 20 Mar 2007 13:56:39 +0000
From: Geoff Cox
Subject: Re: eq and =? problem?
Message-Id: <evpvv2pklmujbrf0grjkpjdrs9crrjrfv8@4ax.com>

On Tue, 20 Mar 2007 05:55:00 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:

>
>[ comp.lang.perl is no longer a newsgroup. Please do not attempt
>  to post there.
>]
>
>
>Geoff Cox <Geoff> wrote:
>> Hello,
>>
>> It would seem that the following code does not distinguish between the
>> "bp" and the "bplanning". I thought that using eq and not =~ would
>> work.
>>
>> Any ideas please?
>
>
>One idea would be to give us a short and complete program that we
>can run that illustrats the problem you are having.
>
>Have you seen the Posting Guidelines that are posted here frequently?
>
>
>>     elsif ( $path eq
>> "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
>>         intro($path);
>>         appliedbusinessclassroomnotesedexcelunit2bp($path);
>>     }
>>
>>     elsif ( $path eq
>> "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
>>         intro($path);
>>         appliedbusinessclassroomnotesedexcelunit2bplanning($path);
>>     }
>
>-----------------------------------------------
>#!/usr/bin/perl
>use warnings;
>use strict;
>
>my $path = 'docs/applied-business/as/classroom-notes/edexcel/unit2/bp';
>
>if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp")
>    { print "bp\n" }
>else
>    { print "NO bp\n" }
>
>
>$path = 'docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning';
>
>if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning")
>    { print "bplanning\n" }
>else
>    { print "NO bplanning\n" }
>-----------------------------------------------
>
>
>Works fine for me...


Thanks Tad - a helpful comment.

Cheers

Geoff


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

Date: Tue, 20 Mar 2007 13:31:23 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: I dotn understand this error
Message-Id: <etonnb$fa3$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to

<anno4000@radom.zrz.tu-berlin.de>], who wrote in article <5679bnF27dcm0U1@mid.dfncis.de>:
> > Which line is line 43 ?
> 
> None of the code lines.  It's line 43 of eval 17.

Hmm, it looks strange.  I definitely remember doing somethign about
'00 to make the diagnostic more user-friendly.  Hmm, it looks like
this logic is triggered under debugger only.

Anyway, running it under debugger (or setting proper debug flags) will
provide (among other things) much clearer error message...

  perl -wle "eval shift" "foo->"

Hope this helps,
Ilya


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

Date: 20 Mar 2007 06:34:02 -0700
From: "=?utf-8?B?zp3Or866zr/Pgg==?=" <hackeras@gmail.com>
Subject: Re: I dotn understand this error
Message-Id: <1174397642.779378.251230@n59g2000hsh.googlegroups.com>


krakle@gmail.com wrote:
> On Mar 19, 2:10 pm, "=CE=9D=CE=AF=CE=BA=CE=BF=CF=82" <hacke...@gmail.com>=
 wrote:
> > I opened index.pl with notepad
>
> You use notepad?
>
> > An empty line? i dont understand.
>
> You are using an undefined variable. It's a warning. Example:
>
> my $fatcat =3D "Milo"; # Look defined scalar!
>
> if ($fatcar eq "Milo") { ... } # Using a defined scalar
>
>
> my $fatdog; # Look a scalar with no value (undef)
>
> if ($fatdog eq "Pepper") { ... } # Using an UNdefined scalar
>
>
> You only receive that WARNING when you are trying to use a variable
> that is undefined...


Hey, Cool example! thank you very much! :-)
>
> Do realise that a value of NOTHING is still SOMETHING that can be used
> but an undefined variable is the value of NOTHING that can't be
> used. :-P

I still try to understand this one though! :-)



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

Date: 20 Mar 2007 06:41:27 -0700
From: "=?utf-8?B?zp3Or866zr/Pgg==?=" <hackeras@gmail.com>
Subject: Re: I dotn understand this error
Message-Id: <1174398087.841082.274780@n59g2000hsh.googlegroups.com>


Michele Dondi wrote:
> On 19 Mar 2007 14:27:33 -0700, krakle@gmail.com wrote:
>
> >> I opened index.pl with notepad
> >
> >You use notepad?
>
> Well, he's free to do so. It's a (very rudimentary - yes, yes, yes!)
> text editor after all. BTW: I just heard the other day, I can't
> remember whether here or in PM, about
>
> http://notepad-plus.sourceforge.net/
>
> Maybe he could be interested in it. (Not that it has much of the
> notepad L&F as far as I can see from the screenshots...)

Actually i use Gridinsoft's Notepad Pro v3.2 which is afr more better
than notepad plus :-)

And OptiPerl as well.



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

Date: 20 Mar 2007 06:49:27 -0700
From: "=?utf-8?B?zp3Or866zr/Pgg==?=" <hackeras@gmail.com>
Subject: Re: I dotn understand this error
Message-Id: <1174398567.947170.262920@d57g2000hsg.googlegroups.com>


Joe Smith wrote:
> =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 wrote:
>
> >>>> [Mon Mar 19 11:49:06 2007] index.pl: Use of uninitialized value in
> >>>> concatenation (.) or string at (eval 17) line 43.
> >> None of the code lines.  It's line 43 of eval 17.
> >
> > This is what i dont understand... when i see line 43 i opne index.pl
> > and look at line 43 but this isnt the problem line as it seems....
>
> The problem is _NOT_ in line 43 of index.pl.
>
> Your program is calling eval() several times, possibly in the form of {s/=
//e;}.
> The argument to the eval() appears to be a string with embedded "\n" char=
acters.
> The 17th time that eval() is called, it is called with a string that
> contains at least 43 lines.  The problem is in that string.
>
> You may have to add some debugging print() statements, like:
>
>    print "About to call eval #",++$eval_count,"with argument '$string'\n";
>    eval $string;
>    print "The eval produced \$@ =3D $@\n";
>
> 	-Joe

Thanks for the answer its now clear to me that line 43 of index.pl
isnt the problem.
But, nowhere inside my index.pl iam using the function eval(), not
only i dont use it but i really dont even know what it does ...which
iam about to check now....

I can paste you the code if you want so to see that i myself never
called eval()....



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

Date: Tue, 20 Mar 2007 16:01:08 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: I dotn understand this error
Message-Id: <3ptvv2pg97b52uhggq4p51qoatvsg0j6gv@4ax.com>

On 20 Mar 2007 06:49:27 -0700, "?????" <hackeras@gmail.com> wrote:

>Thanks for the answer its now clear to me that line 43 of index.pl
>isnt the problem.
>But, nowhere inside my index.pl iam using the function eval(), not
>only i dont use it but i really dont even know what it does ...which
>iam about to check now....
>
>I can paste you the code if you want so to see that i myself never
>called eval()....

s///ee is just as eval();


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 20 Mar 2007 16:05:54 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: I dotn understand this error
Message-Id: <srtvv295dakupcol6p0jsb3u9nem720brl@4ax.com>

On 20 Mar 2007 06:34:02 -0700, "?????" <hackeras@gmail.com> wrote:

>> Do realise that a value of NOTHING is still SOMETHING that can be used
>> but an undefined variable is the value of NOTHING that can't be
>> used. :-P
>
>I still try to understand this one though! :-)

Briefly, the null string, '' or "" is a false value, but is a well
*defined* thing. In fact if you give it to the defined() function, it
will return a true value. OTOH Perl admits a special undefined value
which is often simply called 'undef' because it's the return value of
the undef() function. Do not confuse that with the 'undef' *string*
which comprises five charachters. It's the value that variables not
yet initialized have, or that have been explicitly undef()ined or
assigned an/the undef value.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 20 Mar 2007 08:00:19 -0700
From: "maxshop" <stembe@gmail.com>
Subject: Re: No -e allowed in setuid scripts?
Message-Id: <1174402819.564389.149880@d57g2000hsg.googlegroups.com>

Anyone?



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

Date: Tue, 20 Mar 2007 15:04:44 +0100
From: Lars Haugseth <njus@larshaugseth.com>
Subject: Re: passing passords to pgsql/pg_create/pg_dump programmatically
Message-Id: <87odmof1tv.fsf@unreal.larshaugseth.com>


* "filippo" <filippo2991@virgilio.it> wrote:
> 
> Hello,
>
> I have written a program perl/Tkprogram, based on postgres. For
> maintenance reasons in my program I use these commands:
>
>       `dropdb -U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
>       `createdb -U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
>       `pg_dump -U postgres -h $DATABASE_SERVER $DATABASE_NAME | psql -
> U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`;
>
> my @psqlOutput = `psql -l -U postgres -h $_`;
>
>
> my program has a graphic interface but whenever I use these command,
> postgres ask for passord in the command line. How can I give these
> commands the right passowrd programmatically or how can I   interact
> with these to give the passwords by a graphic box?

$ dropdb --help
$ createdb --help
$ pg_dump --help

As you can see, all of these command line utilities accept the -W
parameter followed by the password.

Alternatively you can configure PostgreSQL to allow connections
from certain clients without password authentication:

http://www.postgresql.org/docs/8.2/static/client-authentication.html

-- 
Lars Haugseth

"If anyone disagrees with anything I say, I am quite prepared not only to
 retract it, but also to deny under oath that I ever said it." -Tom Lehrer


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

Date: 20 Mar 2007 08:05:46 -0700
From: "erobinson32" <samdaniels@gmail.com>
Subject: perl: adding lines and replacing stings
Message-Id: <1174403146.635985.55840@l75g2000hse.googlegroups.com>


I would like to do three things in a single Perl script:
1. Add the text "FirstLine" to the very first line of a sample file.
2. Add the test "LastLine" to the very last line of a sample file.
3. Replace all of the instances of 'California' to 'Nevada' in a file.

I've just been running a few commands to accomplish this, but would
like to simplify the process:

perl -pi -e 's/California/Nevada/g' testfile
sed '1i\
FirstLine' testfile > temp_file
mv temp_file testfile
sed '$a\
LastLine' testfile > temp_file
mv temp_file testfile


Original File:
test1 - California
test2 - Oregon
test3 - Texas

Updated File:
FirstLine
test1 - Nevada
test2 - Oregon
test3 - Texas
LastLine

Is this possible?  If not, is there a more automatic way of doing
this?  updating my .bashrc?



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

Date: 20 Mar 2007 05:47:10 -0700
From: "Bob Dubery" <megapode@gmail.com>
Subject: Re: Question about scoping
Message-Id: <1174394830.685646.259190@b75g2000hsg.googlegroups.com>

On Mar 9, 4:58 pm, "Bob Dubery" <megap...@gmail.com> wrote:
> On Mar 5, 8:57 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > I'm amazed this syntax works at all. It appears to be parsed as
>
> >     eval { (newXML::DOM::Parser)->parse($headerFile) };
>
> > or
>
> >     eval {XML::DOM::Parser->new->parse($headerFile) };
>
> > which would be the recommended way to write it. The indirect object
> > notation ('new Foo' as opposed to 'Foo->new') is considered to have been
> > a bad idea: it confuses the reader, and under the wrong circumstances it
> > can confuse Perl.
>
> Well thanks for that. I will try making that change to this program.
>
<snip>
> Since I changed the statement that you're commenting on to something
> like
> my $bodyXML =3D eval {newXML::DOM::Parser- >parse($bodyFile)};
>
> and going on to perform a $bodyXML->dispose()
>
> the listener has run more reliably and memory usage is reduced. It is
> still creeping up with time, but much more slowly.
>
> So I'm going to try the alternate notation that you offer and see if
> that brings a further improvement.

And it DID improve things... but the memory consumed by the program
was still creeping up.

In the end I tried XML::Parser::Expat instead. This means some changes
to the code as XML::Parser::Expat objects cannot be reused and may
only perform ONE parse. But the leak is fixed.

Prior to this I had tried using XML::Parser instead of XML::DOM, but
the problem did not go away.

Is there a memory leak in XML::Parser?


The code for the validation routine now looks like this....


sub validateFile
{
	# get the value passed to this subroutine
	my $dataString =3D shift;

	# eliminate tabs, line feeds etc...
	$dataString =3D~ tr/\t\n\r\f//d;
	# eliminate padding between tags...
	$dataString =3D~ s/>\s*</></g;

	# create parser objects
	# these are expat parsers - cannot be reused
	my $hParser =3D XML::Parser::Expat->new(ProtocolEncoding =3D> 'UTF-8');
	my $bParser =3D XML::Parser::Expat->new(ProtocolEncoding =3D> 'UTF-8');

	# check for and remove the starting charater for the data transfer
	if ($dataString =3D~ /^/)	# character (0x02)
	{
		$dataString =3D~ s/^//;		# character (0x02)

		# check for and remove the ending charater for the data transfer
		if ($dataString =3D~ /$/)			# character (0x03)
		{
			$dataString =3D~ s/$//;				# character (0x03)

			# make sure the very first part of the file is a valid xml header
with utf-8 encoding included
			unless ($dataString =3D~ /^<\?xml version=3D\"1\.0\" encoding=3D
\"UTF-8\"\?>/)
			{
				$errMsg =3D "Invalid xml header for the routing header.";
			}
			else
			{
				# now check for the second xml header for the body file
				unless ($dataString =3D~ /<\?xml version=3D\"1\.0\" encoding=3D
\"UTF-8\"\?>/)
				{
					$errMsg =3D "Invalid xml header for the xml body file.";
				}
				else
				{
					# separate the xml header and xml body file into 2 different
variables
					$dataString =3D~ s/^(<\?xml version=3D\"1\.0\" encoding=3D\"UTF-8\"\?>.
+)(<\?xml version=3D\"1\.0\" encoding=3D\"UTF-8\"\?>.+)$/$1$2/;
					my $headerFile =3D $1;
					my $bodyFile =3D $2;

					# parse the xml headerFile to make sure that it is a well-formed
xml file
					my $headerOK =3D eval {$hParser->parse($headerFile)};

					# parser will have died and eval failed if XML is not well-formed
					unless($headerOK)
					{
						$errMsg =3D "XML header file is not well-formed and can't be
processed.";
					}
					else
					{
						# parse the xml bodyFile to make sure that it is a well-formed
xml file
						my $bodyOK =3D eval {$bParser->parse($bodyFile)};

						# parser will have died with error message in $EVAL_ERROR if XML
is not well-formed
						unless($bodyOK)
						{
							$errMsg =3D "XML body file is not well-formed and can't be
processed.";
						}
					}
				}
			}
		}
		else
		{
			$errMsg =3D "No closing flag found for the data.";
		}
	}
	else
	{
		$errMsg =3D "No opening flag found for the data.";
	}
	$hParser->release;
	$bParser->release;
}

Now there is one remaining oddity... even though I have called the
release methods on the parsers, the memory consumed by the parsers
only gets released when the subroutine is executed again and the
statements

my $hParser =3D XML::Parser::Expat->new(ProtocolEncoding =3D> 'UTF-8');
my $bParser =3D XML::Parser::Expat->new(ProtocolEncoding =3D> 'UTF-8');

are executed.

However, this means that the memory usage will not creep. It goes up
when a large incoming message is received, and may stay up for some
time, but the next incoming message will effectively release the
memory resources by instantiating new Expat parsers.



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

Date: 20 Mar 2007 07:04:30 -0700
From: "deadpickle" <deadpickle@gmail.com>
Subject: Server/Clients system
Message-Id: <1174399470.619698.159030@p15g2000hsd.googlegroups.com>

First of all I havent wrote any code for this yet, I'm still in the
brainstorming section. What I want to do is have a server that resides
on a networked computer somewhere. This server will recieve files from
2 clients. Then these 2 clients will ask the server for another file
and the server will send it. So in summary I have 2 Clients that can
send and recieve files and a Server that can recieve and send files.
Hope that makes sense. I am not sure on how to do this, or how to get
started, anyone got any ideas?



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

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 V11 Issue 241
**************************************


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