[18699] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 867 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 10 09:05:46 2001

Date: Thu, 10 May 2001 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <989499912-v10-i867@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 10 May 2001     Volume: 10 Number: 867

Today's topics:
    Re: 1 billion seconds bug (Gwyn Judd)
    Re: 1 billion seconds bug <bart.lateur@skynet.be>
    Re: 1 billion seconds bug (Malcolm Ray)
    Re: 1 billion seconds bug <pne-news-20010510@newton.digitalspace.net>
    Re: 1 billion seconds bug <pne-news-20010510@newton.digitalspace.net>
        ascii to html <lutz@imas-international.com>
    Re: ascii to html <pne-news-20010510@newton.digitalspace.net>
    Re: ascii to html (Rafael Garcia-Suarez)
        Cannot install perl-5.6.1: problem in "make test" (Georg Wittig)
    Re: cgi.pm problems <nobody@nowhere.net>
    Re: dbmopen and tie (Anno Siegel)
        extracting filenames <eng80956@nus.edu.sg>
    Re: extracting filenames <uri@sysarch.com>
    Re: Good editor for perl Use Scite ! (Fairlight)
        I *really* don't understand this error message... <koos_pol@nl.compuware.com.NOJUNKMAIL>
    Re: I *really* don't understand this error message... (Anno Siegel)
    Re: I *really* don't understand this error message... (Rafael Garcia-Suarez)
    Re: I *really* don't understand this error message... <koos_pol@nl.compuware.com.NOJUNKMAIL>
    Re: I *really* don't understand this error message... <skilchen@swissonline.ch>
    Re: Invoking Perl script from a web page <peter@dollshouse.com>
    Re: Invoking Perl script from a web page <bart.lateur@skynet.be>
    Re: Javascript or Perl ? <hafner-usenet@ze.tu-muenchen.de>
    Re: Javascript or Perl ? <bart.lateur@skynet.be>
    Re: Javascript or Perl ? <zlach@yahoo.com>
    Re: Javascript or Perl ? <godzilla@stomp.stomp.tokyo>
    Re: Javascript or Perl ? <godzilla@stomp.stomp.tokyo>
    Re: Local Time (Villy Kruse)
    Re: Local Time <pne-news-20010510@newton.digitalspace.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 10 May 2001 07:06:21 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: 1 billion seconds bug
Message-Id: <slrn9fkffb.b67.tjla@thislove.dyndns.org>

"mein Luftkissenfahrzeug ist voll von den Aalen"
said Craig Berry (cberry@cinenet.net) in 
<tfjnbgojdqj9b1@corp.supernews.com>:
>John Doe (jdoe@main.com) wrote:
>: Anyway I just want to share the kind of traps I fell into having to do
>: with this 1 billion seconds time point.
>
>We're probably going to be talking about this almost as much as good ol'
>y2k a couple of years ago.
>
>Quite soon now (specifically, Sun Sep 9 01:46:40 2001 GMT), the Unix epoch
>time (seconds since Jan 1 1970) will reach one billion.  This will

I just want to point out that as the resident .nz 'er that (assuming
there's noone from Fiji or the Cook Islands here) my Perl scripts will
break before all of y'all since I'm closest (numerically and lexically)
to the IDL. So, just look to me on the morning of september 9 to see what
problems are likely to ensue. Fortunately for the rest of you, .nz is
nuclear free, so you don't have to worry about any Government written
Perl scripts causing a nuclear holocaust (until China gets to that day
as well anyway).

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
QOTD:
	"I may not be able to walk, but I drive from the sitting posistion."


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

Date: Thu, 10 May 2001 09:14:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: 1 billion seconds bug
Message-Id: <31nkft8n1qrej3fmbnfg18qj94u37sv302@4ax.com>

flash wrote:

>That is weird my birthday is september 9th and i was born in the early
>morning some time close to that.

So it's all your fault!

>Im going back under my rock now.

Aha! You admit!



;-)

-- 
	Bart.


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

Date: 10 May 2001 10:17:47 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: 1 billion seconds bug
Message-Id: <slrn9fkqma.b3d.M.Ray@carlova.ulcc.ac.uk>

