[9691] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3285 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 29 12:07:31 1998

Date: Wed, 29 Jul 98 09:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 29 Jul 1998     Volume: 8 Number: 3285

Today's topics:
        ANNOUNCE: Proc::ProcessTable <durist@world.std.com>
        ANNOUNCE: Tk-Clock 0.02 <PROCURA_BV@CompuServe.com>
        anyone know of a syslogd replacement? <sfarrell@farrell.org>
    Re: bug in lexical array reference? <jpowers@cs.oberlin.edu>
    Re: bug in lexical array reference? <jpowers@cs.oberlin.edu>
    Re: CHOMP not working on some servers <camerond@mail.uca.edu>
        Cookie File <trpatel@umd.umich.edu>
    Re: Cookie File (Daniel)
        Copacetic Now! (was Re: glob wrecks foreach loop!) <John.Adams@BentonvilleAR.ncr.com>
    Re: file system operations on open files <marcelo.meira@waii.ERASETHIS.com>
    Re: file system operations on open files (Ilya Zakharevich)
    Re: file system operations on open files (Larry Rosler)
    Re: FTP without Net::FTP module (I R A Aggie)
    Re: Getopt::Std leaves $opt_XXX4s UNDEFINED <barnett@houston.Geco-Prakla.slb.com>
    Re: Help on my very short script using hash (Aaron B. Dossett)
        HOW DO I GET PERL <dkatz23@ix.netcom.com>
    Re: HOW DO I GET PERL <domainsource@usa.net>
    Re: Im Willing to pay or give a free DOMAIN for a custo (Snowhare)
    Re: Inheritance broken ... SOLVED Karmadon@my-dejanews.com
        Is it possible <mcgillanp@mndulu.ang.af.mil>
    Re: Is it possible <nguyend7@egr.msu.edu>
    Re: Loop Problem (Larry Rosler)
    Re: Misleading documentation (M.J.T. Guy)
    Re: Newbie: extracting fields <a.g.macinnes@nospam.rl.ac.uk>
    Re: perl complier for ms dos <quednauf@nortel.co.uk>
    Re: Perl Embed Win32 C++ (Brian Jepson)
        Perl-CGI: Need help setting filename in browser when do <billw@mentis.com>
    Re: Perl-CGI: Need help setting filename in browser whe (brian d foy)
    Re: Programmer's Editor <barnett@houston.Geco-Prakla.slb.com>
        ps -ef in perl <shankeyp@charlestoncounty.org>
    Re: ps -ef in perl <nguyend7@egr.msu.edu>
    Re: Same code, diff machines, diff results <jdporter@min.net>
        Skipping dates <dmarti81@ford.com>
        Who to have a dbase with mutiple tables in perl <sboss@technologist.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 29 Jul 1998 14:45:18 GMT
From: Daniel Urist <durist@world.std.com>
Subject: ANNOUNCE: Proc::ProcessTable
Message-Id: <6pnchu$o8q$1@news.neta.com>

An alpha version of Proc::ProcessTable should shortly be available on
CPAN. Here's the README:  

Proc::ProcessTable, version .01

STATUS
======
This is ALPHA software; use at your own risk. Currently only works on
Linux. Feedback greatly appreciated.  

