[25189] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7438 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 23 00:05:52 2004

Date: Mon, 22 Nov 2004 21:05:06 -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, 22 Nov 2004     Volume: 10 Number: 7438

Today's topics:
    Re: a length of variable question <jwillmore@fastmail.us>
    Re: a length of variable question (justme)
    Re: a length of variable question <jurgenex@hotmail.com>
        Any one merged the httpd QUERYSTRING with getopt() ? (Ian Pellew)
    Re: Any one merged the httpd QUERYSTRING with getopt()  <gnari@simnet.is>
    Re: Any one merged the httpd QUERYSTRING with getopt()  <jwillmore@fastmail.us>
        cookie failes <nospam@nospam.com>
    Re: cookie failes <matthew.garrish@sympatico.ca>
    Re: cookie failes <MrReallyVeryNice.REMOVE.NO.SPAM@Yahoo.REMOVE.NO.SPAM.com>
    Re: cookie failes <nospam@nospam.com>
    Re: cookies vs. hidden fields <postmaster@castleamber.com>
        FAQ 4.21: How do I remove consecutive pairs of characte <comdog@panix.com>
        File slurp takes a long time on some files (Tom Sliva)
    Re: File slurp takes a long time on some files <jkeen_via_google@yahoo.com>
    Re: File slurp takes a long time on some files <tadmc@augustmail.com>
    Re: Get list of files. <gnari@simnet.is>
        help! perl proxy problem? <user99@austin.rr.com>
    Re: help! perl proxy problem? <kkeller-usenet@wombat.san-francisco.ca.us>
        How can I rid a Deprecated REF problem? (Ian Pellew)
    Re: How can I rid a Deprecated REF problem? <eric-amick@comcast.net>
        How to print like debuggers `x $HASH` (Ian Pellew)
    Re: How to print like debuggers `x $HASH` <postmaster@castleamber.com>
        IO object version 1.21 does not match bootstrap paramet (Eugene Borukhovich)
        Newbie with stat(_) problem (Ian Pellew)
    Re: Newbie with stat(_) problem <jkeen_via_google@yahoo.com>
    Re: Newbie with stat(_) problem <tadmc@augustmail.com>
    Re: Perl on the Pocket PC - Easy! <ioneabu@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 22 Nov 2004 21:15:36 -0500
From: James Willmore <jwillmore@fastmail.us>
Subject: Re: a length of variable question
Message-Id: <pan.2004.11.23.02.15.33.26098@fastmail.us>

On Mon, 22 Nov 2004 10:46:11 -0600, Tad McClellan wrote:

> James Willmore <jwillmore@fastmail.us> wrote:
>> On Sun, 21 Nov 2004 21:05:20 -0600, Tony Curtis wrote:
>>>>> On 21 Nov 2004 18:59:30 -0800,
>>>>> eight02645999@yahoo.com (justme) said:

>>>> There will be spaces in front as well as behind it.  would just
>>>> casting it into an int work?

>>>     $m = '   4            ';
>>>     $n = int $m;
>>>     print "$n\n";

>>>     4

>> It would ... 

> It does!

>> if Perl were another language :-)

> Tony's code looked just like Perl to me.  :-)

Didn't know 'int' was in Perl :-)  My bad.

Thanks for the clarification (sniped for brevity).


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

Date: 22 Nov 2004 20:23:19 -0800
From: eight02645999@yahoo.com (justme)
Subject: Re: a length of variable question
Message-Id: <c0837966.0411222023.5b1be5ec@posting.google.com>

eight02645999@yahoo.com (justme) wrote in message news:<c0837966.0411211859.3a355250@posting.google.com>...
> hi
> 
> in my script i will process from a database and assign a value to a
> variable $var1
> The value assigned to $var1 is a number. eg 1, 2 or 3. But it is in
> "string" format. There will be spaces in front as well as behind it.
> 
> eg 
> 
> $var1 = xxxxxxx2xxx
> or 
> $var1 = xxx3xxxxxxxxxxx
> 
> where x = spaces.
> 
> I want to remove these spaces and just get the number. so i tried to
> use
> 
> $var1 =~ s/(.*)(\d)(.*)/\2/ ;
> 
> Then when i print the length of $var1, it says length is 2. Is there
> anything wrong with my regexp?
> thanks for help

