[7719] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1345 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 20 00:17:39 1997

Date: Wed, 19 Nov 97 21:00:26 -0800
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, 19 Nov 1997     Volume: 8 Number: 1345

Today's topics:
     -e switch <jsrk@pipeline.com>
     Re: -e switch (Tad McClellan)
     [Q] What should I use 'oraperl' or 'DBI:oracle'? <neochi@chollian.net>
     Re: [Q] What should I use 'oraperl' or 'DBI:oracle'? <zenin@best.com>
     Authenticate a user and log him an NT identity <dbiswas@nc.com>
     Re: Can't 'make' modules.  "bash: make: command not fou (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: cgi-lib question (Eric Bohlman)
     Re: Connecting to Oracle (Greg Teets)
     Re: Debugging CGI programs (Vladimir Sovetov)
     Re: Error Log messages (brian d foy)
     Re: exclusive file rights (Steve)
     Re: exclusive file rights (Steve)
     giving up on flock (Steve)
     Re: how do i append todays date to the end of a filenam (Martien Verbruggen)
     Re: How to retrieve a .gif-file from a website? (Martien Verbruggen)
     Re: mkdir not mking my dir (brian d foy)
     NDBM .pag and .dir (Thomas Hartwig)
     Pattern interpolation in s///ig broken in perl5.004 (Marc Rouleau)
     Re: Q: How many elements in a %HASH ? <zenin@best.com>
     Re: Q: How many elements in a %HASH ? <tchrist@mox.perl.com>
     Re: Regexp that's bugging me <usenet-tag@qz.little-neck.ny.us>
     Searching question <jdubchak@sprint.ca>
     Re: sequence point? <markm@nortel.ca>
     Re: sequence point? <bnelson@iname.com>
     Re: Theory behind perl <joegottman@worldnet.att.net>
     Re: type glob error in FileHandle.pm <markm@nortel.ca>
     Re: type glob error in FileHandle.pm <zenin@best.com>
     Re: Year2000 problem with localtime(); (Martien Verbruggen)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 19 Nov 1997 20:18:00 -0600
From: Joseph Kewish <jsrk@pipeline.com>
Subject: -e switch
Message-Id: <34739DD8.812C1DFB@pipeline.com>

I'm having the damndest time trying to figure out how to use perl
straight from the command line. There are times when I just need a
little loop or what have you, but I've not been able to find a clear
example of how the -e switch is used.

Anyone care to give me an example?

Thanks a lot...



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

Date: Wed, 19 Nov 1997 20:34:19 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: -e switch
Message-Id: <bj7056.0h3.ln@localhost>

Joseph Kewish (jsrk@pipeline.com) wrote:
: I'm having the damndest time trying to figure out how to use perl
: straight from the command line. There are times when I just need a
: little loop or what have you, but I've not been able to find a clear
: example of how the -e switch is used.

: Anyone care to give me an example?


1) write a script

2) remove the shebang (#!) line

3) remove all newlines, and most all white space

4) at the command line, do:

   perl -e ''


Where the contents of the '' is the script from above   ;-)

Be sure to do whatever escaping is needed to get chars past the shell.



eg. show all the directories in the compiled-in path:

   perl -e 'foreach (@INC) {print "$_\n"}'




You, of course, have already looked at the 'perlrun' (how to 
execute the Perl interpreter) man page before posting...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Thu, 20 Nov 1997 11:24:33 +0900
From: Ini Chung <neochi@chollian.net>
Subject: [Q] What should I use 'oraperl' or 'DBI:oracle'?
Message-Id: <34739F60.8B96A56F@chollian.net>

Hi,
I use Oracle7 Database and Perl5.003 on Solaris2.5.1.

I have wrote a perl CGI script to access my Oracle DB.
First, I wrote using DBI but I couln't handle the oracle error.
I'm not sure I should use oraperl which support $ora_errno.
Oraperl is more suitable to me than DBI?
which mean, should I use '&ora_fetch' function than
'$cursor_fetchrow' ?