DESCRIPTION
===========
This module is a first crack at providing a consistent interface to
Unix (and maybe other multitasking OS's) process table information.
The impetus for this came about with my frustration at having to parse
the output of various systems' ps commands to check whether specific
processes were running on different boxes at a larged mixed Unix site.
The output format of ps was different on each OS, and sometimes
changed with each new release of an OS. Also, running a ps subprocess
from within a perl or shell script and parsing the output was not a
very efficient or aesthetic way to do things.

With this module, you can do things like this:

	# kill memory pigs 
	use Proc::ProcessTable;

	$t = new Proc::ProcessTable;
        foreach $p ( @{$t->table} ){	
	  if( $p->pctmem > 95 ){
	    $p->kill(9);
          }		
        }

INSTALLATION
============
This module needs the File::Find and Storable modules in order to
work. File::Find is generally included with perl distributions;
Storable is available from CPAN. 

After unpacking the tar file, do:

        perl Makefile.PL 
        make
	make test
        make install

There is embedded POD documentation in ProcessTable.pm and
Process/Process.pm.

SUPPORTED OPERATING SYSTEMS
===========================
At the moment, this module only works on Linux (specifically, Redhat
5.0 for Intel, which is all I have access to right now, but hopefully
it will work on other Linuxes). Please see the file PORTING if you are
interested in making it work on something else.

COPYRIGHT
=========
Copyright (c) 1998, Daniel J. Urist. All rights reserved.  This
package is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.


--
Daniel J. Urist
durist@world.std.com




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

Date: 29 Jul 1998 14:45:03 GMT
From: "H.Merijn Brand" <PROCURA_BV@CompuServe.com>
Subject: ANNOUNCE: Tk-Clock 0.02
Message-Id: <6pnchf$o78$1@news.neta.com>

A Canvas mega-widget displaying both an analog - and
a digital clock, for which colors, date- and time-
format are configurable.

GBARR put it on CPAN (thnx)




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

Date: Wed, 29 Jul 1998 14:06:49 GMT
From: stephen farrell <sfarrell@farrell.org>
Subject: anyone know of a syslogd replacement?
Message-Id: <87sojkrbt2.fsf@couatl.uchicago.edu>


this is just an idea i had and wonder if anyone knows of its existence
or has thought of it previously: a perl syslogd replacement that dumps
messages into an sql database.  thoughts??

--sf


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

Date: Wed, 29 Jul 1998 10:34:15 -0400
From: Joshua Powers <jpowers@cs.oberlin.edu>
To: ts <decoux@moulon.inra.fr>
Subject: Re: bug in lexical array reference?
Message-Id: <Pine.ULT.3.96.980729102103.2623V-100000@occs.cs.oberlin.edu>

I still disagree.  I believe what man perlsub is saying is that the my
variable is recognized as such during compile time, but it simply isn't
initialized until run-time.  It doesn't say that the my variable will
mysteriously become a package variable during run-time if certain criteria
aren't met.  Besides, if this were the case, I would think this would be a
most undesirable "feature".  The code in question:

    {
	my @old_vals = @{$caller->{"old\037values"}} if defined
($caller->{"old\037values"});
	if ($instance_dependent) {
	    push (@old_vals, ($field, $caller->{$field}->[$instance]));
	    $caller->{$field}->[$instance] = $newvalue;
	}
	else {
	    $newvalue = $instance;
	    push (@old_vals, ($field, $caller->{$field}));
	    $caller->{$field} = $newvalue;
	}
	$caller->{"old\037values"} = \@old_vals;
    }
 ...

is actually creating a my variable @old_vals on its first iteration.  But
this variable name should be destroyed after it exits the enclosing block
(and the method in which it is written).  On the next iteration, the first
statement doesn't seem to be creating a my variable, as you have said.
However, why, then does the last statment assign to
$caller->{"old\037values"} a reference to a previously created my
variable?  It doesn't make any sense.  If the variable isn't created at
the beginning of the loop (which may be a syntactical error on my part,
but I'm still not even convinced of that), perl should not be pulling this
name out of an old namespace which supposedly no longer exists.

On Wed, 29 Jul 1998, ts wrote:

> >>>>> "J" == Joshua Powers <jpowers@cs.oberlin.edu> writes:
> 
> J> Are you sure about that?  I am using "strict 'vars'", and it does not give
> J> a compilation error.  If @old_vals is indeed a package variable, it should
> J> force me to qualify it.  Besides, I don't see why one way of writing it
> J> should produce different behavior from another way of writing it. 
> 
>  After reading carefully the doc, it's perhaps not a bug. From man perlsub :
> 
>      A my() has both a compile-time and a run-time effect.  At
>      compile time, the compiler takes notice of it; the principle
>      usefulness of this is to quiet "use strict 'vars'".  The
>      actual initialization is delayed until run time, so it gets
>      executed appropriately; every time through a loop, for
>      example.
> 
>  When you write :
> 
>    for (1 .. 2) {
>          my $m;
>          $m += 2;
>    }
> 
>  $m is initialized for each loop
> 
>  but with :
> 
>    for (1 .. 2) {
>        my $m if defined $n;
>        $m += 2;
>    }
> 
>  run-time initialization occur only when $n is defined
> 
> 
> 
> Guy Decoux
> 

-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-
		     Josh Powers - jpowers@cs.oberlin.edu
		      http://www.cs.oberlin.edu/~jpowers



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

Date: Wed, 29 Jul 1998 11:31:56 -0400
From: Joshua Powers <jpowers@cs.oberlin.edu>
To: ts <decoux@moulon.inra.fr>
Subject: Re: bug in lexical array reference?
Message-Id: <Pine.ULT.3.96.980729113031.2623X-100000@occs.cs.oberlin.edu>

Oh, I see what you're saying now.  But a my() variable must be deleted
upon exiting its enclosing block.  So this has to be a bug, right?  This
variable name clearly isn't being deleted from the namespace.

On Wed, 29 Jul 1998, ts wrote:

> >>>>> "J" == Joshua Powers <jpowers@cs.oberlin.edu> writes:
> 
> J> I still disagree.  I believe what man perlsub is saying is that the my
> J> variable is recognized as such during compile time, but it simply isn't
> J> initialized until run-time.  It doesn't say that the my variable will
> J> mysteriously become a package variable during run-time if certain criteria
> J> aren't met.  Besides, if this were the case, I would think this would be a
> J> most undesirable "feature".  The code in question:
> 
>  It don't become a package variable, try this script :
> 
> moulon% cat a.pl
> #!/usr/bin/perl
> sub toto {
>     my $m = shift;
>     my $n = 2 if !($m % 5);
>     $n += 2;
>     print "$n ";
> }
> for (1 .. 12) {
>     toto($_);
> }
> moulon%  
> 
>  and see the result. The doc say that at compile-time a my() variable is
>  recognized but it's initialized at run-time. With this example the
>  variable $n is not initialized at run-time when ($m % 5).
> 
>  But apparently the variable is not only initialized but also a new
>  instance of the variable is created (see the values of \$n)
> 
>  In my example each time !($m % 5) perl create a new instance of the
>  variable in the other case ($m % 5) it use the previous instance.
> 
>  I really don't know if it's a bug or a feature : perhaps a question for
>  comp.lang.perl.moderated :-)
> 
> 
> Guy Decoux
> 
> 
> 
> 

-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-
		     Josh Powers - jpowers@cs.oberlin.edu
		      http://www.cs.oberlin.edu/~jpowers



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

Date: Wed, 29 Jul 1998 09:09:20 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Chris Denman <c-denman@dircon.co.uk>
Subject: Re: CHOMP not working on some servers
Message-Id: <35BF2D10.B9675B7A@mail.uca.edu>

[cc'd to cd]

It sounds to me like that server has Perl 4 installed (no chomp
function). I have heard of such Precambrian servers still around, but
they should have been extinct long ago.

Cameron
camerond@mail.uca.edu

Chris Denman wrote:
> 
> I have been coding perl for 9 months and obviously have had no
> problems with CHOMP.  Just recently I moved some code from one
> server to another - a daily thing for me - and the code would
> not work at all.  After a bit of debugging I found that chomp
> only took the last character off of the string and left some
> crap (I thought that chomp took off all of the crap off the end
> of a string?).
> 
> Any thoughts?
> 
> Chris


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

Date: Wed, 29 Jul 1998 09:57:09 -0400
From: Tejas Patel <trpatel@umd.umich.edu>
Subject: Cookie File
Message-Id: <35BF2A35.411372C0@umd.umich.edu>

Can anyone help me create a perl/cgi cookie file that will have just a
user's name appear in the netscape cookie.txt file.

Thanks.



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

Date: Wed, 29 Jul 1998 15:09:23 GMT
From: dan@NOSTINKINSPAM.nwsl.west.ga.net. (Daniel)
Subject: Re: Cookie File
Message-Id: <DWGv1.916$2l3.1406319@news4.atl.bellsouth.net>

LAst time <35BF2A35.411372C0@umd.umich.edu>, Tejas Patel <trpatel@umd.umich.edu> said whatever is quoted below
>Can anyone help me create a perl/cgi cookie file that will have just a
>user's name appear in the netscape cookie.txt file.
>
>Thanks.
>


print"Content-Type: text/html\n";

print "Set-Cookie:ORDER=",$name,"; path=/; expires=Wednesday, 09-Nov-99 
23:12:40 GMT
";    
print "\n";


Notice that the "; is on a seperate line. For some reason my scripts bomb if 
it is on the same line as the cookie statement
Also,  make sure there is a \n before the cookie, and after as above. 

daniel

Mic 6:8 He hath shewed thee, O man, what is good; and what doth 
the LORD require of thee, but to do justly, and to love mercy, 
and to walk humbly with thy God? 


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

Date: Wed, 29 Jul 1998 09:27:14 -0500
From: John Adams <John.Adams@BentonvilleAR.ncr.com>
Subject: Copacetic Now! (was Re: glob wrecks foreach loop!)
Message-Id: <35BF3142.311@BentonvilleAR.ncr.com>

No, it's not a new Coppola movie about the depression-era booze wars.

Tad McClellan wrote, and so did Tom Phoenix and Tom Christiansen in my
email (and possibly in the newsgroup, as well, so there may have been
some other helpful types I'm not thanking), with a clue to the answer to
my problem. I ended up doing what it says on p. 56 of the Camel book and
changing:

	$storefile = glob $storefile;
	if (-e $storefile) {

to

	($storefile) = glob $storefile;
	if ($storefile ne "") {

and now everything is copacetic! (I LOVE that word, especially applied
to something I'm doing.) Thanks for the hints!

	John A


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

Date: Wed, 29 Jul 1998 10:12:06 -0500
From: "Marcelo L. Meira" <marcelo.meira@waii.ERASETHIS.com>
Subject: Re: file system operations on open files
Message-Id: <35BF3BC6.9BD838BD@waii.ERASETHIS.com>

Ilya Zakharevich wrote:
> 
> It is *absolutely* unportable to link, unlink, rename, or chmod a file
> that is open.  The only excuse you have is that I do not know a
> non-Unixish system with /etc/password.  ;-)
> 
> Ilya

Not according to Bach's "The Design of the Unix OpSys" (chap. 5). The
abstraction Unix uses between User's fd table <-> file table <-> inode
table allows for the syscalls in question, no matter if the file is
opened or not. If a OS doesn't support this, it's not Unix.

How about if a process has a file opened, and some user renames the
file?

This is also a commom method for using temporary files:


fd = open("my_temp_file", O_RDWR);
unlink("my_temp_file"); /* no other process can see the file */

/* write() and read 'fd' */
 ...

close(fd); /* now the inode is released */



-- 

----------------
Marcelo L. Meira, Programmer
spam bait: postmaster@localhost
e-mail: marcelo.meira at waii dot com
Western Geophysical - (713) 689-2679

"UNIX _IS_ user friendly; it's just picky about who its friends are."


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

Date: 29 Jul 1998 15:44:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: file system operations on open files
Message-Id: <6png1c$276$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Marcelo L. Meira
<marcelo.meira@waii.ERASETHIS.com>],
who wrote in article <35BF3BC6.9BD838BD@waii.ERASETHIS.com>:
> Ilya Zakharevich wrote:
> > 
> > It is *absolutely* unportable to link, unlink, rename, or chmod a file
> > that is open.  The only excuse you have is that I do not know a
> > non-Unixish system with /etc/password.  ;-)
> > 
> > Ilya
> 
> Not according to Bach's "The Design of the Unix OpSys" (chap. 5). The
> abstraction Unix uses between User's fd table <-> file table <-> inode
> table allows for the syscalls in question, no matter if the file is
> opened or not. If a OS doesn't support this, it's not Unix.

Exactly.  And probably visa versa.  Which makes it absolutely unportable.

Ilya


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

Date: Wed, 29 Jul 1998 08:48:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: file system operations on open files
Message-Id: <MPG.1028e43bc4f8028298979d@nntp.hpl.hp.com>

In article <35BF3BC6.9BD838BD@waii.ERASETHIS.com> on Wed, 29 Jul 1998 
10:12:06 -0500, Marcelo L. Meira <marcelo.meira@waii.ERASETHIS.com> 
says...
 > Ilya Zakharevich wrote:
 > > 
 > > It is *absolutely* unportable to link, unlink, rename, or chmod a 
file
 > > that is open.  The only excuse you have is that I do not know a
 > > non-Unixish system with /etc/password.  ;-)
 > > 
 > > Ilya
 > 
 > Not according to Bach's "The Design of the Unix OpSys" (chap. 5). The
 > abstraction Unix uses between User's fd table <-> file table <-> inode
 > table allows for the syscalls in question, no matter if the file is
 > opened or not. If a OS doesn't support this, it's not Unix.

That's right.  That's the point.  'Portable' includes other OSs than Unix 
variants.  There are a few such, you know.

 > How about if a process has a file opened, and some user renames the
 > file?

In Windows/DOS systems, the OS does not permit this.

 > This is also a commom method for using temporary files:
 > 
 > fd = open("my_temp_file", O_RDWR);
 > unlink("my_temp_file"); /* no other process can see the file */
 > 
 > /* write() and read 'fd' */
 > ...
 > 
 > close(fd); /* now the inode is released */

It may be common for Unix systems, but it is not portable.  'Inode' is 
not a portable concept.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 29 Jul 1998 10:25:44 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: FTP without Net::FTP module
Message-Id: <fl_aggie-2907981025440001@aggie.coaps.fsu.edu>

In article <35BF2636.EB6F661D@mail.uca.edu>, Cameron Dorey
<camerond@mail.uca.edu> wrote:

[just tossing the contents of Net::FTP into a script as a set of
 subroutines]

+ why wouldn't it work just like the module does (maybe with a little bit
+ of futzing)?

Because Net::FTP immediately uses these modules?

use Socket 1.3;
use IO::Socket;
use Time::Local;
use Net::Cmd;
use Net::Config;

Ok, the first three should be perl 5 standard items. You'd have to add
in the next two, I think.

James


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

Date: Wed, 29 Jul 1998 09:28:04 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Getopt::Std leaves $opt_XXX4s UNDEFINED
Message-Id: <35BF3174.B56FB6E5@houston.Geco-Prakla.slb.com>

Franz Kaufmann wrote:
> 
> Hello.
> 
> I 4m using perl 5.004_004.
> 
> When I do a
> 
> use Getopt::Std;
> 
> and do a :
> 
> getopt ("avl");
> 
> perl doesn4t stop to complain about the $opt-variables being "possible
> typos" until I do a "local " on all the $opt.
> 
> Now for the fun part:
> 
> Later in the program I check the $opt and NO command line switch is
> recognized even if I start the script with the switches.As I do the
> aforementioned "local" operation on the $opts first thing before any
> subroutine is called,it can4t be a scope problem.So it seems that the
> package Getopt::Std doesn4t define anything for me.
It might have something to do with you local()izing your variables.

Either use vars qw (opt_a opt_b opt_d); or you can check if defined, and
variable, as below.

> 
> Can anybody tell me where I got wrong?
By not including a code snippet that demonstrates the behavior you're
seeing?

I had some problems using getopt, initially, and was advised to use
getopts instead.

#!/usr/local/bin/perl -w
#
use Getopt::Std;
 
getopts('abd') or die "Invalid option.";
if (defined($opt_a) and $opt_a) {
    print "opt_a set\n";
}
if (defined($opt_b) and $opt_b) {
    print "opt_b set\n";
}
if (defined($opt_d) and $opt_d) {
    print "opt_d set\n";
}
    
__END__

The above works fine for me (as -a, -ab, -a -b, -d, -b -d, -bd, ...).

Hope that helps.

> 
> Thank you in advance.

-- 
Dave Barnett	Software Support Engineer (281) 596-1434


If you make it idiot proof, they'll just make a better idiot.


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

Date: 29 Jul 1998 14:28:35 GMT
From: aarond@alpha.ewl.uky.edu (Aaron B. Dossett)
Subject: Re: Help on my very short script using hash
Message-Id: <6pnbij$ebl$1@service3.uky.edu>

lloyd (lloyd007@best.com) wrote:
> 
> #!/usr/bin/perl -w
> 
> %pass = (
>    "lloyd => lloyd
>    leanne => henigman
>    udel => wilson"
>    );

That should be....

  %pass = (
	lloyd => 'lloyd',
	leanne => 'henigman',
	udel => 'wilson'
	);

Hope that helps,

Aaron
-- 
Aaron B. Dossett   |   Finger aarond@london.cslab.uky.edu for PGP key
dossett@bigfoot.com|      
Comp. Sci. Senior  |         http://www.ewl.uky.edu/~aarond
    University of Kentucky    1996 & 1998 NCAA Basketball Champions


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

Date: Wed, 29 Jul 1998 10:04:09 -0400
From: "Internet News" <dkatz23@ix.netcom.com>
Subject: HOW DO I GET PERL
Message-Id: <6pna98$ef0@sjx-ixn6.ix.netcom.com>

How do I get perl for my server.  Please help me my e-mail address is
nall@gfweb.net.



Thank you,
Dave




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

Date: Wed, 29 Jul 1998 10:23:37 -0400
From: "David Thompson" <domainsource@usa.net>
Subject: Re: HOW DO I GET PERL
Message-Id: <6pnb3d$35p$1@winter.news.erols.com>

Well... are you on an NT or Unix server?

activestate.com and perl.com will have NT and perl respectively.

David Thompson

Internet News wrote in message <6pna98$ef0@sjx-ixn6.ix.netcom.com>...
>How do I get perl for my server.  Please help me my e-mail address is
>nall@gfweb.net.
>
>
>
>Thank you,
>Dave
>
>




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

Date: 29 Jul 1998 09:23:02 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Im Willing to pay or give a free DOMAIN for a custom cgi!
Message-Id: <6pneom$r9a$1@xmission.xmission.com>



Nothing above this line is part of the signed message.

Followups set appropriately.

In article <6pjvkg$p8h$1@news.seicom.net>,
Ralph Jaeger <jaeger@deepfx.com> wrote:
>Hi,
>
>you could do this with ssi and retrieving the url from within perl.
>User won't notice.
>The problem:
>the sponsor would notice a whole lot of clicks from on ip !
>
>also most sponsors are not willing to pay more then 4% clickthrough rate...

Really? (Serious)

I'm surprised. 

I recognize that most banners have a low click-through, but I have
designed banners that got real 6% click-through rates before (Tip: The
Power of the Words 'Click Here' Should Never be Underestimated. 
Corollaries left for the Cynical). I know people who in highly targeted
environments have gotten into the teens.

Benjamin Franz


Version: 2.6.2

iQCVAwUBNb8+O+jpikN3V52xAQH2VgP/c9z8SZgLA8LnKRn6OKMTnx7qlVo99k2i
uvYFI6M6e4qyOu0UYaOrjdOV2qzaVfdVZ0IFET+0XSkdMQjCPX1TmDc+gAzKwuCM
zhJLmf7F6RCRCXGymqs86h353gvKMDAFoU1BWER/vMCcFOKbaZhvkhmqF3Sh/C74
Phfn0ahRWss=
=n5vj
-----END PGP SIGNATURE-----


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

Date: Wed, 29 Jul 1998 14:22:08 GMT
From: Karmadon@my-dejanews.com
Subject: Re: Inheritance broken ... SOLVED
Message-Id: <6pnb6h$kdi$1@nnrp1.dejanews.com>

In article <m3emv5qyrh.fsf@windlord.Stanford.EDU>,
  Russ Allbery <rra@stanford.edu> wrote:
>
> Oh, wait.  I see what's wrong.  @ISA isn't getting set until runtime, of
> course, and therefore @ISA isn't set at the time of the call to D->new()
> if you put that call before the assignment to @ISA.
>
> If you put @ISA in a BEGIN { } block, things will work as you expect.
>
Why, of course! The following:

#!/usr/local/bin/perl -w
A::pr();

package A;
$a = "Ok\n";
sub pr { print $a; }

is not going to work unless the assignment to $a is done in the BEGIN
block, or package A is put into a separate file and use'd (require'd)
by main... But I did expect a certain degree of automagicness from
assignment to @ISA ... and was wrong.

