[17879] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 39 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 11 14:05:43 2001

Date: Thu, 11 Jan 2001 11:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979239913-v10-i39@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 Jan 2001     Volume: 10 Number: 39

Today's topics:
        -M problem on compressed file <tarrantr@strsoh.org>
    Re: A RegEx question <bart.lateur@skynet.be>
    Re: A RegEx question <peb@bms.umist.ac.uk>
    Re: A RegEx question (Tad McClellan)
        a web based database <maccer01@my-deja.com>
    Re: a web based database <fty@mediapulse.com>
    Re: a web based database <bart.lateur@skynet.be>
    Re: a web based database (Peter L. Berghold)
    Re: Archive::Zip - any user comments? <comdog@panix.com>
        are there sites with Perl Advocacy examples? <webqueen@my-deja.com>
        array slices <peb@bms.umist.ac.uk>
    Re: array slices nobull@mail.com
    Re: Contract Opportunity, Frankfurt 1700dm per day or = (David H. Adler)
        Dir dots in readdir and Win markfolse@rocketmail.com
        File name checking function in Perl dan@no.spam
    Re: File name checking function in Perl nobull@mail.com
    Re: File::Find - how to follow links (Jerome O'Neil)
    Re: how to use HTML::Parser <comdog@panix.com>
    Re: left op of && and || only in scalar context ? nobull@mail.com
        memory problems <mumbagumba@my-deja.com>
    Re: memory problems <dan@tuatha.sidhe.org>
        MS Interdev Perl plugin??? <mark.c.hamlin@bt.com>
    Re: Net::Telnet question <jay@rgrs.com>
        Perl crashes on exit <alan@nospam.com>
    Re: Perl crashes on exit blah@blah.blah.invalid
        Perl idioms for converting string into list of characte (Weston Cann)
    Re: Problem w/ hash of references to hashes (or maybe s (Weston Cann)
    Re: Problem... Src included... (Gary E. Ansok)
    Re: Recursive Directory Size (BUCK NAKED1)
    Re: regex help, please (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Jan 2001 18:29:52 GMT
From: RST <tarrantr@strsoh.org>
Subject: -M problem on compressed file
Message-Id: <93ku2h$gtu$1@nnrp1.deja.com>

I can't get the following bit of code to work on a compressed file:

   if(-M "$dir/$file" > $age){
      .
      .


This code worked OK on NT and I can't figure out why UNIX (Solaris 2.7)
doesn't like it.  Any suggestions?



Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 16:27:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A RegEx question
Message-Id: <5cnr5t898infofo318k9dkh9ar0ha9io9g@4ax.com>

Vladimir Georgiev wrote:

>I have a string like: "ShowPic('01.jpg',281,41)" which is a part of a
>Javascript.
>I wanted to increase the two numbers by 10 and tried the following code:
>
>$a =~ s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1,$2+10,$3+10)/;
>
>but the output was:
>(...,281+10,41+10)
>and not (...,291,51) as I expected.

Don't you get two comma's, instead of one, after $1?

>It seems that the expression is always interpreted as a string.
>Any ideas how to make it add the numbers? Or other ways to do it?

Add the /e modifier to execute the substitution. You'll have to turn
this from a string into Perl code that gets executed, and of which the
result is treated as the substitution string.


s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1.($2+10).','.($3+10).')'/e;

Alternatively, incorporate the calculations in blocks that get executed,
inside the string.


s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1@{[$2+10]},@{[$3+10]})/;

-- 
	Bart.


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

Date: Thu, 11 Jan 2001 17:46:13 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: A RegEx question
Message-Id: <3A5DF165.ECF4E73A@bms.umist.ac.uk>

Vladimir Georgiev wrote:
> <snip>
> $a =~ s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1,$2+10,$3+10)/;
> 
> but the output was:
> (...,281+10,41+10)
> and not (...,291,51) as I expected.
> 
> It seems that the expression is always interpreted as a string.
> Any ideas how to make it add the numbers? Or other ways to do it?
> 

the substitution operator has a modifier that makes it evaluate the
right hand side of the substitution as an expression.  Its the 'e'
modifier.  One possible program could be:-

#!/usr/bin/perl
 
$line = "1:2:3";
$line =~ s/^(1):(2):(3)$/myprint($1,$2,$3)/e;
sub myprint{
	print $_[0] + 10, ",", $_[1] + 10, ",", $_[2] + 10, "\n";
}

Paul


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

Date: Thu, 11 Jan 2001 10:56:58 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: A RegEx question
Message-Id: <slrn95rlua.bsl.tadmc@tadmc26.august.net>

Vladimir Georgiev <merl@softhome.net> wrote:
>I have a string like: "ShowPic('01.jpg',281,41)" which is a part of a
>Javascript.
>I wanted to increase the two numbers by 10 and tried the following code:
>
>$a =~ s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1,$2+10,$3+10)/;
>
>but the output was:
>(...,281+10,41+10)
>and not (...,291,51) as I expected.
                      ^^^^^^^^^^^^^

