[17558] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4978 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 28 14:05:47 2000

Date: Tue, 28 Nov 2000 11:05:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975438323-v9-i4978@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 28 Nov 2000     Volume: 9 Number: 4978

Today's topics:
    Re: (no subject) (Flint Slacker)
    Re: basic keys question (Tad McClellan)
    Re: basic keys question <mischief@velma.motion.net>
        Can anyone help me with this script??? <patelro@viacode.com>
    Re: Can anyone help me with this script??? (Flint Slacker)
        Capturing a pty for spawned processes? <scastell@sas.upenn.edu>
    Re: Capturing a pty for spawned processes? nobull@mail.com
    Re: checking variable type <iltzu@sci.invalid>
    Re: checking variable type nobull@mail.com
    Re: Counting Asian characters in text <b_nospam_ill.kemp@wire2.com>
        Encrypting passwords <rob@frii.com>
    Re: Encrypting passwords <nickco3@yahoo.co.uk>
    Re: Encrypting passwords (Prasanth A. Kumar)
    Re: Encrypting passwords <mischief@velma.motion.net>
    Re: Encrypting passwords nobull@mail.com
        Finding current time. <loch@uci.edu>
    Re: Finding current time. <tony_curtis32@yahoo.com>
        flypages <chuckwilliams1@netscape.net>
    Re: for loop: brackets make any difference? <iltzu@sci.invalid>
    Re: for loop: brackets make any difference? (David Wall)
    Re: for loop: brackets make any difference? nobull@mail.com
        HHHHEEEELLLLLPPPPPPPPPPPPP!!!!!! ("-")
    Re: How do you install packages manually without PPM (A <jeff@vpservices.com>
        How do you install packages manually without PPM (Activ <leefw@c2i.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Nov 2000 16:16:42 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: (no subject)
Message-Id: <3a2ada64.71119634@news.tcn.net>


use Image::Size;

Flint

On Tue, 28 Nov 2000 04:56:43 +0800, jin zengxiang <jingzx@sinaman.com>
wrote:

>Hi,there:
>I want to develop a personal image search engineering that can "borrow"
>the images I want to my local disk ,but I
>found that many images are not really useful because the size of them is
>too small ,so does any one know how to
>determine the image size by perl modules? thanks very much.
>
>Rgds ,
>Alan Jin Z.X.



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

Date: Tue, 28 Nov 2000 08:55:05 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: basic keys question
Message-Id: <slrn927e9p.i1q.tadmc@magna.metronet.com>

nougat <kulabocca69@hotmail.com> wrote:

>Subject: basic keys question
          ^^^^^


You might expect that "basic" Questions are Asked Frequently.

And you would be right!

So you should try to find (it is already on your hard disk!)
a Frequently Asked Question (FAQ) where it has already been
asked and answered many times over.

You are required to check the FAQs for Perl *before* posting
to the Perl newsgroup anyway, even if you don't think your
question is "basic". Some complicated Questions are also
Asked Frequently.

You can search for words in Questions from the Perl FAQs with
the -q option to 'perldoc' program (that comes with the perl
distribution):

   perldoc -q hash

   "How can I always keep my hash sorted?"

( "sorted" means "ordered" )


>I'm in need of some clarification as to the order in which the keys operator
>unwinds a hash when used in a foreach loop.


There _is no_ order that is usable by the Perl programmer.


>What I'm trying to accomplish is some way to
>initialize the hash so that I can return the keys in a predictable order.


"a predictable order" is not the same as 
"in the order that they were put into the hash".

sort()ing the keys _does_ provide "a predictable order".

So there is no "predictable order" problem at all!


>I understand that hashes access key/value pairs randomly, but I have also
>read that the keys operator is supposed to unwind the elements "in order",
>i.e. first key first, etc.


Yes, but the "order" is determined by the hashing algorithm.

Since the hashing algorithm can change with a new release of
perl, depending on it makes your code very fragile.

So don't depend on it :-)


>When I preface the keys operator with the sort operator, all is fine, as
>they're returned sorted alphabetically. 


See? Getting a predictable order is not hard at all.


>However, not every instance in which
>I need to do something like this can be resolved that way.


Can you give one instance as an example?

If you want "in the order that they were put into the hash", you
can do it as below, but it requires discipline to keep things
in sync. This approach is very error-prone, and is not recommended.
Much better to have the "order maintaining" stuff handled for
you automatically (like the answers in the FAQ do).

You can maintain an @array with the keys in the "as entered" order
for the corresponding hash. 

   $hash{foo} = $something;
   push @ordered_keys, 'foo';

   $hash{bar} = $something_else;
   push @ordered_keys, 'bar';

   ...

   foreach my $key ( @ordered_keys ) {
      print $hash{$key};
   }


But, let me say one more time, do not do it that way!


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


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

Date: Tue, 28 Nov 2000 17:19:24 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: basic keys question
Message-Id: <t27q8slvu8or52@corp.supernews.com>

nougat <kulabocca69@hotmail.com> wrote:
> Hi,

Hullo.

> I'm in need of some clarification as to the order in which the keys operator
> unwinds a hash when used in a foreach loop.

According to hash order.

> When I do this, the first value assigned to $field_key is "WIN", not "REG".
> The debugger shows the values of  %fields in the order in which they were
> assigned when initialized. What I'm trying to accomplish is some way to
> initialize the hash so that I can return the keys in a predictable order.

You could index into the hash with key names stored in an array, or
maybe even use and array in the first place.

> I understand that hashes access key/value pairs randomly, but I have also
> read that the keys operator is supposed to unwind the elements "in order",
> i.e. first key first, etc.

Yes, in a sense. That order is hash order.

> When I preface the keys operator with the sort operator, all is fine, as
> they're returned sorted alphabetically. However, not every instance in which
> I need to do something like this can be resolved that way.

Maybe you need to index into your hash with an array, or perhaps even
use an array in the first place. Or maybe you need to sort in something
other than alphabetical order. You can do this in Perl by specifying a
a sort routine. If you need to sort on data that's not inherent to the
values of the keys, then you'd have to store the sort data in some other
way, like maybe indexing into your hash with an array of the key name in
order.

All this talk of arrays and hashes working together and of arrays vs.
hashes may make you think this is a course in data structures, so I'd
suggest looking at linked lists too, if you can't find a suitable way
to use hashes and arrays. There's even more than one way to emulate
linked lists in Perl. You could make a hash of hashes, with each subhash
containing a key which has a value of the name of another subhash as
the next link. You could also use references to make more or less
traditional linked lists. I've seen some other structures that do the
work of a linked list, how ever loosely they resemble the actual
structure of a linked list. One choice I see other programmers make
often is to keep the names of hash keys in an array, which is only
very loosely similar to a linked list, but often serves a similar
purpose well for certain sizes of data sets. ;)

A virtual cookie to the first three people who spot my favorite of these
methods in this post. ;)