Thanks.

-igor

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 29 Jul 1998 08:48:20 -0500
From: "Patrick L. McGillan" <mcgillanp@mndulu.ang.af.mil>
Subject: Is it possible
Message-Id: <6pn8sb$1q1e2@michener.tea.state.tx.us>

Hi,

I can't seem to figure out how to control a serial port. Is it possible with
perl? I would like to do some low level i/o to a serial port.

Patrick
mcgillanp@mndulu.ang.af.mil





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

Date: 29 Jul 1998 15:33:13 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: Is it possible
Message-Id: <6pnfbp$pr6$1@msunews.cl.msu.edu>

Patrick L. McGillan <mcgillanp@mndulu.ang.af.mil> wrote:
: I can't seem to figure out how to control a serial port. Is it possible with
: perl? I would like to do some low level i/o to a serial port.

Of course its possible.  This is perl we're talking about.

Sorry I can't be of more help.  But if there isn't anything built into
the language, then think c extension.

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: Wed, 29 Jul 1998 08:16:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Loop Problem
Message-Id: <MPG.1028dca48ca257d798979c@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6pmkmk$nub$1@nnrp1.dejanews.com> on Wed, 29 Jul 1998 07:58:13 
GMT, dave@mag-sol.com <dave@mag-sol.com> says...
: In article <MPG.102782a319a1f4c989797@nntp.hpl.hp.com>,
:   lr@hpl.hp.com (Larry Rosler) wrote:
 ...