You should read the documentation for the software that you use,
then you will *know* what to expect rather than merely guessing.


>It seems that the expression is always interpreted as a string.
    ^^^^^

That is what the documentation (perlop.pod) for the s/// operator
says, so there is no "seems" to it.

   "replaces that pattern with the replacement text"

The REPLACEMENT part is text. No mention of "code".


>Any ideas how to make it add the numbers? Or other ways to do it?


Read the aforementioned documentation for the software that you
are using. Pay particular attention to the "Options" that you
can tack onto the end.


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


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

Date: Thu, 11 Jan 2001 15:57:08 GMT
From: Maccer01 <maccer01@my-deja.com>
Subject: a web based database
Message-Id: <93kl4e$7t1$1@nnrp1.deja.com>

I wish to set up a database on my web server, and then query it from a
web browser. What is the best method to do this?
I have been told PHP and SQl is commonly used, also, is ASP worth
considering?
Finally, can a databse be queried using any other methods such as
cgi/perl, or DHTML?

Thanks in anticipation


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 16:16:42 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: a web based database
Message-Id: <J%k76.215541$DG3.5378619@news2.giganews.com>

"Maccer01" <maccer01@my-deja.com> wrote in message
news:93kl4e$7t1$1@nnrp1.deja.com...
> I wish to set up a database on my web server, and then query it from a
> web browser. What is the best method to do this?
> I have been told PHP and SQl is commonly used, also, is ASP worth
> considering?
> Finally, can a databse be queried using any other methods such as
> cgi/perl, or DHTML?

Since this is a Perl news group I will give you a perl answer. You can use
DBI and DBD::* modules to access any database that has a DBD driver written
for it or that has an ODBC driver via DBD::ODBC.
Go to www.cpan.org to find the modules and then read thier documentation.

Jay



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

Date: Thu, 11 Jan 2001 16:30:34 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: a web based database
Message-Id: <uqnr5t0oq9f7evv95goa0l0ertri7bn724@4ax.com>

Maccer01 wrote:

>I wish to set up a database on my web server, and then query it from a
>web browser. What is the best method to do this?
>I have been told PHP and SQl is commonly used, also, is ASP worth
>considering?

OT for this newsgroup.

>Finally, can a databse be queried using any other methods such as
>cgi/perl

See WebMonkey.

<http://hotwired.lycos.com/webmonkey/backend/databases/tutorials/tutorial1.html>

-- 
	Bart.


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

Date: Thu, 11 Jan 2001 18:43:57 GMT
From: peter@uboat.berghold.net (Peter L. Berghold)
Subject: Re: a web based database
Message-Id: <slrn95rvnd.ef1.peter@uboat.berghold.net>

On Thu, 11 Jan 2001 15:57:08 GMT, Maccer01 <maccer01@my-deja.com> wrote:
>Finally, can a databse be queried using any other methods such as
>cgi/perl, or DHTML?
>

Check out the DBI interface for Perl.  I make my living off of using 
DBI against a variety of databases such as Oracle, Sybase, Ingres, 
MySql, and Postgres just to name a few. My current assignment has me 
developing code to do billing extraction, presentation, and payment 
against Oracle billing databases. 
 

-- 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
"Linux renders ships                     http://www.berghold.net
 NT renders ships useless...."           


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

Date: Thu, 11 Jan 2001 13:01:11 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Archive::Zip - any user comments?
Message-Id: <comdog-F506A4.13011111012001@news.panix.com>

In article <93kj9s$sdv$1@soap.pipex.net>, "Geoff Winkless" 
<geoff-at-farmline-dot-com@127.0.0.1> wrote:

> Has anyone any idea how good Archive::Zip is - it's only at 0.09 which
> doesn't instil huge amounts of confidence, but then it hasn't changed since
> May - which probably either means it's working ok or the author has given up
> on it (!!)

i always had problems with it creating "inconsistent headers" or
some such.  i ended up using an external zip program to do that
work.  otherwise, i liked the module.

-- 
brian d foy - mod_perl hacker for hire <comdog@panix.com>


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

Date: Thu, 11 Jan 2001 18:32:54 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: are there sites with Perl Advocacy examples?
Message-Id: <93ku8m$h25$1@nnrp1.deja.com>

Our IS dept glommed onto the premise that Perl is a "scripting
langauage" useful only for quick and dirty scripts. I'm trying to be the
advocate to give it much broader scope in our project suite. Can anyone
provide sitges with examples of Perl application in the context of very
large or at least large projects (with an appropriate amount of
largeness)?

They are pushing for JSP and I'm not overly intrigued from what I've
read about JSP. Many (like this guy:
http://www.webmacro.org/OtherTech.html ) dont seem to like it much.

Hug,
WQ

--
WHEN THE CATS ARE HUNGRY...
RUN FOR YOUR LIVES!
Alone, only a harmless pet...
	One Thousand Strong, They Become a Man-Eating Machine!
		-- The Night of a Thousand Cats (1972)


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 16:14:46 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: array slices
Message-Id: <3A5DDBF6.E38F6483@bms.umist.ac.uk>

I wrote the program below (Prog 1) to create a file with certain columns
removed.  This program takes ages (unsuprisingly) and so I tried
replacing it with a smaller version using array slices (Prog 2).

My dataset is very large and contains many tabs with no data inbetween. 
I was wondering if this could be the source of the problem.

####Prog 1####
#!/usr/bin/perl
while(<>){
	my @line = split(/\t/);
	my $i = 0;
	my @newLine;
		for(@line){
			$print = 1;
			foreach(qw{177 178 245 246 935..968}){
				if($i == $_){$print = 0; last;};
			} 
			push(@newLine, $_) if $print;
			$i++;
		}
 	print join "\t", @newLine;
}

####end Prog 1####

####Prog 2#####
while(<>){
	my @line = split(/\t/);
	print join "\t", @line[0..177,179..244,247..934,969..$#line];
}
####end Prog 2####

Cheers

Paul


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

Date: 11 Jan 2001 18:03:13 +0000
From: nobull@mail.com
Subject: Re: array slices
Message-Id: <u9d7duj7a6.fsf@wcl-l.bham.ac.uk>

Paul Boardman <peb@bms.umist.ac.uk> writes:

[ description of objective and proposed solution ]

> I was wondering if this could be the source of the problem.

No problem is described.  Are we to take it your code didn't work as
you'd hoped?  If so how?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 11 Jan 2001 18:07:33 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Contract Opportunity, Frankfurt 1700dm per day or =?iso-8859-1?Q?=A3500?= per day.
Message-Id: <slrn95rtj5.450.dha@panix2.panix.com>

On Thu, 11 Jan 2001 11:21:28 -0000, Rob Parkes wrote:

>I'm in need of a Perl, Shell scripting and Unix programmer/developer

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Shut up, listen, and dance. - Madness


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

Date: Thu, 11 Jan 2001 17:19:30 GMT
From: markfolse@rocketmail.com
Subject: Dir dots in readdir and Win
Message-Id: <93kpum$coo$1@nnrp1.deja.com>

 How does one handle the directory dots in readdir in a Win system (ie,
without resort to a pipe and grep,which these systems don't have). All
the example I've found say @allfiles = grep !/^\.\.?$/, readdir, THISDIR
or some similar grep pattern.

Everything I try in Perl ( "m/^[\.]+/ && next" or "if ($_ eq "..")
{next}" as the first line of the while (@allfiles) loop; or @allfiles=
m!^([A-Z,a-z,1-9]+)! , readdir(DIRLIST), seems goes into an
uninitialized value loop).


"Is there any intelligent life here,
or are you all starship commanders?"
 -- Codex Ipse


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 16:19:26 GMT
From: dan@no.spam
Subject: File name checking function in Perl
Message-Id: <3a5ddcff.13440711@news.rcn.com>

Can anyone tell me where I can find a general file name checking function in CGI
Perl for Unix systems?

The function should check file names coming in PATH_INFO, so they:

- don't contain pipes or other special Unix characters
- don't go out of the document root, but can go from one directory to another
within the doc root with ..
- don't refer to forbidden files like .htaccess or .htpasswd

Thanks,
Dan



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

Date: 11 Jan 2001 18:16:28 +0000
From: nobull@mail.com
Subject: Re: File name checking function in Perl
Message-Id: <u9ae8yj6o3.fsf@wcl-l.bham.ac.uk>

dan@no.spam writes:

> Can anyone tell me where I can find a general file name checking function in CGI
> Perl for Unix systems?
> 
> The function should check file names coming in PATH_INFO, so they:
> 
> - don't contain pipes or other special Unix characters

Simply check that it does not contain those characters.  Or if you are
feeing more conservative insist that it consist of word characters
plus a few others.  Better still don't interpolate filenames passed in
by users into stuff that's going to be executed by the Unix shell. 

> - don't go out of the document root, but can go from one directory to another
> within the doc root with ..

PATH_INFO should never contain a .. directory component since .. is
handled by the HTTP client.  This has nothing to do with Perl.

> - don't refer to forbidden files like .htaccess or .htpasswd

Simply check that it does not contain the sequence '/.'

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 11 Jan 2001 18:51:10 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: File::Find - how to follow links
Message-Id: <ygn76.1171$dy.259257@news.uswest.net>

hedley_s@my-deja.com elucidates:

>> find({wanted => \&process, follow => 1}, '/mydir');
>>
>> > on the man page but couldn't get it to work.
>>
>> Why didn't you show us the code that contained 'the notation' from the
>> man page? The above is what the man page says, and it works perfectly
>> fine for me.
>>
>> What is your code? What is the directory layout, and what exactly
>> happens?
> 
> Using the code that worked for you I get the message:
> 
> Not a CODE reference at /opt/perl-5.004/lib/File/Find.pm line 87

Are you using an older version of perl?  What does perl -v tell you?

-- 
If men could learn from history, what lessons it might teach us!  But
passion and party blind our eyes, and the light which experience gives
is a lantern on the stern, which shines only on the waves behind us.
				--Samuel Taylor Coleridge, "Recollections"


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

Date: Thu, 11 Jan 2001 13:05:35 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: how to use HTML::Parser
Message-Id: <comdog-B99974.13053511012001@news.panix.com>

In article <93jt12$1gqv$1@news.cz.js.cn>, "james roads" 
<zhenghua_li@nj.trendmicro.com> wrote:

> can you tell me about how to use the modules HTML::Parser?

> "In order to make the parser do anything interesting, you must make a
> subclass where you override one or more of the following methods as
> appropriate:

> and now I don't know how to define the "subclass" to get the result of file
> parsing.

you can look for posts by Gisle in this group on that subject, or 
you can look at some of the modules, like HTML::LinkExtor, which
are subclasses.

-- 
brian d foy - mod_perl hacker for hire <comdog@panix.com>


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

Date: 11 Jan 2001 17:53:20 +0000
From: nobull@mail.com
Subject: Re: left op of && and || only in scalar context ?
Message-Id: <u9g0iqj7qn.fsf@wcl-l.bham.ac.uk>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>   tell_context() || tell_context();
> 
> This prints "scalar" twice, so both operands are in scalar context.
> More precisely, the expressions are called in boolean context, which
> is a special case of scalar context.

An excellent illustration of the distinction between accuracy and
precision!

"I am between 5 and 6 feet tall".  This statement is accurate but not
precise.

"I am exactly 7 feet tall".  This statement is not accurate but is
precise.

EXPR1 || EXPR2  is semantically like:

do {
  my $expr1 = EXPR1; # Scalar context
  if ( $expr1 ) { # Boolean context
    $expr1;
  } else {
    EXPR2; # Inherits context
  }
}

The description of || in the manual says:

       Binary "||" performs a short-circuit logical OR operation.
       That is, if the left operand is true, the right operand is
       not even evaluated.  Scalar or list context propagates
       down to the right operand if it is evaluated.

       The || and && operators differ from C's in that, rather
       than returning 0 or 1, they return the last value
       evaluated.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 11 Jan 2001 17:59:24 GMT
From: Nils <mumbagumba@my-deja.com>
To: nils.luetke-steinhorst@infineon.com
Subject: memory problems
Message-Id: <93ks9l$f4f$1@nnrp1.deja.com>

Hi all!

I'm running into memory probs when creating VERY large arrays.
I'm getting SIGBUS or SEGFAULT signals when my process crashes.
I think it comes from to little "stacksize" (whatever that may be).
I'm currently using Solaris 2.5.1 (32bit), when using Solaris 7 (64bit)
the problems don't occur.
So I'm wondering where Perl gets the memory for its variables.
Does it take the memory from the stack?
--
Thanx for the help.
CU
NILS


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 11 Jan 2001 18:37:46 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: memory problems
Message-Id: <_3n76.132608$P82.15780270@news1.rdc1.ct.home.com>

Nils <mumbagumba@my-deja.com> wrote:
> Hi all!

> I'm running into memory probs when creating VERY large arrays.
> I'm getting SIGBUS or SEGFAULT signals when my process crashes.
> I think it comes from to little "stacksize" (whatever that may be).
> I'm currently using Solaris 2.5.1 (32bit), when using Solaris 7 (64bit)
> the problems don't occur.
> So I'm wondering where Perl gets the memory for its variables.
> Does it take the memory from the stack?

Nope, the memory's allocated from the heap. You're likely blowing out
memory and perl's not catching the failed allocation, and then tries to
use the memory it didn't get.

There was at least one case where perl's internal checking failed, and
I know that's been fixed. I know it's made it into 5.6.1 (which is in
beta) but I'm not sure if it is in 5.6.0. Might want to try if you
haven't and see if things work better. Compiling perl to use its own
malloc can help catch these too, if you've not already done that.

					Dan


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

Date: Thu, 11 Jan 2001 17:23:54 -0000
From: "Mark Hamlin" <mark.c.hamlin@bt.com>
Subject: MS Interdev Perl plugin???
Message-Id: <93kqg6$m4n$1@pheidippides.axion.bt.co.uk>

Does MS Interdev have a plugin to enable syntax hightlighting and the like
for Perl?

Thankyou,
Mark




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

Date: 11 Jan 2001 14:04:25 -0500
From: Jay Rogers <jay@rgrs.com>
Subject: Re: Net::Telnet question
Message-Id: <82lmshhpvq.fsf@shell2.shore.net>

"Neil" <neil@alaweb.com> writes:
> I assumed, after reading the Net::Telnet docs, that $core_log_fh would
> return the filehandle and be non-zero, and therefore no error - and no error
> log entry.

Yes, that's a bug in the input_log() and output_log() routines.

It'll be fixed in version 3.03.  In the meantime, here's a patch
for version 3.02.  Cut and paste it to a "patchfile", cd to the
directory containing the Telnet.pm that needs to be patched, and
execute:

    patch -p0 < "patchfile"

Alternatively, you can just make the edits manually.


*** Telnet.pm.v3.02	Sat May 27 13:00:52 2000
--- Telnet.pm	Thu Jan 11 13:40:33 2001
***************
*** 832,850 ****
      my ($self, $name) = @_;
      my (
  	$fh,
- 	$prev,
  	$stream,
  	);
  
      $stream = *$self->{net_telnet};
!     $prev = $stream->{inputlog};
  
      if (@_ >= 2) {
  	$fh = &_fname_to_handle($self, $name);
  	$stream->{inputlog} = $fh;
      }
  
!     $prev;
  } # end sub input_log
  
  
--- 832,849 ----
      my ($self, $name) = @_;
      my (
  	$fh,
  	$stream,
  	);
  
      $stream = *$self->{net_telnet};
!     $fh = $stream->{inputlog};
  
      if (@_ >= 2) {
  	$fh = &_fname_to_handle($self, $name);
  	$stream->{inputlog} = $fh;
      }
  
!     $fh;
  } # end sub input_log
  
  
***************
*** 1369,1387 ****
      my ($self, $name) = @_;
      my (
  	$fh,
- 	$prev,
  	$stream,
  	);
  
      $stream = *$self->{net_telnet};
!     $prev = $stream->{outputlog};
  
      if (@_ >= 2) {
  	$fh = &_fname_to_handle($self, $name);
  	$stream->{outputlog} = $fh;
      }
  
!     $prev;
  } # end sub output_log
  
  