thanks guys for your help.
my original intention was to get rid of everything before the digit
and after.
I do not know what other embedded characters would be infront of the
digit (which i can't 'see') besides the spaces and newlines, so my
intention was to get rid of everything before the digit as well as
after it. that's why i use (.*). Since its redundant as suggested in
some posts...i would refine the expression. Thanks.
Anyway, i found the problem, its a newline. But why doesn't (.*) get
rid of it?
hmm... I did not use warnings as  my perl version is very old. :-)
Thanks again for the help


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

Date: Tue, 23 Nov 2004 04:27:02 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: a length of variable question
Message-Id: <q_yod.5213$ld2.598@trnddc05>

justme wrote:
[RE question]
> Anyway, i found the problem, its a newline. But why doesn't (.*) get
> rid of it?

Which part of "perldoc perlre" don't you understand?

<quote>
    In particular the following metacharacters have their standard
    *egrep*-ish meanings:
        [...]
        .   Match any character (except newline)
</quote>

> hmm... I did not use warnings as  my perl version is very old. :-)

Maybe time to upgrade?

jue 




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

Date: 22 Nov 2004 15:56:03 -0800
From: ipellew@pipemedia.co.uk (Ian Pellew)
Subject: Any one merged the httpd QUERYSTRING with getopt() ?
Message-Id: <30875970.0411221556.243bb5c3@posting.google.com>

Hi All;

Has anyone toyed with the idea of merging the Querystring
sent from an httpd / web server with GetOptions::long.

It would be great to have this in a robust state as my efforts of
maintaing the two pieces of code never seem to stay in synch.

I use the command line while developing and testing. Even the sysadmin
guys run my pages from here only to find I have not kept the
Querystring in line with my Cmdlines.

I really don't think I am a match for the serious Perlmorph's as I
cringe at the thought of hacking GetOptions to non standard.

Regards
Ian


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

Date: Tue, 23 Nov 2004 00:07:56 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Any one merged the httpd QUERYSTRING with getopt() ?
Message-Id: <cnturv$dsl$1@news.simnet.is>

"Ian Pellew" <ipellew@pipemedia.co.uk> wrote in message
news:30875970.0411221556.243bb5c3@posting.google.com...

> Has anyone toyed with the idea of merging the Querystring
> sent from an httpd / web server with GetOptions::long.
>
> It would be great to have this in a robust state as my efforts of
> maintaing the two pieces of code never seem to stay in synch.
>
> I use the command line while developing and testing. Even the sysadmin
> guys run my pages from here only to find I have not kept the
> Querystring in line with my Cmdlines.

I can only assume you are not using CGI.pm

gnari





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

Date: Mon, 22 Nov 2004 21:29:41 -0500
From: James Willmore <jwillmore@fastmail.us>
Subject: Re: Any one merged the httpd QUERYSTRING with getopt() ?
Message-Id: <pan.2004.11.23.02.29.39.788063@fastmail.us>

On Mon, 22 Nov 2004 15:56:03 -0800, Ian Pellew wrote:

> Has anyone toyed with the idea of merging the Querystring
> sent from an httpd / web server with GetOptions::long.

use CGI qw/:standard -debug/;

If you're using the CGI module, the 'debug' pragma will allow you to enter
key/value pairs on the command line.

<snip>

HTH

Jim


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

Date: Mon, 22 Nov 2004 21:41:14 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: cookie failes
Message-Id: <1101177845.260857@nntp.acecape.com>

hey all,

i am obviously missing something cookie wise...below is a complete piece of
the code that does run without error, yet never sets the cookie....now
cookies are set on my browser, and when i go to set a cookie via javascript
in html , it works.....so obviosuly i am missing something...but for the
record one shouldn't program new stuff when one has the flu, but you know
how deadlines are...