: > No it won't.  It will match whatever the previous successful match 
did.
: > Here is a simple test:
: >
: > #!/usr/local/bin/perl -w
: > use strict;
: >
: > my $foo = '';
: > $_ = 'abcd';
: > /bc/;
: > /$foo/ and print "$_\n"; # prints abcd
: > $_ = 'efgh';
: > /$foo/ and print "$_\n"; # doesn't print -- no match against 'bc'
: 
: Yes it will, here's a simpler script to illustrate.
: 
: # Match an empty regular expression with any string
: if ('random string' =~ //)
: {
:     print "Match\n";
: }
: else
: {
:     print "No match\n";
: }

It is hard to know whether to laugh or to cry in the face of such 
obtuseness.  // matches the previous match, period.  In your 'simpler 
script' there isn't any; evidently it then matches anything.  Precede 
your snippet with this:

'x' =~ /x/;

and see what happens.  Then change both the 'x's to 'r's and try again.  
Then learn to read, to experiment, and to think.  In other words, to 
program.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com

x
x
x
x
x
x
x
x
x
x


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

Date: 29 Jul 1998 14:50:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Misleading documentation
Message-Id: <6pncr1$94a$1@pegasus.csx.cam.ac.uk>

In article <joe.mcmahon-2807981338590001@prtims.stx.com>,
Joe McMahon <joe.mcmahon@gsfc.nasa.gov> wrote:
>Note: I am NOT asking a question, but pointing out what I feel is an
>ambiguous meaning, or perhaps an oversight, in a Perl error message.
  [ much snipped ]

I'm unable to understand what your problem is.    Perhaps if you
supplied some code, showing what the problem is, i.e.

" Here is some code.  The documentation {ideally supply references]
  says [or implies] that it does XXX.  Actually it does YYY.  "

or

" Here is some code which generates error message XXX.   I think it
  would be more helpful if it said YYY.  "


One guess is that you are confusing method calls, which are subject to
inheritance, and subroutine calls, which are not.   But it's hard to tell.


Mike Guy


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

Date: Wed, 29 Jul 1998 10:41:30 +0100
From: Andrew MacInnes <a.g.macinnes@nospam.rl.ac.uk>
Subject: Re: Newbie: extracting fields
Message-Id: <35BEEE49.4BBE4295@nospam.rl.ac.uk>

greggman@my-dejanews.com wrote:

> I'm sorry this is such a basic question but I've been looking for over 2
> hours for the answer.  I must be an idiot.  That includes looking in the
> current perl docs/faq etc.  Maybe I just don't know what to search for.  I
> could have had this finished in C in about 2 mintues.  I need to learn perl
> better.
>
> I'm reading a file one line at a time.  A typical line looks like this
>
>  .fdata.s  f'33.011974, f'50.352013, f'-30.042702       ; max
>
> How do I get $1, $2 and $3 to be 33.011974, 50.352013, -30.042702
> respectively?
>
>   I tried this
>
>   /\s*fdata\.s\sf\'([\d\.\-]+),\sf\'([\d\.\-]+),\sf\'([\d\.\-]+).*/;
>
> which clearly (well, not so clearly to me) doesn't work.
>
> In C I think I would do this
>
>   (assuming I don't care about precision)
>
>   float v1,v2,v3
>
>   scanf (" fdata.s f!%f, f'%f, f'%f", &v1, &v2, &v3);
>
>   note: in perl, I'm not conserned about using the data as floats, strings
> would be better, in fact in this particular case all I'm trying to do is this
>
>   print "$1, $2, $3,\n";

Someone else will probably come up with a better idea but this works

#!usr/local/bin/perl/ -w
$l = "f'33.011974, f'50.352013, f'-30.042702";
$l =~ s/f'/ /g;
$l =~ s/ //g;
@data = split(/,/, $l);
print @data;


Hope this helps


Andrew MacInnes

----------------------------------------------------------
- RAL                       E-mail:A.G.MacInnes@rl.ac.uk -
- DCI                  Telephone (direct): (01235)446104 -
- Atlas Building                                         -
- R27 - F31                                  Disclaimer: -
- Chilton, Didcot     These opinions are my own and most -
- Oxon, OX11 0QX      probably not that of my employers. -
----------------------------------------------------------





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

Date: Wed, 29 Jul 1998 15:07:58 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: perl complier for ms dos
Message-Id: <35BF2CBE.13A3EE58@nortel.co.uk>

sursood wrote:
> 
> i don't have access to cgi-bin directory or perl on my server can i try
> the scripts on my stand alone machine?
> 
> suruchi

Yes, your machine complies (compiles? what the heck...) to executing
Perl. One way is always the command line that will help you find errors,
regardless of the script being for CGI purposes or not. Another way is
to set up a server on loopback, as I describe it in a text on my
homepage whose address is in my sig.

HTH


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 29 Jul 1998 14:28:19 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: Perl Embed Win32 C++
Message-Id: <slrn6rucdb.rm.bjepson@gelvis.ids.net>

On Tue, 28 Jul 1998 14:04:34 -0700, Ed <ed@pdh.com> wrote:
>To start out with, I am not a perl programmer and don't really know a
>whole lot about perl, but was given the task to call a perl program from
>within my C++ code.  I have looked at the perl embed for win32 stuff but
>still don't have a good idea of how to do this.  Most of the programs
>want to take the command line arguments which I do not want to use (from
>void main(argc, argv)).  I will know the argument (single argument) and
>the perl program name.  I have not seen any really good examples of how
>to do this.  Does anyone have any ideas?
>

Have you looked at the revised version of the Perl for Win32 FAQ?  It is 
included with the ActivePerl distribution at www.ActiveState.com.  The FAQ
includes examples with Makefiles that show how to embed Perl in Visual C++,
but I'm sure it could be adapted to other C compilers.

You can also find the FAQ on line at:

  http://www.activestate.com/support/faqs/win32

Section 10 of the FAQ will be of interest to you.  For some reason, the
link to section 10 is missing from the main page, so you'll have to get it
at:

  http://www.activestate.com/support/faqs/win32/perlwin32faq10.html

Hope this helps,

-- 
Brian Jepson * (bjepson@ids.net)  * http://users.ids.net/~bjepson
              Choosy mothers choose to chew Chew-Z


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

Date: Wed, 29 Jul 1998 10:38:58 -0400
From: "Bill Ward" <billw@mentis.com>
Subject: Perl-CGI: Need help setting filename in browser when downloading from server script
Message-Id: <6pnc6h$7oi$1@client3.news.psi.net>

Application: a "secure" script for transferring files out of the webspace to
a user's browser.  Users apply password then are presented with choices each
invoking a script with access to files located in directories not available
to the httpd.

This script prints the contents of the file to the user (same method used by
script-generated HTML) but the filename the browser sees is that of the
script, not of the actual binary file.

What syntax do I use to instruct the browser to accept a new page with a
specific filename (in this case, a *.pdf.)?

Any help is appreciated.

Thanks!
- Bill Ward
sysadmin, Mentis Corp.
Durham, NC, USA
919-384-1500
NObillw@mentis.comSPAM




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

Date: Wed, 29 Jul 1998 10:41:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl-CGI: Need help setting filename in browser when downloading from server script
Message-Id: <comdog-2907981041370001@news.panix.com>
Keywords: just another new york perl hacker

In article <6pnc6h$7oi$1@client3.news.psi.net>, "Bill Ward" <billw@mentis.com> posted:

> What syntax do I use to instruct the browser to accept a new page with a
> specific filename (in this case, a *.pdf.)?

this (non Perl) (browser specific) question has been answered several
times in comp.infosystems.www.authoring.cgi.  see DejaNews.

good luck :)

-- 
brian d foy                                 <http://computerdog.com>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Wed, 29 Jul 1998 09:32:42 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Programmer's Editor
Message-Id: <35BF328A.8A213211@houston.Geco-Prakla.slb.com>

Gabor wrote:
> 
> The question is, why is he advertising here at all.  This is the last
> place I would look if I were looking for an editor.  It's sort of
> like, does one go looking for cars in a grocery store?  I would hope
> not.
Of course you would, if you wanted to steal one, rather than buy one. 
;-)