On Thu, 10 May 2001 07:06:21 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>"mein Luftkissenfahrzeug ist voll von den Aalen"
>said Craig Berry (cberry@cinenet.net) in 
><tfjnbgojdqj9b1@corp.supernews.com>:
>>John Doe (jdoe@main.com) wrote:
>>: Anyway I just want to share the kind of traps I fell into having to do
>>: with this 1 billion seconds time point.
>>
>>We're probably going to be talking about this almost as much as good ol'
>>y2k a couple of years ago.
>>
>>Quite soon now (specifically, Sun Sep 9 01:46:40 2001 GMT), the Unix epoch
>>time (seconds since Jan 1 1970) will reach one billion.  This will
>
>I just want to point out that as the resident .nz 'er that (assuming
>there's noone from Fiji or the Cook Islands here) my Perl scripts will
>break before all of y'all since I'm closest (numerically and lexically)
>to the IDL. So, just look to me on the morning of september 9 to see what
>problems are likely to ensue. Fortunately for the rest of you, .nz is
>nuclear free, so you don't have to worry about any Government written
>Perl scripts causing a nuclear holocaust (until China gets to that day
>as well anyway).

You may not have nukes, but you have Jocelyn Amon, notable Y2K
doomsayer who stirred things up in clpm in '99.  Will she try to milk
S1G too?
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: Thu, 10 May 2001 12:25:02 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: 1 billion seconds bug
Message-Id: <l1rkfto7djm48vjllhmk026cd9h3gtqe0q@4ax.com>

On Thu, 10 May 2001 07:06:21 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
wrote:

> I just want to point out that as the resident .nz 'er that (assuming
> there's noone from Fiji or the Cook Islands here) my Perl scripts will
> break before all of y'all since I'm closest (numerically and lexically)
> to the IDL.

AFAIK time() will return the same value at the same time everywhere in
the world, if your clock is correctly set. It's localtime() which
applies a timezone offset to the return value to give you hours,
minutes, and seconds. But if time() return 123456 in Auckland, it'll
be 123456 in London, New York, and Beijing as well.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Thu, 10 May 2001 12:26:17 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: 1 billion seconds bug
Message-Id: <34rkftcs2a7ctfqp25v8a3nd0gggs3j5hr@4ax.com>

On Thu, 10 May 2001 00:14:40 -0000, cberry@cinenet.net (Craig Berry)
wrote:

>                         Start your code reviews now -- avoid the
> last-second rush. :-)

And while you're at it, you might as well start thinking about what to
do when the year 2038 rolls around. Good to get a head start. (And no,
just recompiling things with time_t being a 64 bit integer won't help
if, for example, you have a binary protocol that specifies exactly
four bytes for the time.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Thu, 10 May 2001 09:12:33 +0200
From: "Christian Lutz" <lutz@imas-international.com>
Subject: ascii to html
Message-Id: <c6rK6.9$9x1.565@nreader1.kpnqwest.net>

Hello!

I need a perl-script, that ports ascii-files to html-files.

Know anyone here, where can I find this one?

cu

chris




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

Date: Thu, 10 May 2001 12:28:03 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: ascii to html
Message-Id: <m6rkfton8lvg1b4dqgklmj91nug4rkf1c5@4ax.com>

On Thu, 10 May 2001 09:12:33 +0200, "Christian Lutz"
<lutz@imas-international.com> wrote:

> I need a perl-script, that ports ascii-files to html-files.
> 
> Know anyone here, where can I find this one?

Here's one:

    perl -pe 'BEGIN {print "<html><head></head><body><pre>"}
              END   {print "</pre></body></html>"}'

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 10 May 2001 10:31:24 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: ascii to html
Message-Id: <slrn9fkri0.b8a.rgarciasuarez@rafael.kazibao.net>

Philip Newton wrote in comp.lang.perl.misc:
} On Thu, 10 May 2001 09:12:33 +0200, "Christian Lutz"
} <lutz@imas-international.com> wrote:
} 
} > I need a perl-script, that ports ascii-files to html-files.
} > 
} > Know anyone here, where can I find this one?
} 
} Here's one:
} 
}     perl -pe 'BEGIN {print "<html><head></head><body><pre>"}
}               END   {print "</pre></body></html>"}'

Doesn't work very well for text files that contains < and > characters.

perl -MHTML::Entities -lpe 'BEGIN { print"<html><head></head><body><pre>" }
                            END { print"</pre></body></html>" }
                            encode_entities $_'

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 10 May 2001 11:42:39 GMT
From: Georg.Wittig@gmd.de (Georg Wittig)
Subject: Cannot install perl-5.6.1: problem in "make test"
Message-Id: <9ddurf$5jj$1@hop.gmd.de>

