[15811] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3224 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 21:05:40 2000

Date: Wed, 31 May 2000 18:05:17 -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: <959821516-v9-i3224@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 31 May 2000     Volume: 9 Number: 3224

Today's topics:
        [ANNOUNCE] Net::Telnet 3.02 release <jay@rgrs.com>
    Re: AAAARRRRGGHHH! Please help <lr@hpl.hp.com>
    Re: AAAARRRRGGHHH! Please help <lr@hpl.hp.com>
    Re: Activestate down? <srmalloy@home.com>
        ascii to char? <helza@planet.nl>
    Re: ascii to char? <tony_curtis32@yahoo.com>
    Re: ascii to char? <lr@hpl.hp.com>
    Re: Automated forms <peter@lberghold.net>
    Re: C to perl? <juex@deja.com>
    Re: C to perl? (brian d foy)
    Re: C to perl? (Abigail)
        Can't seem to find the Form post data <derekdangelo@earthlink.net>
    Re: Can't seem to find the Form post data <makarand_kulkarni@My-Deja.com>
    Re: Can't seem to find the Form post data <derekdangelo@earthlink.net>
    Re: CGI-scripts <peter@lberghold.net>
    Re: CGI-scripts <flavell@mail.cern.ch>
    Re: conditional ? not working as expected (Abigail)
        Filehandles guysmily@my-deja.com
    Re: Filehandles <bmb@ginger.libs.uga.edu>
        Generating object packages with classgen 3.01 <michael.schlueter@philips.com>
    Re: Getting the platform on which Perl is running akila@my-deja.com
    Re: Getting the platform on which Perl is running <flavell@mail.cern.ch>
    Re: How do I make perl flush? <philip@my-deja.com>
    Re: Is my string already in an array? (Abigail)
    Re: Julian Days <lr@hpl.hp.com>
    Re: Julian Days <abe@ztreet.demon.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 30 May 2000 00:25:45 -0400
From: Jay Rogers <jay@rgrs.com>
Subject: [ANNOUNCE] Net::Telnet 3.02 release
Message-Id: <lLhZ4.24112$v7.1381965@news-west.usenetserver.com>

A new version of Net::Telnet (3.02) has been upload to CPAN.  It
contains minor bug fixes.

Here's the most relevant lines from the changelog:

        * Telnet.pm : Squelched silly warning introduced by perl5.005

        * Telnet.pm : Fixed incorrect handling of CR LF when chars are
        sent in separate blocks.

        * Telnet.pm : Modified log routines to accept a tied filehandle.