-- 
Dave Barnett	Software Support Engineer (281) 596-1434


Paranoia doesn't necessarily mean everyone is NOT out to get you.


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

Date: Wed, 29 Jul 1998 10:33:02 -0400
From: "Peter W. Shankey" <shankeyp@charlestoncounty.org>
Subject: ps -ef in perl
Message-Id: <35BF329E.2FDBEA33@charlestoncounty.org>

can a perl script be made which will do a unix ps -ef in perl?  If so
how?  I have tried getpgrp but it requires a PID.
thanks
pete



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

Date: 29 Jul 1998 15:01:59 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: ps -ef in perl
Message-Id: <6pndh7$k2j$1@msunews.cl.msu.edu>

Peter W. Shankey <shankeyp@charlestoncounty.org> wrote:
: can a perl script be made which will do a unix ps -ef in perl?  If so
: how?  I have tried getpgrp but it requires a PID.

system 'ps -ef';

or

$output = `ps -ef`;


-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: Wed, 29 Jul 1998 14:46:10 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Same code, diff machines, diff results
Message-Id: <35BF361D.3A7F@min.net>

Martien Verbruggen wrote:
> 
> $ uname -a
> SunOS timber 5.6 Generic_105181-06 sun4u sparc SUNW,Ultra-2
> $ pwd
> /usr/share/lib/zoneinfo
> $ grep Asia/Calcutta asia
> Zone    Asia/Calcutta   5:53:28 -       LMT     1880
> # The following are like Asia/Calcutta:
> $
> 
> Hmmm.. Looks like it does know. And so does Solaris 2.5.1.