thanks ahead all.....

#!/usr/bin/perl
use warnings;
use strict;
use CGI;
use CGI::Cookie;
use CGI::Carp qw(fatalsToBrowser);

my $q = new CGI;
my $c = new CGI::Cookie(-name    =>  'foo', -value   =>  'bar');

print $q->header(-cookie => $c);
exit 0;




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

Date: Mon, 22 Nov 2004 22:28:00 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: cookie failes
Message-Id: <27yod.21300$Le1.517189@news20.bellglobal.com>


"daniel kaplan" <nospam@nospam.com> wrote in message 
news:1101177845.260857@nntp.acecape.com...
> hey all,
>
> i am obviously missing something cookie wise...below is a complete piece 
> of
> the code that does run without error, yet never sets the cookie....now
> cookies are set on my browser, and when i go to set a cookie via 
> javascript
> in html , it works.....so obviosuly i am missing something...but for the
> record one shouldn't program new stuff when one has the flu, but you know
> how deadlines are...
>

And how have you determined that it doesn't set a cookie? You do understand 
the difference between a persistent cookie and a per-session cookie, right? 
You have *read* the documentation?

Even assuming the above, why didn't you bother to show the part where you 
retrieve the cookie? It would be helpful, since you're asking why you can't 
get the values. But then you still aren't very good at following the posting 
guidelines, are you?

Matt 




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

Date: Mon, 22 Nov 2004 19:43:17 -0800
From: MrReallyVeryNice <MrReallyVeryNice.REMOVE.NO.SPAM@Yahoo.REMOVE.NO.SPAM.com>
Subject: Re: cookie failes
Message-Id: <xeWdnXeTXZFILD_cRVn-sQ@comcast.com>

daniel kaplan wrote:
> hey all,
> 
> i am obviously missing something cookie wise...below is a complete piece of
> the code that does run without error, yet never sets the cookie....now
> cookies are set on my browser, and when i go to set a cookie via javascript
> in html , it works.....so obviosuly i am missing something...but for the
> record one shouldn't program new stuff when one has the flu, but you know
> how deadlines are...
> 
> thanks ahead all.....
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> use CGI;
> use CGI::Cookie;
> use CGI::Carp qw(fatalsToBrowser);
> 
> my $q = new CGI;
> my $c = new CGI::Cookie(-name    =>  'foo', -value   =>  'bar');
> 
> print $q->header(-cookie => $c);
> exit 0;
> 
> 

Except for a change to the path (#!/usr/bin/perl) to accommodate my test 
environment, your script works and sets foo to bar.  You might want to 
create another CGI script using the following code:

    #!/usr/bin/perl
    use strict;
    use warnings;
    use CGI qw(:standard);	
    my $c=cookie('foo');	
    print header(-type=>'text/plain'),
          "'foo' is set to $c.\n";


When I execute the script from my browser (Firefox 1.0), it displays: 
'foo' is set to bar.
You should hopefully see the same results from your browser.  :)

I hope that this is helpful.
MrRVN


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

Date: Mon, 22 Nov 2004 23:01:01 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: cookie failes
Message-Id: <1101182636.250284@nntp.acecape.com>

"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:27yod.21300$Le1.517189@news20.bellglobal.com...

> And how have you determined that it doesn't set a cookie? You do
understand
> the difference between a persistent cookie and a per-session cookie,
right?
> You have *read* the documentation?

sure , hit a man when he sick....i look for the cookie the same way i looked
for it when i set it in javascript....i never closed the browser AND went to
the cookie folder.....




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

Date: 23 Nov 2004 00:28:05 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: cookies vs. hidden fields
Message-Id: <Xns95A9BBDE21EAEcastleamber@130.133.1.4>

Tore Aursand wrote:

> On Mon, 22 Nov 2004 07:21:59 +0000, John Bokma wrote:
>>> One other thing: There's no harm in practising some "security by
>>> obscurity" in this case. :)  Use a hidden file which points to a
>>> temporary file where the _real_ values are stored, ie.:
>>> 
>>>   <input type="hidden" name="tmp" value="blahfoobar.tmp">
>>> 
>>> Never (!) use a path in that name, of course.
> 
>> And you get all problems most CGI scripts can't get right, like file
>> locking and temp file creation..
> 
> "Most CGI scripts" won't suffer from this; only one instance reads
> from, and writes to, the same temporary file at the same time.

I have seen this too often go wrong. For example a visitor hitting refresh, 
or submit a few times.

>  In
> addition, the programmer don't reinvent the wheel; he/she will use a
> CPAN module for this task.

Have you seen the CGI scripts available on the www lately? I often get a 
script someone found, and I have to make a modification or install it. I 
often end up writing a new version without the many flaws in those scripts.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Tue, 23 Nov 2004 05:03:00 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 4.21: How do I remove consecutive pairs of characters?
Message-Id: <cnuga4$e92$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

4.21: How do I remove consecutive pairs of characters?

    To turn "abbcccd" into "abccd":

        s/(.)\1/$1/g;       # add /s to include newlines

    Here's a solution that turns "abbcccd" to "abcd":

        y///cs;     # y == tr, but shorter :-)



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: 22 Nov 2004 17:43:16 -0800
From: hosehead2k1@hotmail.com (Tom Sliva)
Subject: File slurp takes a long time on some files
Message-Id: <6af01096.0411221743.191877c9@posting.google.com>

I am using ActiveState Perl 5.6.1 on Win2k with 512Meg RAM.  I have
two text files I am trying to slurp.  File A is ~2.2M and 35k lines
and File B is ~1M and 43k lines (lines are shorter).  I have two of
each file type that I read off the command line.  I am slurping them
using the following code.

open (TESTFILE, $ARGV[0]) || die("could not open test file");
@testfile = <TESTFILE>;
close (TESFILE);

repeating for $ARGV[1] through 3 using different array names and
filehandles.

Type A files open and dump in ~1 second.  Type B files take ~5 seconds
for the 1st file and ~77 seconds for the second.  Additionally if I
rearrange the commandline so that all files read in are of type A, all
4 get read in ~4 seconds.  If the commandline is changed to all type B
files, the 1st takes 5 seconds, the second ~77 seconds and the 3rd and
4th files take about 160-165 seconds each.  These times stay fairly
consistent even if I open the same type B file 4 times in a row or run
the script immediately after a reboot.

There is no extra whitespace at the end of lines or the file of type B
files.  I am out of ideas on what the cause could be.

any suggestions?
thanks,
--Tom


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

Date: Tue, 23 Nov 2004 03:22:19 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: File slurp takes a long time on some files
Message-Id: <L1yod.6176$Gw.66@trndny09>

Tom Sliva wrote:

> I am using ActiveState Perl 5.6.1 on Win2k with 512Meg RAM.  I have
> two text files I am trying to slurp.  File A is ~2.2M and 35k lines
> and File B is ~1M and 43k lines (lines are shorter).  I have two of
> each file type that I read off the command line.  I am slurping them
> using the following code.
> 
> open (TESTFILE, $ARGV[0]) || die("could not open test file");
> @testfile = <TESTFILE>;
> close (TESFILE);
> 
>

I doubt that it's possible for us to help you knowing only the byte/line 
counts of the two types of files.  We'd have to see something of the 
files themselves.  And even then, the explanation for the problem may 
have more to do with your OS than with Perl.

But here's a Perl question that probably occurred to many people reading 
your question:  Why are you trying to slurp these 4 large files into 
memory?  What problem are you trying to solve that requires that 
approach as opposed to line-by-line processing with a 'while' loop?

Jim Keenan


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

Date: Mon, 22 Nov 2004 21:49:55 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: File slurp takes a long time on some files
Message-Id: <slrncq5cr3.uip.tadmc@magna.augustmail.com>

Tom Sliva <hosehead2k1@hotmail.com> wrote:

> I am slurping them
> using the following code.
> 
> open (TESTFILE, $ARGV[0]) || die("could not open test file");
           ^
> @testfile = <TESTFILE>;
                  ^