Chris

--
Christopher E. Stith -- mischief@velma.motion.net
"Is that an African or a European swallow?"
"I don't know tha.. aaaagh!"



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

Date: Tue, 28 Nov 2000 15:07:31 -0000
From: "Ross" <patelro@viacode.com>
Subject: Can anyone help me with this script???
Message-Id: <975424419.400884@igateway.postoffice.co.uk>

Hi All!

I'm desperately hoping that their is some kind should out there that can
help me!!

What I'm trying to create is a program that will use the /etc/dict (or other
wordfile) and pick random words from this file and insert them into a
textfile, replacing each instance of 'ZZZZ' with one of these random words.
Finally, when the string 'ZZZX' is encountered, a random word is used to
replace this value and the new file is saved under a unique name.  The
process then starts again using the original file with all the ZZZZ values
etc, creating a number of these output documents all with unique names.

What I've created so far is a (semi-buggy) file copying program.  It's
designed to handle most errors or exceptions, and copy a buffer full of data
to a designated file (if it doesn't exist the file is created).
I just can't quite get it to do what I want (grrrrr....).

If anyone can help, I'd be most appreciative and will post you a pint!
Alternatively, I'll happily donate my copy of MS Windows 2000 to anyone who
can save me!

Thanks!

Ross




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

Date: Tue, 28 Nov 2000 16:53:40 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: Can anyone help me with this script???
Message-Id: <3a2be087.72691164@news.tcn.net>


srand;
open(IN, "< /etc/dict") ......
@dict = <IN>;
 ....
while(<>) { s/ZZZZ/$dict[scalar(int(rand @dict))]/g;
        print;
}

Flint



On Tue, 28 Nov 2000 15:07:31 -0000, "Ross" <patelro@viacode.com>
wrote:

>Hi All!
>
>I'm desperately hoping that their is some kind should out there that can
>help me!!
>
>What I'm trying to create is a program that will use the /etc/dict (or other
>wordfile) and pick random words from this file and insert them into a
>textfile, replacing each instance of 'ZZZZ' with one of these random words.
>Finally, when the string 'ZZZX' is encountered, a random word is used to
>replace this value and the new file is saved under a unique name.  The
>process then starts again using the original file with all the ZZZZ values
>etc, creating a number of these output documents all with unique names.
>
>What I've created so far is a (semi-buggy) file copying program.  It's
>designed to handle most errors or exceptions, and copy a buffer full of data
>to a designated file (if it doesn't exist the file is created).
>I just can't quite get it to do what I want (grrrrr....).
>
>If anyone can help, I'd be most appreciative and will post you a pint!
>Alternatively, I'll happily donate my copy of MS Windows 2000 to anyone who
>can save me!
>
>Thanks!
>
>Ross
>



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

Date: Tue, 28 Nov 2000 11:06:45 -0500
From: "Steven M. Castellotti" <scastell@sas.upenn.edu>
Subject: Capturing a pty for spawned processes?
Message-Id: <3A23D815.B122A93E@sas.upenn.edu>


Greets all.

	I'm working on a quick script that will be call by cgi programs to su
to a local user and modify a few of the user's file remotely. I tried
using a popen command to interface with su, but su will only talk to the
pty directly, which is of no use. Is there a method/module I can use to
allocate su a pty, yet still read/write to the process?

	(examples or links to examples would be a great help!)

Thanks in advance.

-- 
Steve Castellotti
Systems Programmer
School of Arts and Sciences, University of Pennsylvania


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

Date: 28 Nov 2000 18:21:31 +0000
From: nobull@mail.com
Subject: Re: Capturing a pty for spawned processes?
Message-Id: <u9bsv0ot3o.fsf@wcl-l.bham.ac.uk>

"Steven M. Castellotti" <scastell@sas.upenn.edu> writes:

> 	I'm working on a quick script that will be call by cgi programs to su
> to a local user and modify a few of the user's file remotely. I tried
> using a popen command to interface with su, but su will only talk to the
> pty directly, which is of no use. Is there a method/module I can use to
> allocate su a pty, yet still read/write to the process?

I Expect there is. :-)

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


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