I guess it's really silly to argue about this; it clearly 
depends on what you happen to have installed at your site.

% uname -a
SunOS capella 5.5.1 Generic sun4m sparc SUNW,SPARCstation-20
% pwd
/usr/share/lib/zoneinfo
% ls Asia/Calcutta
Asia/Calcutta: No such file or directory
% ls
Australia     GMT+1         GMT-2         MET           Universal
Brazil        GMT+10        GMT-3         MST           W-SU
CET           GMT+11        GMT-4         MST7MDT       WET
CST6CDT       GMT+12        GMT-5         Mexico        Zulu
Canada        GMT+13        GMT-6         Mideast       africa
Chile         GMT+2         GMT-7         NZ            asia
Cuba          GMT+3         GMT-8         NZ-CHAT       australasia
EET           GMT+4         GMT-9         Navajo        backward
EST           GMT+5         Greenwich     PRC           etcetera
EST5EDT       GMT+6         HST           PST8PDT       europe
Egypt         GMT+7         Hongkong      Poland        factory
Eire          GMT+8         Iceland       ROC           northamerica
Etc           GMT+9         Iran          ROK           pacificnew
Factory       GMT-0         Israel        Singapore     posixrules
GB            GMT-1         Jamaica       Turkey        solar87
GB-Eire       GMT-10        Japan         UCT           solar88
GMT           GMT-11        Kwajalein     US            solar89
GMT+0         GMT-12        Libya         UTC           southamerica