Hi,

I have problems installing perl-5.6.1 which should be the newest
stable version according to CPAN. Symptom: "./Configure" and "make"
work fine, but "make test" produces the following error:

        base/cond............ok
        base/if..............ok
        base/lex.............FAILED at test 47
        Failed a basic test--cannot continue.
        make: *** [test] Error 29

As you can imagine, I hesitate to do a "make install" after this
error message. :-)

What I tried till now:

- built a shadow tree to the original 5.6.1 source tree (using
  "lndir")

- copied Policy.sh and config.sh from the 5.6.0 build tree

- ran "./Configure"

- ran "make"

- ran "make test"        ...kaboom...

- tried this on OSF1-4.0f (=Tru64) and Irix-6.5: same symptoms

- tried using the cc that comes with the respective OS and
  alternatively gcc-2.95.3: same symptoms

- tried different compiler optimization flags: same symptoms

- tried system malloc vs. perl malloc (in ./Configure): same symptoms

- tried running "./Configure" from the scratch (i.e. without old
  Policy.sh and config.sh files): same symptoms

- tried to comment out test #47 in t/base/lex.t: symptoms now appear
  in test #48

- tried to remove all the tests #47-51 in t/base/lex.t: symptoms now
  appear in the next test file t/base/pat.t .

Now I'm running out of ideas what to try next. :-) Never have had
similar problems with any older version of perl.

Is this a bug in 5.6.1, or did I do something wrong?

Thanks for your help,



-- 
	Georg Wittig, GMD			Georg.Wittig@gmd.de
Urteile über niemanden, bevor du nicht mindestens 3 Meilen in seinen
Schuhen gelaufen bist: 1. bist du dann 3 Meilen weg und 2. hast du
seine Schuhe.


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

Date: Thu, 10 May 2001 19:33:05 +0800
From: "alex" <nobody@nowhere.net>
Subject: Re: cgi.pm problems
Message-Id: <9ddtu8$l4$1@taliesin.netcom.net.uk>

it display me something like this on the broswer windows ,i mean ,in the
browsing windows

pragma : no-cache content-type:text/html
virtual clock
the time the house the day the month the year
the click boxes~~~~
the 12 or 24 radios
reset and submit

the problem is why would the pragma:no-cache will be printed on the browser
windows without braces as a header attribute


--
¢I!¡±o^
¥HÂù¤â¿v°_¿W¦æªº¹D¸ô
©ñ¨â²´¬ÝºÉ¥@¤WªºÁ¼Â÷
¦bÀHªi³v¬y¤¤®»ºò¥Í©Rªº¥t¤@¥b
©óÂŦ⪺¤ÑªÅ¤¤Äƨì¹Ð¥@ªººÉÀY
"David Efflandt" <see-sig@from.invalid> ¼¶¼g©ó¶l¥ó
news:slrn9fk0so.ih2.see-sig@typhoon.xnet.com...
> On Thu, 10 May 2001 09:57:54 +0800, ´Z©Ò¤ô@!¡±o^ <crud_alex@yahoo.com>
wrote:
> > i can't add "pragma=>'no-cache' into the header tag,otherwise it will
put up
> > the header information like normal text,but if i didn't put anything
into
> > the header attributes , it works just fine at all anyone give me a tip
i'll
> > be appreciated,thanks in advance
>
> What web server OS and CGI.pm version?  Are you going through a proxy?
> Your script works for Netscape 4.76 and KDE Konqueror in Linux apache.
> The headers I get from the commandline are:
>
> Pragma: no-cache
> Content-Type: text/html
>
> or grabbed as CGI with my urlcheck script:
>
> HTTP/1.1 200 OK
> Date: Thu, 10 May 2001 02:43:02 GMT
> Server: Apache/1.3.14 (Unix)  (SuSE/Linux)
> Pragma: no-cache
> Connection: close
> Content-Type: text/html
>
> I thought nothing was supposed to cache CGI anyway.  Wnen I remove the
> ({-pragma=>'no-cache'}), Netscape still does not cache it, but apparently
> Konqueror does.  If I click in the URL bar of Konqueror without the
> no-cache and hit enter, the display does not change, but with the
> no-cache it does change.
>
> Neither browser caches the result in any case using the "Set" (submit)
> button.
>
> > #!perl
> > #script: time4.pl
> >
> > use CGI ':standard';
> > use POSIX 'strftime';
> >
> > #print the HTTP header and the HTML document
> > print header({-pragma=>'no-cache'}),#i suppose not to #put anything
right
> > here
> >  start_html('A Virtual Clock'),
> >  h1('A Virtual Clock');
> >  print_time();
> >  print_form();
> >  print end_html;
> >
> > #print out the time
> > sub print_time {
> >  my($format);
> >  if (param){
> >   $format = (param('type') eq '12-hour') ? '%r' : '%T ' if
param('time');
> >   $format .= '%d ' if param('day');
> >   $format .= '%B ' if param('month');
> >   $format .= '%A ' if param('day-of-month');
> >   $format .= '^Y ' if param('year');
> >  } else {
> >   $format = '%r %A %B %d %Y';
> >  }
> >  $current_time = strftime($format,localtime);
> >  print "the current time is ",strong($current_time),".",hr;
> > }
> >
> > #print the clock settings form
> > sub print_form {
> >  print start_form,
> >   "show: ",
> >   checkbox(-name=>'time',-checked=>1),
> >   checkbox(-name=>'day',-checked=>1),
> >   checkbox(-name=>'month',-checked=>1),
> >   checkbox(-name=>'day-of-month',-checked=>1),
> >   checkbox(-name=>'year',-checked=>1),
> >   p(),
> >   "Time style: ",
> >   radio_group(-name=>'type',
> >    -values=>['12-hour','24-hour']),
> >   p(),
> >   reset(-name=>'Reset'),
> >   submit(-name=>'Set'),
> >   end_form;
> > }
> >
> >
>
>
> --
> David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
> http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/




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