Here's the README:


  What's In It For You
  --------------------

   .  You'd like to communicate with another host or device via a
      TELNET port and you'd like some specialized routines to help you
      login and do other interactive things.

   .  You're not familiar with sockets and you want a simple way to
      make client connections to TCP services.

   .  You want to be able to specify your own time-out while
      connecting, reading, and writing.

   .  You're communicating with an interactive program at the other
      end of some socket or pipe and you want to wait for certain
      patterns to appear.


  Archive Location
  ----------------

    .  In the CPAN directory: modules/by-module/Net/

    .  To find a CPAN site near you see http://cpan.perl.org/SITES.html


  Prerequisites
  -------------

    .  Perl Version 5.002 or later

    .  A Windows 95/NT machine requires Perl version 5.003_07 or later

    .  No other modules are required that don't already come with a
       standard distribution of Perl.


  Description
  -----------

    Net::Telnet allows you to make client connections to a TCP port
    and do network I/O, especially to a port using the TELNET
    protocol.  Simple I/O methods such as print, get, and getline are
    provided.  More sophisticated interactive features are provided
    because connecting to a TELNET port ultimately means communicating
    with a program designed for human interaction.  These interactive
    features include the ability to specify a timeout and to wait for
    patterns to appear in the input stream, such as the prompt from a
    shell.

    Here's an example that prints who's logged-on to the remote host
    sparky.  In addition to a username and password, you must also
    know the user's shell prompt, which for this example it's bash$

        use Net::Telnet ();
        $t = new Net::Telnet (Timeout => 10,
                              Prompt => '/bash\$ $/');
        $t->open("sparky");
        $t->login($username, $passwd);
        @lines = $t->cmd("/usr/bin/who");
        print @lines;

    See the user documentation for more examples.  Also see the user
    documentation for the section "What To Know Before Using".

    Usage questions should be directed to the Usenet newsgroup
    comp.lang.perl.modules.

    Contact me, Jay Rogers <jay@rgrs.com>, if you find any bugs
    or have suggestions for improvement.


  Documentation
  -------------

    User documentation in POD format is contained within the module
    source (i.e. the .pm file).  Installing using "make install"
    places this documentation in a man page in the perl library under
    the directory "man/man3".

    To nicely format the documentation for printing, you may use
    "groff" to convert to postscript.  Groff is available under
    the GNU General Public License (GPL) and is installed on most
    Linux machines.

        pod2man Net/Telnet.pm | groff -man -Tps > Net::Telnet.ps


  Installation
  ------------

    To install, cd to the directory containing the unpacked
    distribution and do one of the following:

    a.  Create a makefile by running Makefile.PL using the perl
        program into whose library you want to install and then run
        make three times:

            perl Makefile.PL
            make
            make test
            make install

    b.  To install into a private library, for example your home
        directory:

            perl Makefile.PL \
                 INSTALLSITELIB=$HOME/lib/perl \
                 INSTALLMAN3DIR=$HOME/lib/perl/man/man3
            make
            make test
            make pure_install

    c.  Alternatively, you can just copy or move Telnet.pm
        from the distribution into a directory named Net/ in the Perl
        library.  You can then manually build the documentation using
        pod2man or pod2html.

--
Jay Rogers
jay@rgrs.com
May 27, 2000






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

Date: Wed, 31 May 2000 15:44:55 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: AAAARRRRGGHHH! Please help
Message-Id: <MPG.139f35bf40fab2ba98ab12@nntp.hpl.hp.com>

In article <8h3u7v$8jg37@mx2.hrz.uni-essen.de> on Wed, 31 May 2000 
22:57:17 +0200, Herr Stumpfenstiel <herr_stumpfenstiel@lycosmail.com> 
says...
> Hmm, we should close the file, shouldn't we?
> 
> #!/usr/bin/perl -w
> use strict;
> open INPUT, 'buh.data' or die "Couldn't open buh.data. $!\n";
> while (<INPUT>) {
>   print m!^[/ ]! ? "Unknown\n" : $_;
> }
> close INPUT;

Why?  What do you expect to happen when the program finishes execution?

You *need* to close a file if it is to be used before execution 
terminates, especially on systems that cannot rename or unlink open 
files (such as Windows/DOS).

You might want to close a file for logical clarity (close right after 
finishing the writing, for example), or simply to free up the resources 
used by the open file.

You surely want to close a file that is a pipe, so you can check for 
successful execution.

The case in question here is trivial, and none of the above.

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


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

Date: Wed, 31 May 2000 15:45:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: AAAARRRRGGHHH! Please help
Message-Id: <MPG.139f35ffcf9825ed98ab13@nntp.hpl.hp.com>

In article <39357FB0.7BD64390@attglobal.net> on Wed, 31 May 2000 
17:10:08 -0400, Drew Simonis <care227@attglobal.net> says...
> > 
> > No, that was the third error.
> > 
> > 1.  No '-w' flag.
> > 
> > 2.  No 'use strict;'.
> > 
> > 3.  No check for failure to open the file.
> > 
> I thought you were indicating the () to open as an outdated 
> syntax as the 3rd error.

Hardly.  It is a question of style and taste, as I clearly said:

> > > The parenthesizing of the open() statement is up to you.  

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


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