-- 
John Porter


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

Date: Wed, 29 Jul 1998 15:25:26 +0100
From: Duncan Martin <dmarti81@ford.com>
Subject: Skipping dates
Message-Id: <35BF30D5.DB3D1418@ford.com>

Hi,
  Part of a web application I'm working on needs to be able to calculate
the number of 'working hours' between 2 dates (stored as seconds since
epoch), i.e. skip over weekends - this I've done myself OK.
e.g.
    ($null,$null,$h1,$null,$null,$y1,$wd1,$yd1,$null) = gmtime(@_[0]);
    ($null,$null,$h2,$null,$null,$y2,$wd2,$yd2,$null) = gmtime(@_[1]);

    # Balance out the years
    while ($y2 > $y1) { $y2--; $yd2 += (365 + !($y1 % 4)); }

    # If it's the same day
    if ($yd1==$yd2) { return ($h2-$h1); }

  # Work out the number of whole weekends
    $knockoff = int (($yd2 - $yd1) / 7);
    if ($wd2 < $wd1) { $knockoff++; }
    $knockoff *= 2;

    return ($h2-$h1)  + (($yd2-$yd1-$knockoff) * 24);

n.b The case of either the first or second date being a weekend is
ignored

 ...which works fine (apart from the year 2038 problem), the thing is