Date: 10 May 2001 11:23:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: dbmopen and tie
Message-Id: <9ddtoc$qlp$2@mamenchi.zrz.TU-Berlin.DE>

According to Simon Stiefel  <SimonStiefel@nuclear-network.com>:
> On 7 May 2001, Anno Siegel wrote:
> 
> > According to Simon Stiefel  <SimonStiefel@nuclear-network.com>:
> > > Hi,
> > >
> > > I have to use "dbmopen" and "tie" at the same time (for a convert-script).
> > > But when I use the DB_File-module, dbmopen doesn't work.
> > > I need "DB_File" for "tie".
> >
> > Why do you think you need both?  I can't think of anything you can
> > do with dbmopen that can't be done with tie.
> 
> Because I have one database (*.pag & *.dir) which I want to make to a
> single file (like craeting a database with tie).

No, you misunderstand the relationship between dbmopen and tie.  The
structure of the database (which also governs whether it is stored in
a single file or in a .dir/.pag pair) is determined by the database
module you use:  DB_GDBM, DB_File, etc.  All of these can be used with
the deprecated dbmopen and the current tie.  There is no reason to use
both in one program.

Anno


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

Date: Thu, 10 May 2001 15:14:33 +0800
From: Murlimanohar Ravi <eng80956@nus.edu.sg>
Subject: extracting filenames
Message-Id: <191C91BDFE8ED411B84400805FBE794C0FB5D486@pfs21.ex.nus.edu.sg>

hi
i'm not sure how intelligent a question this is but here goes anyway:

how do i extract the names of all the files present in a particular
directory? i know how many files are present in the directory so is
there some way to use a while/for construct to read each file's name and
return them one by one?

grateful for any and all ideas.
cheers,
murli.



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

Date: Thu, 10 May 2001 08:12:32 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: extracting filenames
Message-Id: <x7snidbp0x.fsf@home.sysarch.com>

>>>>> "MR" == Murlimanohar Ravi <eng80956@nus.edu.sg> writes:

  MR> how do i extract the names of all the files present in a
  MR> particular directory? i know how many files are present in the
  MR> directory so is there some way to use a while/for construct to
  MR> read each file's name and return them one by one?

opendir and readdir are your friends.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: 10 May 2001 08:32:28 -0500
From: fairlite@iglou.com (Fairlight)
Subject: Re: Good editor for perl Use Scite !
Message-Id: <3afa8a5c$1_1@news.iglou.com>

On Wed, 09 May 2001 21:32:12 GMT, smilepak <smilepak@hotmail.com> wrote:
>Use CuteHTML!