Pls, give me some guide and suggest some reference book
to write perl CGI to handle Oracle DB.

Replying me via email would be appreciated.
Thanks in advance. :-)





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

Date: 20 Nov 1997 03:05:06 GMT
From: Zenin <zenin@best.com>
Subject: Re: [Q] What should I use 'oraperl' or 'DBI:oracle'?
Message-Id: <879995258.542274@thrush.omix.com>

[ posted & mailed ]

Ini Chung <neochi@chollian.net> wrote:
: First, I wrote using DBI but I couln't handle the oracle error.
: I'm not sure I should use oraperl which support $ora_errno.

	$dbh->do ($statement)
		or die $DBI::errstr;

	Or if you're really into OOP:

	$dbh->do ($statement)
		or die $dbh->errstr;

	But I hate using method calls to get at error strings
	myself.

: Pls, give me some guide and suggest some reference book
: to write perl CGI to handle Oracle DB.

	perldoc DBI

: Replying me via email would be appreciated.

	Done.

: Thanks in advance. :-)

	NP. :)

-- 
-Zenin
 zenin@best.com


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

Date: Wed, 19 Nov 1997 18:08:45 -0800
From: Debasish Biswas <dbiswas@nc.com>
Subject: Authenticate a user and log him an NT identity
Message-Id: <34739BAC.2899FE6C@nc.com>

Hi everybody,

I am writing a web-based admin tool on NT using Perl. I have to
authenticate the client not only to the admin application but also to
the operating system, so that the client can get the right
administrative privileges. In other words I want the scripts to 'run as'
a privileged user and be able to add users, create directories etc. to
the NT machine.

How do I do this ? Any help will be appreciated.

Thanks.

Debasish Biswas

P.S. I am using IIS if that is of any significance.



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

Date: Wed, 19 Nov 97 21:47:01 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Can't 'make' modules.  "bash: make: command not found"
Message-Id: <3473a53d$2$ofn$mr2ice@speaker>

In <34746e2c.3712270@news.wwa.com>, on 11/19/97 at 10:59 PM,
   faust@wwa.com (Faust Gertz) said:
+-----
| > /usr/local/bin/perl5.004 Makefile.PL LIB=/usr/home/fs1/asen/MagicServer/httpd/cgi-bin/perl
| Writing Makefile for CGI
| > make
| bash: make: command not found
+--->8

Solaris, by any chance?  (Although some other SVR4 variants also have the
problem, reportedly including SCO v5).