--- 1368,1385 ----
      my ($self, $name) = @_;
      my (
  	$fh,
  	$stream,
  	);
  
      $stream = *$self->{net_telnet};
!     $fh = $stream->{outputlog};
  
      if (@_ >= 2) {
  	$fh = &_fname_to_handle($self, $name);
  	$stream->{outputlog} = $fh;
      }
  
!     $fh;
  } # end sub output_log
  
  


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

Date: Thu, 11 Jan 2001 16:43:45 GMT
From: Alan Pettigrew <alan@nospam.com>
Subject: Perl crashes on exit
Message-Id: <VA.00000005.01cf8617@fox-europe.com>

I have a perl script which has taken to crashing at the end within
   exit 0;
I am using ActivePerl v5.6.0 (build 613, March 2000) on NT 4.

As far as I can tell the most recent changes I did are valid, they just moved 
where things sit in memory because lines are in a different order, and aren't 
related to the point of failure.  All the output from the program looks OK.

The program uses ODBC, and does (much abbreviated):
   use DBI;
   $dbh = DBI->connect(...);
   $sth = $dbh->prepare(qq{SELECT ...});
   $sth->execute;
   
If I put "exit 0;" before the prepare, all is well.
If I put it after, the program crashes.
If I make the SELECT statement invalid, the program reports an error and exits 
OK.