Funny, I have no problems with vim in any environment...from linux to
solaris to cygwin to win95 native32.

mark->
-- 
Fairlight->   |||                                    | Fairlight Consulting
  __/\__      |||     "I'm talking for free,         |                     
 <__<>__>     |||      It's a New Religion..."       | http://www.fairlite.com
    \/        |||                 --Le Bon           | info@fairlite.com 


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

Date: Thu, 10 May 2001 13:12:59 +0200
From: Koos Pol <koos_pol@nl.compuware.com.NOJUNKMAIL>
Subject: I *really* don't understand this error message...
Message-Id: <9ddt2n$d5u@news.nl.compuware.com>


Can someone please explain why I get this error on the following code?
    print F foo();          #  gives "Hello world!"

Can't locate object method "F" via package "foo" at myscript.pl line 100.

I checked and double checked: F is a regular filehandle and is open for 
writing. I really fail to see the logic of the error message...


-- 
Koos Pol - Systems Administrator - Compuware Europe B.V. - Amsterdam
koos_pol@nl.compuware.com_NO_JUNK_MAIL



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

Date: 10 May 2001 11:38:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: I *really* don't understand this error message...
Message-Id: <9dduk8$qlp$4@mamenchi.zrz.TU-Berlin.DE>

According to Koos Pol  <.sig-news>:
> 
> Can someone please explain why I get this error on the following code?
>     print F foo();          #  gives "Hello world!"
> 
> Can't locate object method "F" via package "foo" at myscript.pl line 100.
> 
> I checked and double checked: F is a regular filehandle and is open for 
> writing. I really fail to see the logic of the error message...

Apparently foo isn't declared to be a sub when this point in compilation
is reached.  So Perl tries another interpretation using foo as a
package (class) name from which to draw the method F.  Note that
F could be a method name in foo and a filehandle in main at the same
time, so that it actually is a filehandle doesn't stop Perl from
trying this interpretation.

Just make sure that foo is defined (or at least declared by "sub foo")
before this point in compilation.

Anno


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

Date: 10 May 2001 11:43:01 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: I *really* don't understand this error message...
Message-Id: <slrn9fkvo8.bbo.rgarciasuarez@rafael.kazibao.net>

Koos Pol wrote in comp.lang.perl.misc:
} 
} Can someone please explain why I get this error on the following code?
}     print F foo();          #  gives "Hello world!"
} 
} Can't locate object method "F" via package "foo" at myscript.pl line 100.
} 
} I checked and double checked: F is a regular filehandle and is open for 
} writing. I really fail to see the logic of the error message...

perl thinks that you're calling a method foo::F, using the indirect
method call syntax (mainly used for OO Perl programming).

Rewrite this as :
  print F (foo());

Lookup "Method invocation" in perlobj for description of this syntax.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Thu, 10 May 2001 13:54:17 +0200
From: Koos Pol <koos_pol@nl.compuware.com.NOJUNKMAIL>
Subject: Re: I *really* don't understand this error message...
Message-Id: <9ddvg5$ei9@news.nl.compuware.com>

Anno Siegel wrote:

> According to Koos Pol  <.sig-news>:
> > 
> > Can someone please explain why I get this error on the following code?
> >     print F foo();          #  gives "Hello world!"
> > 
> > Can't locate object method "F" via package "foo" at myscript.pl line
> > 100.
> > 
> > I checked and double checked: F is a regular filehandle and is open for
> > writing. I really fail to see the logic of the error message...
> 
> Apparently foo isn't declared to be a sub when this point in compilation
> is reached.  So Perl tries another interpretation using foo as a
> package (class) name from which to draw the method F.  Note that
> F could be a method name in foo and a filehandle in main at the same
> time, so that it actually is a filehandle doesn't stop Perl from
> trying this interpretation.
> 
> Just make sure that foo is defined (or at least declared by "sub foo")
> before this point in compilation.
> 
> Anno


It works! Great work Anno, thanks a bunch :-)

-- 
Koos Pol - Systems Administrator - Compuware Europe B.V. - Amsterdam
koos_pol@nl.compuware.com_NO_JUNK_MAIL



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

Date: Thu, 10 May 2001 14:35:36 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: I *really* don't understand this error message...
Message-Id: <9de29g$hksc8$1@ID-13368.news.dfncis.de>