Anyway, the problem on Solaris, SCOv5, etc. is that /usr/ccs/bin needs to be
added to your PATH.  To the *end* of your PATH, by preference:  some vendors
put bad stuff in there (notably, Solaris has a /usr/ccs/bin/cc that's a shell
script which essentially advertizes Sunsoft's compiler suite).

-- 
brandon s. allbery           [Team OS/2][Linux][JAPH]        bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                  KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
 `Greensleeves'."  ---unknown, quoted by Janet D. Miles in alt.callahans



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

Date: Thu, 20 Nov 1997 01:03:56 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: cgi-lib question
Message-Id: <ebohlmanEJx6yK.50I@netcom.com>

Janyne M. Kizer (jmkizer@pagesz.net) wrote:
: I am relatively new to perl and I am not a programmer, however I have
: managed to inherit a script that is not working and I need to fix it.  The
: script calls cgi-lib.pl 

: require "cgi-lib.pl";

: ... much latter in script

: &ReadParse(*input);

: When I run the script from the command line using perl script.pl, the
: following error message is generated:

: Content-type: text/html

: <html><head><title>cgi-lib.pl: Unknown request method:

This means that the code in cgi-lib.pl is trying to figure out how you 
were passing your form data to it, scratching its head for a while, and 
finaly concluding that it doesn't know where the data is.  Is it supposed 
to be coming in via the environment, or via the standard input?  A server 
will tell it these things, but if you just run it from the command line, 
it has no way of knowing where to look.

Your best bet is to learn enough Perl to be able to upgrade the script to 
use cgi.pm instead of cgi-lib.pl; among other things, cgi-pm has a 
facility for letting you test your scripts from the command line.



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

Date: Thu, 20 Nov 1997 01:30:43 GMT
From: teetshd@email.uc.edu (Greg Teets)
Subject: Re: Connecting to Oracle
Message-Id: <34739286.176530908@news.ececs.uc.edu>

Is there a binary copy of the Oracle module available?

Thanks

On Sun, 16 Nov 1997 19:19:31 -0800, "Michael A. Chase"
<mchase@ix.netcom.com> wrote:


>You can find the latest DBD-Oracle at
>http://www.perl.com/CPAN/modules/authors/Tim_Bunce/DBD/.  I  just
>finished installing DBI and DBD-Oracle this weekend and it is working
>fine so far.  Be sure to read the README files thoroughly before you
>build and install the module.
>
>--
>Mac :})   mchase@ix.netcom.com
>
>
>Kamal Gautam wrote in message <346E32D6.32FA@bremer-inc.com>...
>>I'm brand new to Perl, and I'm trying to connect to an Oracle database.
>>I've installed Gurusamy Sarathy's win32 binary port on  my machine,
>>along with the DBI dll, but I can't seem to get beyond that.  I can't
>>find the Oracle DBM for Win32 (the link from Hermetica seems to be
>>broken).  Anyone know where I can find this?  And anyone have step by
>>step instructions on how to proceed from there?
>
>
>



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

Date: 20 Nov 1997 03:49:10 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Re: Debugging CGI programs
Message-Id: <650bvm$nfl$1@home.kpbank.ru>

Navid S Kamali (navidk@cats.ucsc.edu) wrote:
: Hi I'm fairly new to Perl.
: I was wondering how i can print the value of variable into standard 
: output instead of into a web page. My perl programs uses cgi.
: I want to be able to do something like:
: print $variable;  (for debugging purposes)
     print STDERR $variable;
  
     You will find the results in error_log file of httpd daemon.
  At least it's so for Apache server.
---
Vladimir Sovetov | Kuzbassprombank


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

Date: Wed, 19 Nov 1997 20:09:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Error Log messages
Message-Id: <comdog-ya02408000R1911972009510001@news.panix.com>

[follow-ups set to elsewhere]

In article <34731aa4.174960202@news.buffnet.net>, &&&&marlina@webgrafx-fx.com wrote:

>My error logs have a LOT of this type error (sans date info):
>
>send body lost connection to: 12.64.7.62: Broken pipe

>What the heck causes them?

well, broken pipes.  One side of the connection disappeared for some
reason.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 20 Nov 1997 04:17:02 GMT
From: syarbrou@ais.net (Steve)
Subject: Re: exclusive file rights
Message-Id: <3473b843.19655013@news.ais.net>

On Wed, 19 Nov 97 18:16:20 -0500, bsa@void.apk.net (Brandon S. Allbery
KF8NH; to reply, change "void" to "kf8nh") wrote:

>In <34734bb5.2396616@igate.hst.moc.com>, on 11/19/97 at 08:29 PM,
>   jzawodn@wcnet.org (Jeremy D. Zawodny) said:
>+-----
>| But according to the folks on the p5p list, OS/2 at least supports mandatory
>| locks. I was under the impression that Perl does (or would in the near
>| future) make use of it in flock().
>+--->8
>
>OS/2 supports it, EMX (the runtime environment used for Perl) doesn't. 
>There's an unofficial patch running around which purports to implement flock()
>in EMX.  And you can get locking in EMX using a variant open routine and (for
>record locking) OS/2 family calls (thereby breaking the EMX Perl variant which
>runs using EMX/RSX on other PC platforms).
>
>All in all, not an ideal situation.


Can flock read/append in the same command?  I need to open a file to
at least read and lock it.  Then do some stuff, and open it for write
and close it thereby freeing the lock.  I have tried +>> to
read/append so I don't loose the data right away, but if I'm not
mistaken flock only supports read or write locks, not both and not
append.  This is what I'm currently trying(simplified).  I am waiting
to see since the below changes for my data to see if it gets
corrupted:

open (DATA, $log);
flock(DATA, 2);
   @lines = <DATA>;

 ....do some array changes and additions

open (DATA, ">$log");
print DATA @lines;
close (DATA);

This goes along the SUN man page semi description on how once a
process has a lock on a file, it can change the lock state.  Does the
above work?  If not, how would you do it?

Steve


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

Date: Thu, 20 Nov 1997 04:24:52 GMT
From: syarbrou@ais.net (Steve)
Subject: Re: exclusive file rights
Message-Id: <3474bb14.20375687@news.ais.net>

On Thu, 20 Nov 1997 04:17:02 GMT, syarbrou@ais.net (Steve) wrote:

>On Wed, 19 Nov 97 18:16:20 -0500, bsa@void.apk.net (Brandon S. Allbery
>KF8NH; to reply, change "void" to "kf8nh") wrote:
>
>>In <34734bb5.2396616@igate.hst.moc.com>, on 11/19/97 at 08:29 PM,
>>   jzawodn@wcnet.org (Jeremy D. Zawodny) said:
>>+-----
>>| But according to the folks on the p5p list, OS/2 at least supports mandatory
>>| locks. I was under the impression that Perl does (or would in the near
>>| future) make use of it in flock().
>>+--->8
>>
>>OS/2 supports it, EMX (the runtime environment used for Perl) doesn't. 
>>There's an unofficial patch running around which purports to implement flock()
>>in EMX.  And you can get locking in EMX using a variant open routine and (for
>>record locking) OS/2 family calls (thereby breaking the EMX Perl variant which
>>runs using EMX/RSX on other PC platforms).
>>
>>All in all, not an ideal situation.
>
>
>Can flock read/append in the same command?  I need to open a file to
>at least read and lock it.  Then do some stuff, and open it for write
>and close it thereby freeing the lock.  I have tried +>> to
>read/append so I don't loose the data right away, but if I'm not
>mistaken flock only supports read or write locks, not both and not
>append.  This is what I'm currently trying(simplified).  I am waiting
>to see since the below changes for my data to see if it gets
>corrupted:
>
>open (DATA, $log);
>flock(DATA, 2);
>   @lines = <DATA>;
>
>....do some array changes and additions
>
>open (DATA, ">$log");
>print DATA @lines;
>close (DATA);
>
>This goes along the SUN man page semi description on how once a
>process has a lock on a file, it can change the lock state.  Does the
>above work?  If not, how would you do it?
>
>Steve

By the way, the above code needs to have a lock on the file throughout
the whole program.  Other instances of the script can not have access
to the file until until it closes the write.

Steve


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

Date: Thu, 20 Nov 1997 03:15:18 GMT
From: syarbrou@ais.net (Steve)
Subject: giving up on flock
Message-Id: <3474ab17.16281975@news.ais.net>

I've pretty much had it with flock.  I open a file to read and
append(+>>) and it just doesn't seem to work.  My file keeps getting
cleared.  Can flock only work for reading or writing?  I hear this
function is pretty much worthless unless the kernel supports it.   I
also heard that as usual, freeware Linux supports this, and that's
about it?  Any enlightenment on the above?  Thanks.

Steve


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

Date: 20 Nov 1997 01:31:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how do i append todays date to the end of a filename?
Message-Id: <6503sq$pbs$2@comdyn.comdyn.com.au>

In article <34727D18.8C0063A3@technologyxchange.com>,
	Andrew Ellerton <andrewe@technologyXchange.com> writes:

> Portable Shmortable. The man just wanted to get the date and append it
> to a string for goodness sake.  Who said anything about making sure it
> works on every damn UNIX system or non-UNIX system...

Trolling for a flame war?

This is a perl group, not a OS specific group. The original poster did
not ask for a unix specific solution, so my remark was mainly meant to
point out that this will not work on all systems. There are GOOD
portable solutions available, so they would be preferred over a
non-portable one. Besides portability: Starting a shell to execute a
process is expensive. Doing a few trivial operations and
concatenations in perl is lots cheaper, especially if you can use the
POSIX functions. I hope that this has made it a bit clearer why I
posted that comment.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.       | make a better idiot.
NSW, Australia                      | 


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

Date: 20 Nov 1997 01:53:44 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to retrieve a .gif-file from a website?
Message-Id: <650578$phb$2@comdyn.comdyn.com.au>

In article <34720D77.54FF@algonet.se>,
	Calle <rowanfan@algonet.se> writes:
> Hi, I wonder if it's possibly with the libwww to retrieve binaryfiles,
> for example a gif-image?
> how is it done?

The same way as with any other file. Give it a URL, and do something
with what gets returned. Just check the documentation for examples on
how to retrieve documents from the web

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Wed, 19 Nov 1997 20:07:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: mkdir not mking my dir
Message-Id: <comdog-ya02408000R1911972007260001@news.panix.com>

In article <347330C6.B70C0C1@staff.netchannel.co.uk>, Leon Andrews <leon@staff.netchannel.co.uk> wrote:


>$thedir = "/export/home/nc/NC/html/talk/boards/$directory";

#make sure $thedir is what you think it is
print "\$thedir is $thedir\n";

>mkdir $thedir, oct("775");

#let's find out what went wrong
mkdir $thedir, 0775 or die "mkdir for [$thedir] failed: $!\n";


>where $directory is exactly "dir_name", nothing happens.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
i used to think i knew exactly what the data were too :)


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

Date: 20 Nov 1997 02:36:18 GMT
From: hartwig@inf.fu-berlin.de (Thomas Hartwig)
Subject: NDBM .pag and .dir
Message-Id: <6507n2$ftq$1@fu-berlin.de>
Keywords: perl NDBM

sysinfo:
########################################################
perl5 (5.0 patchlevel 3 subversion 0)
osname=linux, osver=2.0.30, archname=i386-linux
libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt


the problem:
########################################################


How in the hell do I get rid of the '.dir' and '.pag' extensions if
I'm using the NDBM_File module:

The following line is producing TWO files 'NDB.dir' AND 'NDB.pag'
which are totaly equal:

tie (%keyval, "NDBM_File", "NDB", O_CREAT|O_RDWR, 0666);

After some hours of confusing the enlightment was that these files
are hard linked. But why and who done this ;-)

Have you any explainations?

Any suggestions and documentations to NDBM would help.



-- 
Thomas Hartwig - hartwig@inf.fu-berlin.de
Student of Computer-Science at Free University Berlin
 


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

Date: 19 Nov 1997 22:18:31 -0600
From: mer@world.evansville.net (Marc Rouleau)
Subject: Pattern interpolation in s///ig broken in perl5.004
Message-Id: <650dmn$ajn@world.evansville.net>

Perl 5.00403 passes all tests on our Solaris 2.5 and AIX 4.2 systems, but
the following program ...

  $_ = 'abc';
  s/(b)//ig;
  print "\$1 = $1\n";

 ... prints
        
  $1 =

rather than

  $1 = b

It works fine as a match rather than a substitution, and it works if
we omit the i or the g modifier.  We see this problem with 5.00401
also, and we do not see it with earlier versions.

We submitted a bug report via perlbug a couple of weeks ago but have
not heard anything.  I'm just wondering if anyone else has noticed this
problem.

    -- Marc Rouleau

VP and Chief Technology Officer    Voice: (812) 479-1700   Fax: (812) 479-3439
        Network WCS                          http://www.networkwcs.com



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

Date: 20 Nov 1997 01:54:08 GMT
From: Zenin <zenin@best.com>
Subject: Re: Q: How many elements in a %HASH ?
Message-Id: <879991000.658805@thrush.omix.com>

Randal Schwartz <merlyn@stonehenge.com> wrote:
: Is it a trick if it's documented?

	Yes.  You know full well that "no one actually _reads_ the
	manual". :-)

: 	$n = keys %TEST;
: I know.  It looks hard.  But it isn't.  This *does* have to walk the
: hash, but it doesn't have to build up a list or anything.  Just a
: simple count.

	Hmm, it doesn't?  Have the perl internals changed, or were they
	always smart enough to optimize this to not built a second list?

-- 
-Zenin
 zenin@best.com


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

Date: 20 Nov 1997 02:26:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Q: How many elements in a %HASH ?
Message-Id: <650758$b05$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Randal Schwartz <merlyn@stonehenge.com> writes:
:Is it a trick if it's documented?
:	$n = keys %TEST;
:I know.  It looks hard.  But it isn't.  This *does* have to walk the
:hash, but it doesn't have to build up a list or anything.  Just a
:simple count.

No, Randal; don't spread FUD.  It does *NOT* have to walk the hash --
unless it's tied.  May I suggest that you stick your nose in the source
code? :-)  It's perfectly obvious if you look at line 492 of doop.c,
along with the ensuing macro expansion.

tom++
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

Republicans understand the importance of bondage between a mother and
child.  -- Vice President Dan Quayle


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

Date: 20 Nov 1997 04:08:15 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Regexp that's bugging me
Message-Id: <eli$9711192355@qz.little-neck.ny.us>

Jeff Stampes <stampes@xilinx.com> wrote:
> Rick Meldrum (rjk@fprsdev3.fmr.com) wrote:
> : $command = 'myprog -a arga -b bbb -c argc'
> : $command =~ s:(^.*-b)\s*\S+\s+(.+$):$1 $new_argb $2:;
> Why bother messing with the whole command?  The only thing you
> care about is "If there is a -b foo, change it to -b bar", right?
> $command =~ s/-b\s*\S+/-b newarg/;

$command = 'myprog -a arg-b -b b-b -c arg-c';

Wanna rethink your boundary conditions? :^)

Elijah
------
and if args can be quoted arbitrary strings, woah, fun!


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

Date: Wed, 19 Nov 1997 17:11:05 -0600
From: "John Dubchak" <jdubchak@sprint.ca>
Subject: Searching question
Message-Id: <6504ps$1h80@top.MTS.Net>

I am trying to search a text file for a given string.  I am able to do this,
but what I want to do is retrieve an unspecified amount of information (i.e.
extract a value from an array into a scalar) up to a certain point.  For
instance, between two delimiters like [ and ].

Any suggestions as to how I may do this?

Thank you.




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

Date: 19 Nov 1997 20:00:44 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: sequence point?
Message-Id: <lq1200cjs5f.fsf@bmers2e5.nortel.ca>

"Michael A. Chase" <mchase@ix.netcom.com> writes:
> Bob Nelson wrote in message <64rg3j$2pl$1@renpen.nelson.org>...
> >Is the behaviour of ``$i = 3; $i = $i++'' ^(un|implementation-)*defined$
> >in Perl?
> I think you need to tell us more about what you're trying to do.  The
> code you've shown us assigns a value to $i then increments it by 1.  Is
> that what you intended?
> 
> The second assignment is not necessary, $i++ will (post) increment $i
> even without '$i ='.

I think this is just a request about "what about this wierd situation?"
"and that one?" well guess what... if you don't do it you'll never have
that problem :-)

Actually i couldn't guess which way it would go... but as someone previously
mentioned... $i = $i++ acts like:

   my $t = $i++;
   $i = $t;

So if $i started out 3, it ends out 3... you get the idea... If i was
a compiler... i would disallow this construct... similar to cyclic
dependencies or something :-) (no it's not the a cyclic dependency... no
more than $i = $i + 1, but i'd think perl -w should say "why the hell
would you want to do that?" :-) It's almost like saying:

     $i = 5;
     $i = 3;

??? :-)

mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


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

Date: 20 Nov 1997 02:29:52 GMT
From: "Bob Nelson" <bnelson@iname.com>
Subject: Re: sequence point?
Message-Id: <01bcf55c$14947040$d63427d1@Onramp.onairusa.com>

For those more interested in the ``practical'' side of Perl, be advised
that this posting deals with the ``pathologically eclectic'' aspect of the
language:

Mark Mielke <markm@nortel.ca> wrote in article
<lq1200cjs5f.fsf@bmers2e5.nortel.ca>...
> "Michael A. Chase" <mchase@ix.netcom.com> writes:
> > Bob Nelson wrote in message <64rg3j$2pl$1@renpen.nelson.org>...
> > >Is the behaviour of ``$i = 3; $i = $i++''
^(un|implementation-)*defined$
> > >in Perl?
> > I think you need to tell us more about what you're trying to do.  The
> > code you've shown us assigns a value to $i then increments it by 1.  Is
> > that what you intended?
> > 
> > The second assignment is not necessary, $i++ will (post) increment $i
> > even without '$i ='.
> 
> I think this is just a request about "what about this wierd situation?"

Yup. That's why the query was posed in the first place. The perl -w
diagnostics
are so good that I was halfway expecting some type of lint-like warning (or
a 
&rebuke at least, cf. Perl Camel 4). 
 
> Actually i couldn't guess which way it would go... but as someone
previously
> mentioned... $i = $i++ acts like:
> 
>    my $t = $i++;
>    $i = $t;
> 
> So if $i started out 3, it ends out 3... you get the idea... If i was
> a compiler... i would disallow this construct... similar to cyclic
> dependencies or something :-) (no it's not the a cyclic dependency... no
> more than $i = $i + 1, but i'd think perl -w should say "why the hell
> would you want to do that?" :-) It's almost like saying:

That other Perl-like language :) just places such things into the realm of
undefined behavior. Ain't nothing prevents use of ``i = i++'' from either
formatting the hard drive or causing Barry Switzer to write the new Linux
kernel. The straightforward ``i = i++'' can easily be hidden beneath
intervening code so that the sequence points aren't always easy to spot. 

While on the subject of Perl's behavior, is left-to-right evaluation order
_guaranteed_ in, say, a subroutine call such as the following:

	``sub_a(sub_b(params...), sub_c(params...), sub_d(params...));''


 


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

Date: Wed, 19 Nov 1997 20:21:05 -0500
From: Joe Gottman <joegottman@worldnet.att.net>
Subject: Re: Theory behind perl
Message-Id: <6503f8$gsf@mtinsc03.worldnet.att.net>

Sameer Kamruddin Merchant wrote:
> 
> Hi,
> I'm looking for some information about perl as a programming languages -
> things like what were the design goals, what features and policies (like
> binding and typing policies etc.) were added to the language to support
> these design goals, what are the drawbacks of perl as a programming
> language etc. I understand perl has had a long history over which it has
> evolved to what it is now. If there is some documentation about how perl
> has evolved and what influenced various modifications/ additions in perl
> as it evolved, that would be great. Pointers on white papers/technical
> reports about the language would help a lot.
> I'd highly appreciate any help in this regard.
> thanx.
> Sam.

   You might want to check out Advanced Perl Programming. It has a few
chapters 
on Perl internals.
-- 
Joe Gottman
joegottman@nospam.worldnet.att.net

[Remove nospam to reply]


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

Date: 19 Nov 1997 20:19:02 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: type glob error in FileHandle.pm
Message-Id: <lq1zpn0icqh.fsf@bmers2e5.nortel.ca>

nospam@ll.mit.edu (Joseph Scott Stuart) writes:
> Line 256 of the FileHandle.pm is the destructor method for FileHandle:
> sub DESTROY {
>     my ($fh) = @_;
>     close($fh);                       # line 256
> }

Anybody else ever got this problem? I have. I didn't have time to figure
it out either... so in one of my CGI's somewhere there is this code:

eval {
   ...
};
if ($@) {
    # Until i figure out where this error comes from...
    if ($@ !~ m#Not a GLOB reference at /opt/corp/local/perl-5.002/lib/FileHand
le.pm line 256#) {
        select $CGI->output("text/html");
        print "<b>Error:</b> $@\n";
    }
}
exit 0;

Sometimes... i get lazy too... :-) I do wish i knew where it came from, i'm
thinking perl5 has a bug in it's garbage collection... but i haven't reported
it before because i didn't spend very much time trying to find the problem.
It is reproducible... but i haven't yet looked for a minimal way to
reproduce it.

mark

NOTE: My case has to do with a hashed array containing an element where
      the value is a "FileHandle" object. My preliminary tests don't come
      up with anything though... darn..

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


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

Date: 20 Nov 1997 02:05:31 GMT
From: Zenin <zenin@best.com>
Subject: Re: type glob error in FileHandle.pm
Message-Id: <879991683.441526@thrush.omix.com>

Mark Mielke <markm@nortel.ca> wrote:
: nospam@ll.mit.edu (Joseph Scott Stuart) writes:
: > Line 256 of the FileHandle.pm is the destructor method for FileHandle:
	>snip<

	It's a bug in FileHandle.  Upgrade your perl.

	The new versions don't even have a destructor, nor do the old
	versions need the one that's there because (as the newer IO::Handle
	comments state) perl automaticly closes all it's filehandles
	at GC anyway.

: > sub DESTROY {
: >     my ($fh) = @_;
: >     close($fh);                       # line 256
: > }

	Nuke this, or better yet upgrade your perl.

: Anybody else ever got this problem?

	Yes, and upgrading fixes it.

: Sometimes... i get lazy too... :-) I do wish i knew where it came from, i'm
: thinking perl5 has a bug in it's garbage collection...

	Nope, it's a bug in the old FileHandle that always tryed to close()
	filehandles at DESTORY without checking to see if they ever got
	open()ed.

: It is reproducible... but i haven't yet looked for a minimal way to
: reproduce it.

	$ perl5.003 -w -MFileHandle -e 'my $foo = new FileHandle;'
	Close on unopened file <GEN0> at /usr/local/lib/perl5/FileHandle.pm line 255.

	Minimal enough? :-)

-- 
-Zenin
 zenin@best.com


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

Date: 20 Nov 1997 01:46:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Year2000 problem with localtime();
Message-Id: <6504qa$phb$1@comdyn.comdyn.com.au>

In article <8ck9e4a2qz.fsf@gadget.cscaper.com>,
	Randal Schwartz <merlyn@stonehenge.com> writes:
>>>>>> "Yen-Ming" == Yen-Ming Chen <chenym@dufu.math.ncu.edu.tw> writes:
> 
> Of course, this depends on what timezone you are in.  For me:
> 

# perl5
print scalar localtime 2 ** 31 - 1;
^D
Sat Dec 14 06:45:51 1901

Now that's a bit odd...

# printenv TZ
Australia/NSW

Hmmm, the time zone we are in has a offset of +10 hrs.. That probably
pushes us over the edge.

Ok, so we need a reverse logic here.
# perl5
print scalar localtime (2**31 - 1 - 10 *3600);
^D
Tue Jan 19 03:14:07 2038

Ah, now that is better. Looks like we have some extra time here :)

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 1345
**************************************

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