Date: Wed, 31 May 2000 23:32:08 GMT
From: Sean Malloy <srmalloy@home.com>
Subject: Re: Activestate down?
Message-Id: <wKA1Oa6uVk+IaLqRT2m5QtMqFHTP@4ax.com>

glauber <glauber.ribeiroNOglSPAM@experian.com.invalid> wrote:
>I haven't been able to access http://www.activestate.com since
>yesterday. Is it down or am i having network problems?

I got to it today, although I got interrupted by the path from the
host I was on to their machine going down. I was able to reconnect
later and get everything I needed.

-- 
Sean R. Malloy               | American Non Sequitur
    Naval Medical Center     |       Society
    San Diego, CA 92134-5000 |
srmalloy@home.net            | "We may not make sense,
srmalloy@nmcsd.med.navy.mil  |  but we do like pizza"
FORMAL NOTICE: unsolicited commercial email will be read
at a charge of $500 per item. Receipt of such email shall
be considered to constitute acceptance of contract, and 
will be billed immediately.


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

Date: Thu, 1 Jun 2000 00:05:04 +0200
From: "Helza" <helza@planet.nl>
Subject: ascii to char?
Message-Id: <8h42f3$81ghp$1@reader1.wxs.nl>

Well this is probably a stupid question but i have the problem that i need
to convert characters into ascii nr's en later turn them back in
characters..

no i succeeded into making a character into ascii with the ord() but how do
i get a ascii nr back into a charcter? :)

and the second question is if i have a string lets say
$word = "hello";
and i want to convert all characters 1 by 1 into a ascii nr how do i point
to
the 1st and 2nd character etc? i tryed using $word[1] but that doesn't work.

Any help would be very greatfull :)


Greetings Helza








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

Date: 31 May 2000 17:14:30 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: ascii to char?
Message-Id: <877lcas6yh.fsf@limey.hpcc.uh.edu>

>> On Thu, 1 Jun 2000 00:05:04 +0200,
>> "Helza" <helza@planet.nl> said:

> Well this is probably a stupid question but i have the
> problem that i need to convert characters into ascii
> nr's en later turn them back in characters..

> no i succeeded into making a character into ascii with
> the ord() but how do i get a ascii nr back into a
> charcter? :)