that I've now realised the algorithm must also skip bank holidays, which
of course, just to make things interesting change every year.

So... any suggestions on how to implement this, data structures/methods
to store the bank holidays and ways to get the number of them between
times with the minimum amount of CPU waste, this algorithm is called
fairly often and I'd like to keep it effecient. i.e. minimum amount of
'for' loops.

Thanks,
  Duncan



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

Date: Wed, 29 Jul 1998 11:05:03 -0400
From: Scott Boss <sboss@technologist.com>
Subject: Who to have a dbase with mutiple tables in perl
Message-Id: <35BF3A1F.AE555558@technologist.com>

Hello,

	I am looking for a dbase that perl can interface with/control that has
multiple tables within a single dbase file.  What are my choices?

Reasoning behind this question:  I have a laptop that has a half dozen
(and growing) configurations.  One for every network it plugs into. 
Well I have to manually copy various files (the specific one for that
network over the one linux uses to boot).  I would like to write a
program that would keep track of all these configuration files, and I
could say "switch to sboss.net configuration" and I would have all the
files in place to boot for that network.  The right name, ip address,
hosts files, passwd/shadow files, pcmcia config files, etc.

Thanks for your help in advance,
Scott Boss

PS>  Please email me directly since I do not have a chance to read this
newgroup as often as I would like.

mailto:sboss@technologist.com


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3285
**************************************

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