Date: 28 Nov 2000 16:25:18 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: checking variable type
Message-Id: <975427923.6652@itz.pp.sci.fi>

In article <u9n1ekp7z1.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
>
>And, of course, this is one of the well known instances where the FAQ
>is wrong (or at least the answer it gives doesn't match the question).

I'd say it's just as much wrong as your code below.  I'd sort of
expect that, too, from two answers to the same meaningless question.


>$var = 1.5; # $var is a number
>$var = "1.5"; # $var is a string (that looks like a number)
>
>if ( ~$var ne ~"$var") {
>  print '$var is a number';
>} 

  my $foo = "1.5";
  print '$foo is a ', (~$foo ne ~"$foo" ?'number':'string'), ".\n";
  my $bar = 1 + $foo;
  print '$bar is a ', (~$bar ne ~"$bar" ?'number':'string'), ".\n";
  print "What the heck happened to \$foo???\n" if ~$foo ne ~"$foo";

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post
 something, we discuss its implications.  If the discussion happens to
 answer a question you've asked, that's incidental." -- nobull in clpm



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

Date: 28 Nov 2000 18:42:45 +0000
From: nobull@mail.com
Subject: Re: checking variable type
Message-Id: <u98zq4os4a.fsf@wcl-l.bham.ac.uk>

Ilmari Karonen <iltzu@sci.invalid> writes:

> In article <u9n1ekp7z1.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
> >
> >And, of course, this is one of the well known instances where the FAQ
> >is wrong (or at least the answer it gives doesn't match the question).
> 
> I'd say it's just as much wrong as your code below.  I'd sort of
> expect that, too, from two answers to the same meaningless question.

Ageed, the question in the FAQ is: "How do I determine whether a scalar is a
number/whole/integer/float?". This is meaningless.

Meaningful questions would be:

1) "How do I determine whether the value in a scalar looks like
number?"

2) "How do I determine whether the value in a scalar is the canonical
representation of a number?"