> close (TESFILE);
           ^^
           ^^ huh?

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


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

Date: Tue, 23 Nov 2004 00:05:58 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Get list of files.
Message-Id: <cntuo9$drv$1@news.simnet.is>

"Paul Lalli" <mritty@gmail.com> wrote in message
news:trsod.3952$356.3074@trndny04...
> "gnari" <gnari@simnet.is> wrote in message
> news:cntfnl$c0g$1@news.simnet.is...
> > "Binny V A" <binnyva@hotmail.com> wrote in message
> > news:68cd8f94.0411221113.3c0b0f9d@posting.google.com...
> >
> > > $list = <*.htm>;
> > > but it gave only one html file. The same result with glob("*.htm")
> >
> > actually, <*.htm> does return a list of files, but you are assigning
> it to
> > a scalar, as if you had done : $x=('a','b','c');
>
> Well, not quite the same since the OP's code will assign $list to the
> *first* element otherwise returned by the glob, whereas this code will
> assing $x to the last element of the 'list'....

true.

$x=('a','b','c');
  is more an example of the comma operator in action than an list
assignment.

gnari






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

Date: Tue, 23 Nov 2004 01:59:23 GMT
From: me <user99@austin.rr.com>
Subject: help! perl proxy problem?
Message-Id: <%Pwod.31536$g21.4413@fe1.texas.rr.com>