The crash is:
   The instruction at '0x41249623' referenced memory at '0x41249623'.      The 
memory could not be "read".

If I run under the debugger (-d option) the program finishes OK.  I have used 
-w and get no warnings.  I also "use strict 'subs'".

Is there any way to get more information?

Hoping for inspiration.

Alan
alan dot pettigrew at fox-europe dot com for spam avoidance.



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

Date: Thu, 11 Jan 2001 18:15:23 GMT
From: blah@blah.blah.invalid
Subject: Re: Perl crashes on exit
Message-Id: <%Km76.2338$J%.246944@news.flash.net>

Alan Pettigrew <alan@nospam.com> wrote:
> I have a perl script which has taken to crashing at the end within
>    exit 0;
> I am using ActivePerl v5.6.0 (build 613, March 2000) on NT 4.

> As far as I can tell the most recent changes I did are valid, they just moved 
> where things sit in memory because lines are in a different order, and aren't 
> related to the point of failure.  All the output from the program looks OK.

> The program uses ODBC, and does (much abbreviated):
>    use DBI;
>    $dbh = DBI->connect(...);
>    $sth = $dbh->prepare(qq{SELECT ...});
>    $sth->execute;

Are you checking for errors?
	$dbh = DBI->connect(...)             or die $DBI::errstr;
	$sth = $dbh->prepare(qq{SELECT ...}) or die $DBI::errstr;
	$sth->execute                        or die $DBI::errstr;


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