3) "How do I determine whether the value in a scalar is actually
stored as a number?"

The problem is that a lot of people come to this newsgroup asking
question 3 and get directed to the FAQ which answers question 1.
Usually it turns out that these people really should have been asking
question 1 but more often than not they don't actually give enough
information up front to allow this to be inferred.  Of those people
who should not be asking question 1 most shouldn't really be thinking
about this at all.

>   my $foo = "1.5";
>   my $bar = 1 + $foo;
>   print "What the heck happened to \$foo???\n" if ~$foo ne ~"$foo";

So using a variable in a numeric context can change its type if it is
a canonical representation of a number.  This is interesting but
doesn't alter the answer to question 3.

> "Get real!  This is a discussion group, not a helpdesk.  You post
>  something, we discuss its implications.  If the discussion happens to
>  answer a question you've asked, that's incidental." -- nobull in clpm

Hmmm... sounds familiar :-)

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


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

Date: Tue, 28 Nov 2000 16:54:58 -0000
From: "W K" <b_nospam_ill.kemp@wire2.com>
Subject: Re: Counting Asian characters in text
Message-Id: <975430500.21108.0.nnrp-14.c3ad6974@news.demon.co.uk>


hokiebear wrote in message ...
>Does anyone know of a code snippet that would count the number of
characters
>in a wholly Chinese, Korean, or Japanese text? The following works for
>counting letters in an English text but doesn't work for any of the
>aforelisted:


or for that matter french or german?

>
>    $chars =$input{'text'} =~ tr/a-zA-Z/a-zA-Z/;


is it in unicode? utf-8 unicode? or some other character encoding?





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

Date: Tue, 28 Nov 2000 09:26:12 -0700
From: Rob Greenbank <rob@frii.com>
Subject: Encrypting passwords
Message-Id: <n0m72to29gipijkd0gaq9chvk3afv9rruf@4ax.com>

OK, I've searched Deja News and haven't seen anyone with an acceptable
solution to my problem.  I have a number of perl scripts that connect
to databases (Oracle).  That connection requires a password, and
obviously we would prefer to not store that password in clear text.  

The obvious solution is to encrypt the password somehow.  If I'm using
perl, however, the information on how to decrypt the password is
stored in human readable form.  I don't see this as much of an
improvement.  The only solution I've come up with so far, less than
perfect, is a compiled program (C, for instance) that decrypts the
encrypted passwords.  This program verifies the parent was the perl
script it was designed to service (not perfect security, but better
than nothing).  Source code does not contain the password (passed on
the compilation command line).  

This problem has to exist for others, especially using the BDI
modules.  Has anyone else come up with a better way to solve this?

Thanks,

	Rob 
	(rob@frii.com)


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

Date: Tue, 28 Nov 2000 17:18:42 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Encrypting passwords
Message-Id: <3A23E8F2.603376B2@yahoo.co.uk>

Rob Greenbank wrote:

> OK, I've searched Deja News and haven't seen anyone with an acceptable
> solution to my problem.  I have a number of perl scripts that connect
> to databases (Oracle).  That connection requires a password, and
> obviously we would prefer to not store that password in clear text.
>
> The obvious solution is to encrypt the password somehow.  If I'm using
> perl, however, the information on how to decrypt the password is
> stored in human readable form.  I don't see this as much of an
> improvement.  The only solution I've come up with so far, less than
> perfect, is a compiled program (C, for instance) that decrypts the
> encrypted passwords.  This program verifies the parent was the perl
> script it was designed to service (not perfect security, but better
> than nothing).  Source code does not contain the password (passed on
> the compilation command line).
>
> This problem has to exist for others, especially using the BDI
> modules.  Has anyone else come up with a better way to solve this?

If the password is reversibly encrypted, it is no more secure than
cleartext. One-way encryption is more secure, but no good in this case. So
leave it in cleartext in a secure location, outside your Perl script in a
config file with secure file-permissions, in a secure directory located on
trusted hardware.
--
Nick



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

Date: Tue, 28 Nov 2000 17:51:07 GMT
From: kumar1@home.com (Prasanth A. Kumar)
Subject: Re: Encrypting passwords
Message-Id: <m3pujgm1dg.fsf@C654771-a.frmt1.sfba.home.com>

Rob Greenbank <rob@frii.com> writes:

> OK, I've searched Deja News and haven't seen anyone with an acceptable
> solution to my problem.  I have a number of perl scripts that connect
> to databases (Oracle).  That connection requires a password, and
> obviously we would prefer to not store that password in clear text.  
> 
> The obvious solution is to encrypt the password somehow.  If I'm using
> perl, however, the information on how to decrypt the password is
> stored in human readable form.  I don't see this as much of an
> improvement.  The only solution I've come up with so far, less than
> perfect, is a compiled program (C, for instance) that decrypts the
> encrypted passwords.  This program verifies the parent was the perl
> script it was designed to service (not perfect security, but better
> than nothing).  Source code does not contain the password (passed on
> the compilation command line).  
> 
> This problem has to exist for others, especially using the BDI
> modules.  Has anyone else come up with a better way to solve this?
> 
> Thanks,
> 
> 	Rob 
> 	(rob@frii.com)

What I have done is place the database/username/passwd combination
into a text file and my perl script reads the file in to pass as
parameters to the DBI connect call. The file is stored outside the web
server directory structure so even if some forces the webserver to
output the perl script somehow, they cannot find the passwords.

You could encrypt this password file but then where would you store
this new key so you can decrypt it again!? About the only reasonable
thing you can do is put restrictive permissions so only the CGI script
user can read the file.

-- 
Prasanth Kumar
kumar1@home.com


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

Date: Tue, 28 Nov 2000 17:59:37 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Encrypting passwords
Message-Id: <t27sk9tshpb3e@corp.supernews.com>

Rob Greenbank <rob@frii.com> wrote:
> OK, I've searched Deja News and haven't seen anyone
> with an acceptable solution to my problem.

Good. That's the right time to post a question. ;)

> I have a number of perl scripts that connect to
> databases (Oracle).  That connection requires a
> password, and obviously we would prefer to not
> store that password in clear text.  

There's a certain level of information that can't
be encrypted if you want to decrypt other data.
That's a hard fact of crypto.

> The obvious solution is to encrypt the password
> somehow.

You still need something unencrypted to decrypt
the password.

> If I'm using perl, however, the information
> on how to decrypt the password is stored in
> human readable form.

As it is with even ssh or ssl, on some level.
There are private keys even for public-key
cryptography. You could use one-time keys
to unlock the password, but you still need
a way to share the one-time keys, which is
through either public-key or private-key
encryption. Either way, you have to store
the information on the system if you want
the system to do the authentication.

> The only solution I've come up with so far, less
> than perfect, is a compiled program (C, for
> instance) that decrypts the encrypted passwords.

This still stores the means to decrypt the
encrypted passwords. Even if you pass the
key in at compile time, it gets compiled into
the object code. Someone with the run of your
system and a good debugger or hex editor could
still find it.