i'm trying to run cgi-perl on apache (mandrake linux).  my httpd.conf
snippet says:
<IfDefine PERLPROXIED>
     RewriteEngine on
     RewriteRule ^proxy:.*  -  [F]
     RewriteRule ^(.*\/perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
     RewriteRule ^(.*\/cgi-perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
</IfDefine>
when trying to access my url via 67.9.187.201/perl/myperl.pl, i get a 
proxy error.  the error log says: (111)Connection refused: proxy connect 
to 67.9.187.201 port 8200 failed

i'm running the server behind a firewall.  my lan ip address is:
192.168.0.1

do i need to forward port 8200 on my firewall? and what ip do i need
to forward to?

please help.



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

Date: Mon, 22 Nov 2004 20:08:13 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: help! perl proxy problem?
Message-Id: <ampa72x42q.ln2@goaway.wombat.san-francisco.ca.us>

On 2004-11-23, me <user99@austin.rr.com> wrote:

> when trying to access my url via 67.9.187.201/perl/myperl.pl, i get a 
> proxy error.  the error log says: (111)Connection refused: proxy connect 
> to 67.9.187.201 port 8200 failed
>
> i'm running the server behind a firewall.  my lan ip address is:
> 192.168.0.1
>
> do i need to forward port 8200 on my firewall? and what ip do i need
> to forward to?

Yes, and your internal one.  Neither of these questions are Perl
questions, so you should consult your operating system documentation
(or a newsgroup for your OS) on how to do this.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom



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

Date: 22 Nov 2004 15:58:01 -0800
From: ipellew@pipemedia.co.uk (Ian Pellew)
Subject: How can I rid a Deprecated REF problem?
Message-Id: <30875970.0411221558.79bcb856@posting.google.com>

Hi All;

Why am I getting the perl -W complaint like:-
[Thu Nov 18 22:44:07 2004] w: Using a hash as a reference is
deprecated at w line 435.
 . . . . . 

from the likes of :-
435:    my $en = \%$t_xmlin->{$child}->{$tag_s};

The process works OK, but I doubt I am future proof.

I am after a REF to the XML::Simple structure like:-
$VAR1 = {
   'our_tags' => {
     'idx_serno' => '10001',
     'serno' => {
->      'pt_' => {
           'atts' => '1',
           'edate' => '9912312359',
        . . . . .

I go on to use $en like 
    my $l_var = eval{$$en->{$comp_to}};

Regards
Ian


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

Date: Mon, 22 Nov 2004 23:24:22 -0500
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: How can I rid a Deprecated REF problem?
Message-Id: <9le5q0t6e59vlad6dqcq999muh52jsoh86@4ax.com>

On 22 Nov 2004 15:58:01 -0800, ipellew@pipemedia.co.uk (Ian Pellew)
wrote:

>Hi All;
>
>Why am I getting the perl -W complaint like:-
>[Thu Nov 18 22:44:07 2004] w: Using a hash as a reference is
>deprecated at w line 435.
> . . . . . 
>
>from the likes of :-
>435:    my $en = \%$t_xmlin->{$child}->{$tag_s};
>
>The process works OK, but I doubt I am future proof.
>
>I am after a REF to the XML::Simple structure like:-
>$VAR1 = {
>   'our_tags' => {
>     'idx_serno' => '10001',
>     'serno' => {
>->      'pt_' => {
>           'atts' => '1',
>           'edate' => '9912312359',
>        . . . . .

I think you really want

my $en = $t_xmlin->{$child}->{$tag_s};

The value is already a reference to a hash, if I understand you
correctly. It would be useful to show the values of $child and $tag_s.

-- 
Eric Amick
Columbia, MD


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

Date: 22 Nov 2004 15:55:24 -0800
From: ipellew@pipemedia.co.uk (Ian Pellew)
Subject: How to print like debuggers `x $HASH`
Message-Id: <30875970.0411221555.76246052@posting.google.com>

Hi All;

What is the call to print a HASH like the debugs print of a hash:-

EG:-
$t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};

DB<2> x $t_xmlin
0  HASH(0x22a84a8)
   'define' => HASH(0x22a840c)
      'gen_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/Generated/'
      'src_dir' => 'c:/Program Files/Apache Group/Apache2/cgi-bin/Pages/'
Etc.

This a lot easier than the Dumper output.

Regards
Ian


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

Date: 23 Nov 2004 00:31:27 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: How to print like debuggers `x $HASH`
Message-Id: <Xns95A9BC6E8C7EAcastleamber@130.133.1.4>

Ian Pellew wrote:

> Hi All;
> 
> What is the call to print a HASH like the debugs print of a hash:-
> 
> EG:-
> $t_xmlin = eval{XMLin($xml, forcearray=>0, NormaliseSpace=>2)};
> 
> DB<2> x $t_xmlin
> 0  HASH(0x22a84a8)
>    'define' => HASH(0x22a840c)
>       'gen_dir' => 'c:/Program Files/Apache
>       Group/Apache2/cgi-bin/Pages/Generated/' 'src_dir' => 'c:/Program
>       Files/Apache Group/Apache2/cgi-bin/Pages/' 
> Etc.
> 
> This a lot easier than the Dumper output.

In what respect? Also, you can change the display behaviour of Dumper.
See $Data::Dumper::Indent, I use often a value of 1.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: 22 Nov 2004 20:16:06 -0800
From: macroscape@yahoo.com (Eugene Borukhovich)
Subject: IO object version 1.21 does not match bootstrap parameter 1.18
Message-Id: <41df378d.0411222016.2c67d0e7@posting.google.com>

Hello,

I have Fedora Core 1 (Linux host2.macroscape.com
2.4.22-1.2188.nptl_48.rhfc1.a)
With perl:


[root@host2 scripts]# perl -v

This is perl, v5.8.3 built for i386-linux-thread-multi

I have compiled form scratch some modules for ex Net::Ping and for
some reason can not use them. Any perl script I try to run gives me
the following errors:

IO object version 1.21 does not match bootstrap parameter 1.18 at
/usr/lib/perl5/5.8.3/i386-linux-thread-multi/DynaLoader.pm line 249.
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/Handle.pm
line 260.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/Handle.pm
line 260.
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/Seekable.pm
line 101.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/Seekable.pm
line 101.
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/File.pm line
117.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/IO/File.pm line
117.
Compilation failed in require at /usr/lib/perl5/5.8.3/FileHandle.pm
line 9.
Compilation failed in require at
/usr/lib/perl5/5.8.3/i386-linux-thread-multi/Net/Ping.pm line 14.
BEGIN failed--compilation aborted at
/usr/lib/perl5/5.8.3/i386-linux-thread-multi/Net/Ping.pm line 14.
Compilation failed in require at medco.pl line 2.
BEGIN failed--compilation aborted at test.pl line 2.

anybody have any thoghts? I actually thought to upgrade the
DynaLoader, but can not find the source for that on CPAN (I guess it
only comes with perl)

Thanks, EB


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

Date: 22 Nov 2004 15:57:34 -0800
From: ipellew@pipemedia.co.uk (Ian Pellew)
Subject: Newbie with stat(_) problem
Message-Id: <30875970.0411221557.7b294a9e@posting.google.com>

Hi All;

Code fragment to - if necessary, compile one file from another:-
I have titted around with Stat() as per Active Perl User Guide, 
but lack the brains to work out why I can't get it to Perl compile.

From an XMLin string I split it for the two files:-
 . . . . . . 
my @s = split /=/, $d;
for (scalar @s) {
    if (/2/)  {
        my $make = $true;
        if ( -r (my $sf = ${s[1]})) {  # do we have the src?
           if ( -w (my $tf = ${s[0]})) {  # Is the target already
made?
              $i = stat($tf);      # cannot get $i =
(stat(${s[1]}))[9] to work ????
              $i = @$i[9];         # Mtime
              $j = stat($sf);
              $j = @$j[9];
              if ( $j < $i ) { $make=$false; print qq(Target is
younger than the source, So nothing to do.\n);}
            } else {
              $make = $true;
            }
        } else {  Ummmmmmmm no src }
    }
  . . . . . . . 
  
I think my problem is not understanding what a @$xx is.
The Mtime test should have a comparison of two stats rather than
amatuer effort.

Regards
Ian


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

Date: Tue, 23 Nov 2004 01:37:40 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Newbie with stat(_) problem
Message-Id: <Evwod.5482$VG.422@trndny07>

Ian Pellew wrote:
> Hi All;
> 
[snip all]

Learn to use the Perl documentation you already have:

     perldoc -f stat


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

Date: Mon, 22 Nov 2004 22:02:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Newbie with stat(_) problem
Message-Id: <slrncq5di6.uip.tadmc@magna.augustmail.com>

Ian Pellew <ipellew@pipemedia.co.uk> wrote:

>               $i = stat($tf);

   perldoc -f stat

   ...

   In scalar context, C<stat> returns a boolean value indicating 
   success or failure...
   

>               $i = @$i[9];         # Mtime


Why is it named "i" when what it contains is the "mtime"?

There is no @i array anywhere in the code (but here).

Have you read up about arrays in perldata.pod yet?

You don't really need one, you can just use a "list slice"

   my $mtime = ( stat($tf) )[9];

But if you are determined to put the list into an array first, then:

   my @stats = stat($tf);
   my $mtime = $stats[9];


> I think my problem is not understanding what a @$xx is.


   perldoc perlreftut


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


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

Date: Mon, 22 Nov 2004 23:30:42 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: Perl on the Pocket PC - Easy!
Message-Id: <10q5btm7jkrlbcd@news.supernews.com>

> map() should almost never be used in a void context.  Use map when you
> want to obtain a list of modified values from an existing list.  If
> you're not using the modified values (or in this case, not even
> modifying them), use a foreach loop instead:
> 
> for (@b) {
>     $c += $1 if /^(\d+)\s/;
> }
> 

> Knowing how to use them is a good step in the right direction.  Knowing
> *when* to use them is a better step. :-)
> 
> Paul Lalli
> 

It just occurred to me why I used map (other than to just use it).  I was
under the impression, probably erroneously, that $_ is very safely
localized within the block evaluated by map.  If I use $_ myself, I might
forget to explicitly localize it.  I was also told a while back that
stating 'local $_' might not be totally protective of a global $_ value in
some cases.  I was wondering if the $_ in a map block is localized more
safely than a local $_ in an ordinary block.

It would seem that $_ might not be safe to use in all but the smallest,
simplest scripts.  Doesn't it bypass the checking done by using strict?

Thanks!

wana



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

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


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