Date: Thu, 11 Jan 2001 18:41:44 GMT
From: iowa88_song88.remove_eights@hotmail.com (Weston Cann)
Subject: Perl idioms for converting string into list of characters...
Message-Id: <iowa88_song88.remove_eights-1101011149120001@58.salt-lake-city-03-04rs.ut.dial-access.att.net>

I can figure out a way convert a string into a list of characters via
repeated use of the substr function. 

It also looks as if you can do it using split(//,$str). 

Are there other perl idioms for doing this?

=================================================================
"The best laid plans of mice and men are about equal."
iowa_so8ng@hot8mail.com 
Address is spam repelant. Remove eights to reach me.


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

Date: Thu, 11 Jan 2001 18:38:29 GMT
From: iowa88_song88.remove_eights@hotmail.com (Weston Cann)
Subject: Re: Problem w/ hash of references to hashes (or maybe scoping?)
Message-Id: <iowa88_song88.remove_eights-1101011145570001@58.salt-lake-city-03-04rs.ut.dial-access.att.net>

In article <x74rz75n58.fsf@home.sysarch.com>, Uri Guttman
<uri@sysarch.com> wrote:

> >>>>> "WC" == Weston Cann <iowa88_song88.remove_eights@hotmail.com> writes:
> 
>   >> Unnecessary use of & to call a function is stylistically frowned upon.
> 
>   WC> Hmmmm. This was the syntax I recall from the pink (Perl 4, I
>   WC> think) camel book. Is it deprecated? Or are there times to use it
>   WC> and times not to use it?
> 
> you are using the pink camel? burn it or put it in a museum. always use
> the online docs for a reference anyway. read perlsub and learn about &,
> why it is not needed in basic sub calling and why is still is around
> (for a few special cases).

Well, _using_ isn't quite accurate. I actually don't crack it open much, and
usually do use the online docs for things I don't already think I understand.
But I did use it as my intro to Perl back in 1996. It was probably old
even then, but I was poor, and that's the book that my co-worker had. He
then left the country for two years as an LDS missionary, and left the
book. I really 
should give it back. I have some irrational fondness for it, though.

=================================================================
"The best laid plans of mice and men are about equal."
iowa_so8ng@hot8mail.com 
Address is spam repelant. Remove eights to reach me.


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

Date: 11 Jan 2001 17:27:40 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Problem... Src included...
Message-Id: <93kqec$f2a@gap.cco.caltech.edu>

In article <u94rz6l96m.fsf@wcl-l.bham.ac.uk>,  <nobull@mail.com> wrote:
>cputek1@my-deja.com writes:
>
>> I keep getting the error Can't stat Foo/Bar: No such file or directory.
>> 
>> I don't see what is wrong with it.  the line that I think is the
>> problem is line # 11 (find (\&Extention_Check,"Foo/Bar");)
>
>Your &Extention_Check contains a chdir().  File::Find::find assumes that
>the callback function will not a change the CWD.

Also remember that File::Find::find() has already done a chdir() into
the directory containing the file in question (unless you ask it not to),
and that $File::Find::name contains the path from the original directory.

You use $File::Find::name as the source path of your rename() call.
For the file 'Foo/Bar/Grill/fred.htm', you will be already chdir'd to
'Foo/Bar/Grill', so your rename call will look for 'Foo/Bar/Grill/fred.htm'
underneath that directory -- i.e., 'Foo/Bar/Grill/Foo/Bar/Grill/fred.htm'
(relative to the original directory).

This tends to be less of a problem if you pass absolute paths into
find(), rather than "Foo/Bar" or ".", but it is wise to remember what
$File::Find::name and $_ contain, and the difference between them.

Usually in a find callback, I use $_ to open/stat/etc the file within 
the callback, and $File::Find::name when saving the filename for later 
use, or to construct the corresponding path in a different tree.

-- Gary Ansok


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

Date: Thu, 11 Jan 2001 11:57:23 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Recursive Directory Size
Message-Id: <29180-3A5DF403-49@storefull-244.iap.bryant.webtv.net>

Thanks for your response, Tad. I'm using this on a webhost that has
BSDi. I couldn't figure out how to get File:Find to work after reviewing
the docs; and I couldn't get a (readdir $dir*) or (opendir $dir*) to
work either(compilation errors). 

I did get "du" to work though. Don't know why I have to divide it by 2
to get the total size, though. Anyway, I got the directory size
recursively by using "du"; and I got the filesize a different way. I
guess <$file*> is still globbing; but I don't know how else to do it.
Here are my codes for that part of my script. I have a feeling, it's
either wrong or could be done better. :-(

## If Directory is over 2Megs, disallow and abort 
$dirsize = `du -s $dir`/2;
if ($dirsize > 2*1024) {
print "Directory is Full\n"; exit() 
} ; 

$file = "temp_file";
getstore($URL, $file);

## If File is over 500KB, disallow and abort 
while (<$file*>) { 
$filesize += -s $_ 
}; 
if ($filesize > 500*1024) {
print "File is Larger than 500KB\n"; exit() 
} ;

Is there a way I can store a file in memory rather than having to store
it in a file? As you can see, right now, I'm using LWP/Simple's getstore
to grab the URL contents and store it in a file, before I process it.

Regards,
-Dennis
--JAPB



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

Date: Thu, 11 Jan 2001 11:03:13 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regex help, please
Message-Id: <slrn95rma1.bsl.tadmc@tadmc26.august.net>

Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
>On Thu, 11 Jan 2001 14:49:14 +0000 (UTC), Bernard El-Hagin
><bernard.el-hagin@lido-tech.net> wrote:

>>print "Yipee" if /[a-z\-A-Z_0-9 .#\/%\(\)]{1,32}/;

>Forgot to mention that within the character class the "(" and ")" aren't
>special so you don't have to escape them.


Let's just make it as pretty as we can then:

   m([-\w .#/%()]{1,32})   # look Ma, no backslashes!

Ahhh, much better :-)


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


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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