Some of the secure web servers require you to
enter a password each time the program starts
in order to decrypt the certificate(s). This
password is then stored only in memory and is
likely free()d after being used to decrypt the
certificate, which is then only stored in
memory in the plaintext form. I believe that
the secure versions of Apache use a data
transformation on the certificate based on the
key, and that the plaintext produced from the
certificate is the only proof or disproof of
the key being valid. This uses a private-key
encryption technique to launch a public-key
encryption system. This still brings up issues
of paging to disk for those who are truly
paranoid. If you're running production machines
with little downtime, and have someone
responsible for making sure things come back up
properly when they go down, this is a good
solution in Perl or any other language.

Traditionally, to log into a Unix-type box, you
enter the password to run through a one-way
encryption, which is then checked against the
pre-encrypted form. If these match, the user
is allowed to log in. You could, if you chose,
use a one-way encryption function to match
against a password that is stored only in
encrypted form on disk, then use the plaintext
version of that, if the match succeeds, to
decrypt the password you wish to pass to your
database server. This, like the above, is
going to require that the initial password
either be passed in from a terminal. It's
not quite as elegant as the above, but there
are plenty of ways already existing in Perl
to do the one-way encryption part, so I
thought I'd toss it into the mix. It is a
tradeoff between having an additional step
and having an additonal step succeptible to
brute-force attack.

This really isn't a cryptology/cryptography/
crytanalysis/encryption group, but I thought
I'd point out some possibilities to prove that
the general design is more important here than
the implementation language. You can do it in
Perl as well as in C, so you might as well do it
in Perl.

Chris

--
Christopher E. Stith -- mischief@velma.motion.net



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

Date: 28 Nov 2000 18:03:40 +0000
From: nobull@mail.com
Subject: Re: Encrypting passwords
Message-Id: <u9lmu4otxf.fsf@wcl-l.bham.ac.uk>

Rob Greenbank <rob@frii.com> writes:

> OK, I've searched Deja News and haven't seen anyone with an acceptable
> solution to my problem. 

Perhaps you have a fundamentally insoluable problem.  Perhaps this is
not specific to Perl.  Perhaps this has been pointed out before in
these threads.  (Perhaps even by me).

If you find "your problem is fundamentally insoluable" unacceptable
then _that_ is your real problem.

> I have a number of perl scripts that connect
> to databases (Oracle).  That connection requires a password, and
> obviously we would prefer to not store that password in clear text.  

The fact that the script is written in Perl is not relevant.  The
problem is fundamental.  Anything you can store that gives the script
access to the database is a password equivalent.
 
> The obvious solution is to encrypt the password somehow.  If I'm using
> perl, however, the information on how to decrypt the password is
> stored in human readable form.

Human/machine what's the difference?  If it's machine readable then
it's also readable by a human with a machine.

> The only solution I've come up with so far, less than perfect, is a
> compiled program (C, for instance) that decrypts the encrypted
> passwords.

Security by obscurity is no security.

>  This program verifies the parent was the perl script it was
> designed to service (not perfect security, but better than nothing).

Actually there's a widely held belief that false (sense of) security
may be worse than a true sense of insecurity.  If you believe that it
is safe to let people access your compiled executable then your
system is actually less secure.

> This problem has to exist for others, especially using the BDI
> modules.  Has anyone else come up with a better way to solve this?

Store the plaintext password in a file that is not world readable.
Execute the script under an account that can read the file.
All other solutions are basically varients on this.  

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


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

Date: Tue, 28 Nov 2000 16:16:28 GMT
From: L Hoang <loch@uci.edu>
Subject: Finding current time.
Message-Id: <3A23DA5C.C17134F@uci.edu>

Hi all.
How can I use Perl to find current time?
Thanks.



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

Date: 28 Nov 2000 10:45:01 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Finding current time.
Message-Id: <87d7fg59ma.fsf@limey.hpcc.uh.edu>

>> On Tue, 28 Nov 2000 16:16:28 GMT,
>> L Hoang <loch@uci.edu> said:

> Hi all.  How can I use Perl to find current time?
                                             ^^^^^^