"Koos Pol" <koos_pol@nl.compuware.com.NOJUNKMAIL> wrote in
news:9ddt2n$d5u@news.nl.compuware.com...
>
> Can someone please explain why I get this error on the following
> code?
>     print F foo();          #  gives "Hello world!"
>
> Can't locate object method "F" via package "foo" at myscript.pl line
> 100.
>
> I checked and double checked: F is a regular filehandle and is open
> for writing. I really fail to see the logic of the error message...
>

This is one of the consequences of the fact that Perl lets you write
function/procedure applications without parens around the arguments.

Its the same thing as in:

#!perl -w
use strict;

print foo bar(); # Can't locate object method "foo" via package "bar"
 ...
#print foo(bar()); # -> bar

sub foo {
  my $bar = shift;
  return $bar;
}

sub bar {
  return "bar";
}
__END__


And its what the following excerpt from perldoc -f print probably
means:
  If FILEHANDLE is a variable and the next token is a term,
  it may be misinterpreted as an operator unless you
  interpose a `+' or put parentheses around the arguments.

The easiest remedy is to write
print F (foo());


If you have something similar to:

#!perl -w
use strict;

my $out_file = "out_file";

sub test {
  local(*F) = shift;
  print F foo() or die "print $!";
  # change that to
  # print F (foo()) or die "print $!";
}

sub foo {
  return "hallo\n";
}

open(F, ">$out_file") || die "can't write to $out_file: $!";
test(\*F);
close(F);
__END__

then putting parentheses around the arguments as described above will
indeed fix your problem.

There are many other possibilities such as using prototypes, making
sure that the subroutine definition is written lexically before the
subroutine is called, etc.




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

Date: Thu, 10 May 2001 09:18:31 +0100
From: "Peter Lowndes" <peter@dollshouse.com>
Subject: Re: Invoking Perl script from a web page
Message-Id: <tfkjiesfoka5cf@xo.supernews.co.uk>

I didn't realise returning an image could be done using so few lines of
code. It now works a treat.
Thanks everyone.





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

Date: Thu, 10 May 2001 10:42:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Invoking Perl script from a web page
Message-Id: <a2skftspc8u7nrrdujb4bf9ndcuirr93no@4ax.com>

Simon Flack wrote:

>Also use binmode() on the filehandle.
>
>I know it might not be necessary depending on your filesystem, but it won't
>hurt what you're doing at all and will make the script more portable.
>
>e.g.:
>print "Content-Type: image/gif\n\n";
>open IMAGE, "/path/pic.gif";
>binmode IMAGE;
>print while <IMAGE>;

Don't forget about binmode on STDOUT.

	print "Content-Type: image/gif\n\n";
	binmode STDOUT;

And I really don' t like that "print while <IMAGE>" bit, but since this
is intended to send just a small image anyway, it doesn't hurt.

-- 
	Bart.


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

Date: 10 May 2001 09:25:45 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: Javascript or Perl ?
Message-Id: <srjpudhis1y.fsf@w3proj1.ze.tu-muenchen.de>

"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:

> David H. Adler piddled:
>  
> >  Godzilla! asserted her dignity:
> > > David H. Adler whined:
> > > > Godzilla! wrote:
> > > > > Zlach wrote:
> 
> (snipped significantly)
> 
> > Why you see fit to respond to a small clarification with a personal
> > attack, I do not know.
>  
> I would not expect a person of your relative intellectual
> caliber to understand my words. Others do, however.

Yup. I think, I understand. Your words mean:

"Godzilla is a troll and wants to get killfiled".

Can be done. No problem here.

I lurk in this group for about 4 months now, asking the occasional
question etc. Up to now I thought all the comments about you here in the
group were exaggerated. But this reply to a perfectly right statement
does it. I know tons of "programmers" who don't know the difference
between Java and Javascript so I think this remark was indeed helpful to
a few readers.

Since I know that your followup will concentrate on my spelling and
grammar errors (Well, that's your style): Don't bother. Reply to this
posting in my native language (German) and I'll gladly help you with
your errors.

David: I find that Perl and Javascript fit together quite
well. Occasionally I program CGIs in Perl that build Javascript content
on the fly and send it out to the browser. If you're serious about
web-programming you should learn both together.

-Walter

PS: Just for Godzillas record: No, I'm not in high school (see prior
postings in ths thread). I got a PhD in computer science.


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

Date: Thu, 10 May 2001 09:18:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Javascript or Perl ?
Message-Id: <16nkfts2q0qratbmm5ipreh245frrka8fn@4ax.com>

Godzilla! wrote:

>> Just to make sure everyone's clear on this - Java and Javascript are two
>> distinct languages.

>So were you born anal retentive or is this a personal
>quality at which you work and strive to perfect?

It's not anal retentiveness. JavaScript *really* is totally unrelated to
Java. It's just that the designers of JavaScript wanted to profit from
the hype around Java at the time. Hence the name. It used to be
"LiveScript", and now the official name is "ECMAscript", I think.

-- 
	Bart.


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

Date: Thu, 10 May 2001 12:25:19 +0200
From: "Zlach" <zlach@yahoo.com>
Subject: Re: Javascript or Perl ?
Message-Id: <9ddqce$fto$1@ss204.hinet.hr>


> P.P.P.P.P.S. Google's newsgroups section is at http://groups.google.com

Thanks ! It really helps.

Zlach




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

Date: Thu, 10 May 2001 05:34:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Javascript or Perl ?
Message-Id: <3AFA8AB8.4487183D@stomp.stomp.tokyo>

Bart Lateur wrote:
 
> Godzilla! wrote:

(unnoted snippage by Lateur, context deliberately changed)
 
> >> Just to make sure everyone's clear on this - Java and Javascript are two
> >> distinct languages.
 
> >So were you born anal retentive or is this a personal
> >quality at which you work and strive to perfect?
 
> It's not anal retentiveness. JavaScript *really* is totally unrelated to
> Java. It's just that the designers of JavaScript wanted to profit from
> the hype around Java at the time. Hence the name. It used to be
> "LiveScript", and now the official name is "ECMAscript", I think.


et tu, Bozo?

Godzilla!


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

Date: Thu, 10 May 2001 05:46:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Javascript or Perl ?
Message-Id: <3AFA8D92.ADCD1B09@stomp.stomp.tokyo>

Walter Hafner aka Adler aka Lateur aka McClellan aka Ad Nauseam wrote:

> Godzilla! wrote:
> > David H. Adler piddled:
> > >  Godzilla! asserted her dignity:
> > > > David H. Adler whined:
> > > > > Godzilla! wrote:
> > > > > > Zlach wrote:

> > (snipped significantly)

(significantly snipped again)

> PS: Just for Godzillas record: No, I'm not in high school (see prior
> postings in ths thread). I got a PhD in computer science.




Right. I have tiny blue monkeys flying out of my big butt. It is
quite clear you are a proud graduate of the Sears, Roebuck and
Co. Academy of Language Arts, Frank.

Godzilla!


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

Date: 10 May 2001 08:54:40 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Local Time
Message-Id: <slrn9fklqf.us4.vek@pharmnl.ohout.pharmapartners.nl>

On Wed, 09 May 2001 20:44:03 GMT, Todd Smith <todd@designsouth.net> wrote:
>>
>> That's the spirit!  Don't accept that you might have made
>> a mistake.  And certainly don't learn from it.  Don't listen
>> to the experts.  Don't let good programming advice ruin your
>> pride and personal prestige.  And if they call you a "bad coder",
>> it is only because they don't know you personally.
>>
>> I'm sure.
>
>All he knows is that I use `date` instead 'localtime'. I don't think that
>makes me a bad coder. If you do, don't hire me.
>


It is the missing caveat that is the problem, I assume.  Sure you can
use `date` if such and such conditions are met, which also includes
that there actualy is a data command on the system and that the date 
command does what it is assumed be the programmer it does.

The bad programmer is the (hypothetical) programmer who reads about
the `date` solution and then start using without the required precautions.

And besides, the builtin procedure localtime is just as easy to use, and
most like more efficient, if that is an issue.



Villy


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

Date: Thu, 10 May 2001 11:52:27 +0200
From: Philip Newton <pne-news-20010510@newton.digitalspace.net>
Subject: Re: Local Time
Message-Id: <d5pkftogbk63uh2qbom4shtfh4pr6m9bt5@4ax.com>

On Wed, 09 May 2001 23:38:38 GMT, "Todd Smith" <todd@designsouth.net>
wrote:

> now this is a post I can learn from!

In de.* they call such posts as this one of yours "TOFU" (Text oben,
Fullquote unten).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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


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