And "perldoc -f ord" says...

       ord EXPR
       ord     Returns the numeric (ASCII or Unicode) value of
               the first character of EXPR.  If EXPR is omitted,
               uses `$_'.  For the reverse, see the chr entry
               elsewhere in this document.  See the utf8 manpage
               for more about Unicode.

-- 
"Trying is the first step towards failure"
                                           Homer Simpson


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

Date: Wed, 31 May 2000 15:57:58 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: ascii to char?
Message-Id: <MPG.139f38d0f5307bd598ab15@nntp.hpl.hp.com>

In article <8h42f3$81ghp$1@reader1.wxs.nl> on Thu, 1 Jun 2000 00:05:04 
+0200, Helza <helza@planet.nl> says...
> Well this is probably a stupid question but i have the problem that i need
> to convert characters into ascii nr's en later turn them back in
> characters..
> 
> no i succeeded into making a character into ascii with the ord() but how do
> i get a ascii nr back into a charcter? :)

  perldoc -f chr

> and the second question is if i have a string lets say
> $word = "hello";
> and i want to convert all characters 1 by 1 into a ascii nr how do i point
> to
> the 1st and 2nd character etc? i tryed using $word[1] but that doesn't work.

  perldoc -f unpack

(and look at the 'C' format specifier in `perldoc -f pack`, particularly 
'C*')

If you insist on manipulating a character at a time for some reason 
(like writing C code in Perl, for no good reason), then

  perldoc -f substr

or

  perldoc -f split (and use a null pattern, //)

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


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

Date: Wed, 31 May 2000 23:33:46 GMT
From: Peter L. Berghold <peter@lberghold.net>
Subject: Re: Automated forms
Message-Id: <ujhZ4.103481$R4.600932@news1.rdc1.nj.home.com>

In article <8h35gq$gpn$1@uranium.btinternet.com>, "GARY JACKSON" <gary.jackson5@btinternet.com> wrote:
> Is there any way to automate this process, so that once the FORM is
> submitted, the information is added to the table in the webpage ?	
> 
> 


What have you tried so far? Seems to me that you should be able to store the table elements in a file and then regenerate the html page after appending the information to the file.



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

Date: Wed, 31 May 2000 15:17:55 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: C to perl?
Message-Id: <39358f97@news.microsoft.com>

"brian d foy" <brian@smithrenaud.com> wrote in message
news:brian-ya02408000R3105001649120001@news.panix.com...
> In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com> posted:
>
> > Can anyone tell me how to translate a C program to perl? Or where can I
> > get c2perl?
>
> there are things that you can do in C that you can't do in Perl.
[...]

That's not right.
Perl and C are both Turing languages, therefore you can do exactly the same
things in both languages (or pretty much in any programming language).
The question is more if some concept is native to a particular language and
therefore easy to use or if you have to work-around or even abuse some other
language feature in order to simulate a specific feature.

jue




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

Date: Wed, 31 May 2000 19:58:00 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: C to perl?
Message-Id: <brian-ya02408000R3105001958000001@news.panix.com>

In article <39358f97@news.microsoft.com>, "Jürgen Exner" <juex@deja.com> posted:

> "brian d foy" <brian@smithrenaud.com> wrote in message
> news:brian-ya02408000R3105001649120001@news.panix.com...
> > In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com> posted:
> >
> > > Can anyone tell me how to translate a C program to perl? Or where can I
> > > get c2perl?
> >
> > there are things that you can do in C that you can't do in Perl.

> That's not right.
> Perl and C are both Turing languages, therefore you can do exactly the same
> things in both languages (or pretty much in any programming language).

allocate memory in Perl.  i dare you.

i didn't say that they couldn't accomplish the same tasks, though.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: 1 Jun 2000 00:00:25 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: C to perl?
Message-Id: <8h492p$5et$1@news.panix.com>

On Wed, 31 May 2000 15:17:55 -0700, Jürgen Exner <juex@deja.com> wrote:
++ "brian d foy" <brian@smithrenaud.com> wrote in message
++ news:brian-ya02408000R3105001649120001@news.panix.com...
++ > In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com> posted:
++ >
++ > > Can anyone tell me how to translate a C program to perl? Or where can I
++ > > get c2perl?
++ >
++ > there are things that you can do in C that you can't do in Perl.
++ [...]
++ 
++ That's not right.
++ Perl and C are both Turing languages, therefore you can do exactly the same
++ things in both languages (or pretty much in any programming language).
++ The question is more if some concept is native to a particular language and
++ therefore easy to use or if you have to work-around or even abuse some other
++ language feature in order to simulate a specific feature.


But that's an argument that's pointless when discussing translations,
because you cannot determine from the program source what it will
output, without running it. (After all, if you could, you could solve
the halting problem.)

Just *knowing* that there is an equivalent Perl program to every C
program doesn't make you can find it.

Of course, if there would be no bugs in perl, it's trivial to come with
a C program that has no Perl equivalent. Just write a C program that
generates a segmentation fault. ;-)


Abigail


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

Date: Thu, 01 Jun 2000 00:29:46 GMT
From: "Derek Dangelo" <derekdangelo@earthlink.net>
Subject: Can't seem to find the Form post data
Message-Id: <_7iZ4.6154$MY6.139988@newsread2.prod.itd.earthlink.net>

I've built a simple form that with
    <form method="post" name="name" action="action.pl">
then I have a select list
    print '<select name="select_list" size=5>';
        foreach $item(@selectlist)
        { print '<option value=',$song,'>',$song,'</option>';}
    print '</select>';
and my input line is this..
    print '<input type="submit" value="Submit">';

I've tried every which way in action.pl to find and print the submited
information, but I get nothing.

where does the posted information hide?

Thanks
derek@ccil.org




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

Date: Wed, 31 May 2000 17:43:28 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Can't seem to find the Form post data
Message-Id: <3935B1B0.588E4A90@My-Deja.com>

>
> where does the posted information hide?

Read the CGI faq.




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

Date: Thu, 01 Jun 2000 00:59:57 GMT
From: "Derek Dangelo" <derekdangelo@earthlink.net>
Subject: Re: Can't seem to find the Form post data
Message-Id: <hAiZ4.6344$MY6.141232@newsread2.prod.itd.earthlink.net>

mostly, my trouble stems from not being able to use CGI->param(), I get an
'unknown function' error.

I've included cgi.pm with a couple of directives
use cgi qw(:standard) and require "cgi.pm"
I can use other functions from cgi.pm, just not the elusive param(), which
from reading the group here (and the documentation) seems to be the simplest
way to gather those elusive vars.  (oh, also vars() was disliked by my
server)

I am a perl newbie, am I missing a library option with my use cgi directive?

ps (do you have the url for the cgi faq?)

"Makarand Kulkarni" <makarand_kulkarni@My-Deja.com> wrote in message
news:3935B1B0.588E4A90@My-Deja.com...
> >
> > where does the posted information hide?
>
> Read the CGI faq.
>
>
>




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

Date: Wed, 31 May 2000 23:52:25 GMT
From: Peter L. Berghold <peter@lberghold.net>
Subject: Re: CGI-scripts
Message-Id: <ZAhZ4.103525$R4.601602@news1.rdc1.nj.home.com>

In article <01bf8912$9e07ef40$0100007f@alexey>, "Alexey Dibrivniy" <alexey@selena.kherson.ua> wrote:

> Please, who knows how to make a downloads counter (or even usual visits or
> clicks counter) script in Perl, send me a sample. And are there any
> programs for debugging scripts ?
> 
> Thank you very much for your help.

Try doing a web search on "counter scripts" or "Matts Free Script" and you'll run into l
loads of them free for the downloading.

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



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

Date: Thu, 1 Jun 2000 02:32:47 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI-scripts
Message-Id: <Pine.GHP.4.21.0006010225380.27128-100000@hpplus01.cern.ch>

On Wed, 31 May 2000, Peter L. Berghold wrote:

> Try doing a web search on "counter scripts" or "Matts Free Script"
> and you'll run into l loads of them free for the downloading.

Seems as if counters have got to be such a big yawn that hardly
anyone's bothering to post the routine cautions against cargo-cult
code.

I'd feel a lot safer checking some of Randal's WebTechniques columns
to make sure I got the locking right.  Well, to be honest I _did_
check Randal's columns to make sure I got the locking right, although
it actually wasn't a counter I was implementing (it was a contest
score, for a student demonstration).

p.s the last time it was run, they had about four times as many
simultaneous contestants than had been planned - they even opened an
overflow PC pool - it brought the web server to its knees - but the
score file remained intact.  So it looks as if the locking was
working, in practice and not only in theory ;-)




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

Date: 31 May 2000 22:15:35 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: conditional ? not working as expected
Message-Id: <8h42u7$3hi$2@news.panix.com>

On Wed, 31 May 2000 11:25:08 GMT, mike cardeiro <mcardeiro@yahoo.com> wrote:
++ hi
++ 
++ I have an array @keys that has 16 elements in it.
++ 
++ why does the following code print 20, it should(i thought) print 0
++ 
++ (@keys < 26)?$y=0:$y=20;
++ print "$y\n";


Precedence.

= has lower precedence than ?:.



Abigail


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

Date: Wed, 31 May 2000 22:07:26 GMT
From: guysmily@my-deja.com
Subject: Filehandles
Message-Id: <8h42eo$s1j$1@nnrp1.deja.com>

Do anyone know how to put file handles into an array? It seems simple
enough. For example:
I want to create a bunch of files (FILE1, FILE2, FILE3) and print the
same thing to all of them.

From Cookbook:
foreach $filehandle(@FILEHANDLES) {
      print $filehandle "stuff";
}

How do you get the filehandles into the array in the first place, or
how do you define the filehandles and the paths also in the array?

Thanks



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 31 May 2000 18:26:46 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Filehandles
Message-Id: <Pine.A41.4.21.0005311826100.13070-100000@ginger.libs.uga.edu>

On Wed, 31 May 2000 guysmily@my-deja.com wrote:

> Do anyone know how to put file handles into an array? It seems simple
> enough. For example:
> I want to create a bunch of files (FILE1, FILE2, FILE3) and print the
> same thing to all of them.
> 
> From Cookbook:
> foreach $filehandle(@FILEHANDLES) {
>       print $filehandle "stuff";
> }
> 
> How do you get the filehandles into the array in the first place, or
> how do you define the filehandles and the paths also in the array?
> 
> Thanks


This is a FAQ.  You'll find the answer there.

-- 
Brad



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

Date: Wed, 31 May 2000 16:18:13 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Generating object packages with classgen 3.01
Message-Id: <BLhZ4.24113$v7.1382732@news-west.usenetserver.com>

Class::Classgen::classgen V3.01 is just uploading to CPAN. Best access it
via

    http://search.cpan.org    (classgen)

or http://search.cpan.org/doc/MSCHLUE/Class-Classgen-classgen-3.01/

This script increased my programming efficiency considerably. It is not
perfect, yet. Please let me know your suggestions.

Michael Schlueter

=========== README ===================

Classgen-3.01      (5/2000)


Simplifies creation, manipulation and usage of complex objects.

classgen is a script that allows you to create a Perl-object from
a simple control-file. In the control file you basically specify
the internal instance-variables this object should have. classgen
then generates ASCII-source code (package) for you, which contains:

 * a new() - method with the variables blessed to an {}
 * accessor- and manipulator-methods for all these variables
 * a specific() - method; it serves as a skelton for you to
   edit further object-specific methods as you need them
 * a perldoc-skelton at the end


This way you can fully focus on what your object should be doing. No
need to bother around with instance-variables.

To install classgen 'gunzip' and 'tar xvf' the .gz file in a directory
of your choice. Next run from this directory:

 perl Makefile.PL
 make
 make install (as root)

There are a few examples in examples/ which include how to extend the
generated object for inheritance from base-classes.


In the spirit of UML,

Michael Schlueter email: mschlue@cpan.org










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

Date: Wed, 31 May 2000 22:15:48 GMT
From: akila@my-deja.com
Subject: Re: Getting the platform on which Perl is running
Message-Id: <8h42ud$s6h$1@nnrp1.deja.com>

What about NT? It does not recognise the uname command. How can you
tell if a perl script is running in a unix/nt platform. Is there 1
variable/function that you can use?
In article <u9wvl4g9d3.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:
> [ Please put your comments following the quoted text that you
>   are commenting on.  Jeopardectomy performed.                   ]
>
> "Jason Malone" <jamalone@earthlink.net> writes upside down:
>
> > "Hans Scholte" <hans@salience.nl> wrote in message
> > news:3916a10d.12672762@news.nl.net...
>
> > > Does anybody know if there is a way (a standard function or some
> > > predefined variable) to ask Perl on what platform it is running?
>
> Have you considered looking at the list of predefined varables?  It is
> not exactly long - surely is would be quicker to read it than post to
> Usenet asking if it contains something?
>
> > If it is on a Unix system you should be able to do something like
> >
> > $OS = `uname`;
> > print $OS;
>
> Usually $^O is enough.
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 1 Jun 2000 00:40:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Getting the platform on which Perl is running
Message-Id: <Pine.GHP.4.21.0006010037130.25782-100000@hpplus01.cern.ch>

On Wed, 31 May 2000 akila@my-deja.com wrote:

> What about NT? It does not recognise the uname command.

and then quotes an extensive history of the thread, including sigs,
but in particular these key lines:

> > > $OS = `uname`;
> > > print $OS;
> >
> > Usually $^O is enough.

This is the thing about upside-down quoters, they never seem to read
what they're quoting.  I'm seriously considering killfiling the lot of
them.



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

Date: Thu, 01 Jun 2000 00:47:58 GMT
From: Fearless <philip@my-deja.com>
Subject: Re: How do I make perl flush?
Message-Id: <8h4brs$22n$1@nnrp1.deja.com>

In article <39360083.2003334@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:
> Close the file. Explicitely.

Der.

close(what)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 31 May 2000 23:05:01 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Is my string already in an array?
Message-Id: <8h45qs$4ms$1@news.panix.com>

On Wed, 31 May 2000 09:35:16 -0700, Roy <royNOroSPAM@england.com.invalid> wrote:
++ 
++ I'm looking for the best way to check if the value of my string
++ is equal to any of the elements in an array. I can think of a
++ couple of ways of doing this, by individually checking each
++ element against the string, or by join-ing the array into a big
++ string and searching for the target string using index. However
++ both of these seem a little cumbersome. Is there a more
++ efficient way I'm missing?


Yes. It's called the FAQ.


Abigail


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

Date: Wed, 31 May 2000 15:52:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Julian Days
Message-Id: <MPG.139f3778a0cb1df098ab14@nntp.hpl.hp.com>

In article <393584B6.F896537B@coaps.fsu.edu> on Wed, 31 May 2000 
17:31:34 -0400, Stacey Campbell <campbell@coaps.fsu.edu> says...
> Does anyone have a routine for determining the Julian Day/
> day_of_the_year?
> 
> You see, localtime(time) gives 100 as the year (99 + 1), which must be
> modified to 2000 in order to determine if it's a leap year.  You have to
> determine if it is a leap year, because if it is, you have to then add 1
> to the yday that localtime(time) returns.

Not at all.  What a strange idea!  Have you written any code that 
demonstrates that need?

localtime() knows all about leap years, and gives the correct value for 
yday under all circumstances.

> So you see, localtime(time) is not very efficient.

What evidence do you have for that observation?  Efficient compared to 
what?

>                                                     Because of these
> problems, I'm worried about depending on localtime() to create my Julian
> Day file names automatically here at work.  It could screw up data
> retrieval, file creation, and in general, data could be lost or written
> over.

Paranoia.

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


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

Date: Thu, 01 Jun 2000 01:17:57 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Julian Days
Message-Id: <b77bjssgnnilu063i78m2663f6a78h7cgm@4ax.com>

On Wed, 31 May 2000 17:31:34 -0400, Stacey Campbell
<campbell@coaps.fsu.edu> wrote:

> You see, localtime(time) gives 100 as the year (99 + 1), which must be
> modified to 2000 in order to determine if it's a leap year.  You have to
> determine if it is a leap year, because if it is, you have to then add 1
> to the yday that localtime(time) returns.
Not in my version:

#!/usr/bin/perl -w
use strict;
use Time::Local;

my %test = (
	19990228 => timelocal(0, 0, 0, 28, 1, 1999), #Feb 28 1999
	19990301 => timelocal(0, 0, 0, 01, 2, 1999), #Mar 1  1999
	20000228 => timelocal(0, 0, 0, 28, 1, 2000), #Feb 28 2000
	20000301 => timelocal(0, 0, 0, 01, 2, 2000), #Mar 1  2000
);

printf "%s: yday=%d\n", scalar localtime($test{$_}),
	(localtime($test{$_}))[7] for sort keys %test;


-- 
Good luck,
Abe


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3224
**************************************


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