perldoc -f time
perldoc -f localtime

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Tue, 28 Nov 2000 14:34:37 GMT
From: Chuck Williams <chuckwilliams1@netscape.net>
Subject: flypages
Message-Id: <900fps$p3i$1@nnrp1.deja.com>

There's a site out there www.flypage.com selling a Perl-based HTML
page construction 'wizard'. My client purchased it. I've gotta go in
and fix what someone else left behind.
If you have experience with their product, I'd appreciate even a word
or two of advice. (I already saw one posting warning people against it.)
Thanks,
Chuck Williams

--
http://www.servicesbywilliams.com/business


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


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

Date: 28 Nov 2000 16:03:13 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: for loop: brackets make any difference?
Message-Id: <975427022.5006@itz.pp.sci.fi>

In article <87d7fgekmn.fsf@hawk.ce.mediaone.net>, Andrew N. McGuire wrote:
>
>( anm@hawk ~ ) perl -MO=Deparse for.pl                              ( 0 pts/1 )
>foreach $_ (1) {
>    print "hello, world\n";
>}
>foreach $_ (1) {
>    print "hello, world\n";
>}
>for.pl syntax OK

Funny, I'd never realized that.  It's definitely _not_ the same thing
for while loops:

  % perl -MO=Deparse -e'print while ++$_<5; while(++$_<9){print}'
  print $_ while ++$_ < 5;
  while (++$_ < 9) {
      print $_;
  }
  -e syntax OK

  % perl -le'print and last for 1..4'
  1

  % perl -le'print and last while ++$_ < 5'
  1
  Can't "last" outside a loop block at -e line 1.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post
 something, we discuss its implications.  If the discussion happens to
 answer a question you've asked, that's incidental." -- nobull in clpm



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

Date: 28 Nov 2000 12:18:22 -0500
From: darkon@one.net (David Wall)
Subject: Re: for loop: brackets make any difference?
Message-Id: <8FFA754E9darkononenet@206.112.192.118>

anmcguire@ce.mediaone.net (Andrew N. McGuire) wrote in
<87d7fgekmn.fsf@hawk.ce.mediaone.net>: 

>>>>>> "DW" == David Wall <darkon@one.net> writes:
>
>DW> Out of curiousity, is there any difference between the way the two 
>DW> following constructs are compiled?
>
>  Perl will tell you this, if you ask it. :-)

Thanks!  You not only answered my question but showed me how to get the 
answer to similar questions myself.  I had noticed B::Deparse before, but 
never really played with it. Now I have yet another tool.

-- 
David Wall
darkon@one.net


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

Date: 28 Nov 2000 18:13:39 +0000
From: nobull@mail.com
Subject: Re: for loop: brackets make any difference?
Message-Id: <u9itp8otgs.fsf@wcl-l.bham.ac.uk>

darkon@one.net (David Wall) writes:

> Out of curiousity, is there any difference between the way the two 
> following constructs are compiled?
> 
> for (list) { statement }
> 
> statement for (list);

The parentheses are not needed in the second case.

> I'd think they would compile exactly the same, but somehow I seem to
> recall reading that they are a little different.

I would expect that only the former would create a BLOCK scope.  This
would only be relevant if the statement has any BLOCK-scoped side
effects such as setting $1 et al.  However my expectation appears to
be wrong.  Both syntaxes appear to establish a BLOCK scope:

# Prints nothing - would expect 'wobble'
for ('foo','bar') { /(.*)/ }
print $1;
/(.*)/ for 'wibble','wobble';
print $1;

Note, that this is appears to be an oddity of the for modifier.  I
suspect for has to create a new scope so that it can alias $_.  The if
modifier does work as expected:

# Prints 'foofoo'
'foo' =~ /(.*)/ if 1;
print $1;
if (1) { 'bar' =~ /(.*)/ } 
print $1;

According to perlsyn the loop control functions won't work with
statement modifier loops.  This appears to be untrue in the case of for:

# Should print 335117, actually prints 3355117
for (1 , 2 ) { for ( 3 , 4) { print; last } }
for (1 , 2 ) { do { print; last } for 5, 6 }
for (1 , 2 ) { $i=1; while ( 1 ) { print $i++; last } }
for (1 , 2 ) { $i=7; do { print $i++; last } while ( 1 ) }

In summary: in the case of most statement modifiers there is a
difference.  In the case of for there isn't (in the current version).

$ perl -MO=Deparse -e '&all for 1';
-e syntax OK
foreach $_ (1) {
    &all;
}


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


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

Date: 28 Nov 2000 19:07:59 +0100
From: jt2000@jt2000.it ("-")
Subject: HHHHEEEELLLLLPPPPPPPPPPPPP!!!!!!
Message-Id: <000701c05966$633926c0$0301a8c0@edoardo>

This is a multi-part message in MIME format.

------=_NextPart_000_0004_01C0596E.BEBCE920
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I've Oracle8i and I'm trying to connect from a perl-script, but I'm not =
be able to make the connect, which is the right command
to connect an Oracle db.
The Oracle8i is installed in a Win98 pc but I've also one in a WinNT =
(The error is the same)
PLEASE, ANYONE CAN HELP ME ?
Gianluca
g.vianello@jt2000.it

------=_NextPart_000_0004_01C0596E.BEBCE920
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I've Oracle8i and I'm trying to =
connect from a=20
perl-script, but I'm not be able to make the connect, which is the right =

command</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>to connect an Oracle =
db.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>The Oracle8i is installed in a Win98 =
pc but I've=20
also one in a WinNT (The error is the same)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>PLEASE, ANYONE CAN HELP ME =
?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>Gianluca</FONT></DIV>
<DIV><FONT color=3D#000000 =
size=3D2>g.vianello@jt2000.it</FONT></DIV></BODY></HTML>

------=_NextPart_000_0004_01C0596E.BEBCE920--


-- 
Posted from cips.inwind.it [212.141.53.74] (may be forged) 
via Mailgate.ORG Server - http://www.Mailgate.ORG


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

Date: Tue, 28 Nov 2000 09:50:34 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do you install packages manually without PPM (ActiveState  WinNT)...
Message-Id: <3A23F06A.D13E3AE4@vpservices.com>

[please do not email someone on the newsgroup in response to a newsgroup
posting and if you absolutely must, indicate in the email that you also
posted your question to the group.  If you fail to do that, it is called
a "blind cc" and is considered extremely rude by experienced users of
usenet]

Lee Francis Wilhelmsen wrote:
> 
> Can anyone tell me how do I install packages manually without PPM
> (ActiveState WinNT)
> 
> ... the machine I'm using isn't connected to the net.

For packages that have a PPM install:
-------------------------------------

1. Go to http://www.activestate.com/PPMpackages/zips/

2. Select the directory for your build of Perl (5xxx or 6xxx)

3. In that directory download the zip file you want, e.g. DBI.zip

4. Copy the zip file to the offline computer.

5. On the offline computer unzip the zip file and follow the
instructions in the readme included with it (basically you run PPM
locally on the contents of the zip file without needing to be connected
to the net)

For packages that do not have a PPM install and which do not require
compilation:
---------------------------------------------------------------------------------

1. Go to http://www.cpan.org/

2. Find and download the tar.gz file for the module you want, e.g.
DBD::RAM

3. Copy the tar.gz file to your offline computer.

4. Untar and uncompress the file (winzip will do that fine if you don't
have other tools).

5. Follow the instructions in the module's readme to install it --
either use nmake or just copy the files into the appropriate
directories.  

(For more on this process, see the ActivePerl documentation on
installing modules from CPAN.

-- 
Jeff


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

Date: Tue, 28 Nov 2000 17:27:22 GMT
From: "Lee Francis Wilhelmsen" <leefw@c2i.net>
Subject: How do you install packages manually without PPM (ActiveState WinNT)...
Message-Id: <_VRU5.1598$Pe4.177313@juliett.dax.net>

Hi

Can anyone tell me how do I install packages manually without PPM
(ActiveState WinNT)

 ... the machine I'm using isn't connected to the net.

regards
Lee




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

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


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