[17102] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4514 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 4 03:05:23 2000

Date: Wed, 4 Oct 2000 00:05:09 -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: <970643108-v9-i4514@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 4 Oct 2000     Volume: 9 Number: 4514

Today's topics:
    Re: benefits of arrays over hashes(associative arrays)  <tina@streetmail.com>
    Re: eval(): How do I redirect input? <philipg@atl.mediaone.net>
        File upload- <hjakober@acotel.ch>
    Re: help: FORCE perl to evaluate arithmetic string <lr@hpl.hp.com>
    Re: how can I run a perl prog on other host in network, <elephant@squirrelgroup.com>
    Re: Net::SMTP problem <elephant@squirrelgroup.com>
    Re: Newbie can't handle the "true"th... explanation des aman2112@my-deja.com
    Re: registry question with perl... <elephant@squirrelgroup.com>
        Running scripts from the Bash Shell <webmaster@blutimus.com>
    Re: Running scripts from the Bash Shell <taboo@comcen.com.au>
    Re: Running scripts from the Bash Shell <philipg@atl.mediaone.net>
    Re: Running scripts from the Bash Shell aman2112@my-deja.com
    Re: Running scripts from the Bash Shell <webmaster@blutimus.com>
        Script doesn't display the correct date. Help. <webmajster@fiver.si>
    Re: Script doesn't display the correct date. Help. aman2112@my-deja.com
    Re: Script doesn't display the correct date. Help. <elephant@squirrelgroup.com>
    Re: Script doesn't display the correct date. Help. <lr@hpl.hp.com>
    Re: scripts not working <pdmos23@geocities.com>
    Re: scripts not working <pdmos23@geocities.com>
    Re: some questions <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 4 Oct 2000 04:24:30 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <8rebdu$hjnma$4@ID-24002.news.cis.dfn.de>

hi,
In comp.lang.perl.misc "J=FCrgen Exner" <juex@my-deja.com> wrote:
> "Cameron Elliott" <celliot@tartarus.uwa.edu.au> wrote in message
> news:39d7648e$0$31974@echo-01.iinet.net.au...
>> Can someone tell me which is better to use?

> Which is better to use, an 18-wheeler or a Porsche? Well, it depends on =
if
> you want to haul your girl friend or 200 refrigerators.

hm, i guess i would be at least much more impressed if my
boyfriend stopped by with an 18-wheeler.

=3D)
tina

--=20
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Wed, 04 Oct 2000 04:25:46 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: eval(): How do I redirect input?
Message-Id: <ejyC5.14167$jJ4.3502813@typhoon.southeast.rr.com>

<104073.3433@compuserve.com> wrote in message
news:8re9tl$bki$1@sshuraab-i-1.production.compuserve.com...
>
> If I read in a perl file to an array like this:
>
> @script = <FILE>;
>
> and the script reads from <STDIN>, how do I eval(@script) such that
@script's
> input actually comes from some file?

You probably don't want to do this.  Look up require and do.
perldoc -f require
perldoc -f do

But, if you think you must, open it and join it (or "slurp" it), then eval
it.  For more information on slurping files, see perldoc perlvar.

open( FILE, "script.pl") or die $!;
eval( join( '', <FILE>));
close( FILE) or warn $!;

hth,
p




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

Date: Wed, 4 Oct 2000 08:56:11 +0200
From: "Hanspeter Jakober" <hjakober@acotel.ch>
Subject: File upload-
Message-Id: <39dad44a$1_2@news.sunweb.ch>

Hello

With die Perl-Script <upload.pl> I upload files to my webserver (WIN-NT/ISS)
so far so good. Now I would like to change the path where the files are
stored on the webserver.

Question: how can I changed the path where I like to store the files on the
webserver and what kind of right needs the new directory.


$Datei[1]="image.gif";
open(DATEI, ">$image[1]");
binmode DATEI;
print DATEI $Datei[4];
close DATEI;

thank you for your assistance.

greetings - hanspeter




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

Date: Tue, 3 Oct 2000 23:24:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: help: FORCE perl to evaluate arithmetic string
Message-Id: <MPG.14446cdacc6ed0bd98ae02@nntp.hpl.hp.com>

In article <39DA6C18.5154D3B1@stomp.stomp.tokyo>, 
godzilla@stomp.stomp.tokyo says...
> ruzbehgonda@my-deja.com wrote:
>  
> > after building an arithmetic expression dynamically
> > eg. $arith = ( (1 * 0) + 1) + 1
> > i need perl to evaluate for the results...
> > perl treats this as another string
> > because of the operators and parenthesis and does
> > not cast the string...
>  
> > how can i do this?
>  
> 
> I have read some articles within this thread,
> with humored interest. I also posted a clear
> answer. Still, I am most curious. Why would
> you "force" perl core to evaluate a mathematical
> expression which is self-evaluating?
> 
> "Arithmetical" expressions automatically evaluate.

As usual, you are dealing with a different problem from everyone else.  
Your code shows constant arithmetic expressions, which are evaluated 
when the program is compiled.  Everyone else is dealing with strings, 
which must be evaluated at run time.

By the way, how did you get the following line of code from your post to 
compile?

    $string = 1 + 1 / 0 + 1 -1;

Even without warnings and such, I get a fatal compilation error:

    Illegal division by zero at ...

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


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

Date: Wed, 4 Oct 2000 15:47:06 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: how can I run a perl prog on other host in network, from within a perl prog.
Message-Id: <MPG.14456f603bf248ab9897ed@localhost>

Robert Chalmers wrote ..
>I have two hosts on the same network, both with perl programs I need to run
>that adjust the config files. So they need to run as 'root'. FreeBSD boxes
>both.
>
>The question is. Is it possible to have a subroutine in PerlProg-Server-A
>call and run a perl program on Server-B. Both are on the same network, and
>can understand most rsh things, but I'm wondering if Perl has something in
>ti that I can't locate, (or understand) that can call this other program for
>me.

basically - no .. you need to have a process running on the second host 
for the first host to call *to* .. if you're familiar with Java's RMI - 
then what you need to have is that RMIRegistry .. nothing happens 
without something listening on the target host

that having been said .. it's fairly trivial to write a listen server 
using the Socket module

  perldoc Socket

then your Server-B program would just be running all the time - 
listening for the Server-A program .. Server-A would also use sockets to 
call over to Server-B

more information in the perlipc section of the documentation

  perldoc perlipc

of course - the other option is to use one of the many existing 'listen' 
servers .. like SMTP or HTTP to call your program on Server-B for you 
(eg. by sending an email to an address that's set up in /etc/aliases to 
pipe to your program .. or by issuing a POST or GET to a CGI program 
using LWP)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 4 Oct 2000 15:59:08 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Net::SMTP problem
Message-Id: <MPG.14457236fd0318ac9897ee@localhost>

Alex Harvey wrote ..
>I am finding that when I use Net::SMTP to send a simple email to myself I
>receive an error "The system cannot find the path specified". (I am using
>Windows 2000.) I have turned on use diagnostics and run the script using
>the -w option and the error looks like it is in the module itself rather
>than in my code. I've been unable to find any clear answers using deja. Has
>anyone solved this problem?
>
>Here is the code
>
>use Net::SMTP;
>use diagnostics;
>
>Send_Mail()
>        || die "Send_Mail: $!";
>
>sub Send_Mail {
>    my $smtp;
>
>    $smtp = Net::SMTP->new('mail.pacificgaming.com.au');
>    $smtp->mail( 'alexh' );
>    $smtp->to( 'alexh' );
>    $smtp->data();
>
>    $smtp->datasend("To: alexh\@pacificgaming.com.au\n");
>    $smtp->datasend("From: alexh\@pacificgaming.com.au\n");
>    $smtp->datasend("\n");
>
>    $smtp->datasend("Hello, World!\n");
>    $smtp->dataend();
>    $smtp->quit;
>
>    return $!;
>}
>
>And here is the output:
>
>c:\perl> perl -w sendmail_eg.pl
>
>The system cannot find the path specified.
>Use of uninitialized value in scalar assignment at
>        C:/Perl/site/lib/Net/Domain.pm line 191 (#1)

this happens because the Net modules have been unable to determine your 
domain name .. if you know what your domain name is then you can set 
either the LOCALDOMAIN or the DOMAIN environment variable on your 
machine

alternatively you could try setting your TCP/IP settings .. or talk to 
your network administrator about correcting the settings (they should be 
able to be retrieved via the gethostbyaddr() call if everything's set 
correctly)

just to confirm .. your code works perfectly on my machine .. it's a 
network configuration issue

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 04 Oct 2000 06:22:56 GMT
From: aman2112@my-deja.com
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <8reibv$8eu$1@nnrp1.deja.com>

In article <39d4fc12.26424851@news.earthlink.net>,
  jonceramic@nospammiesno.earthlink.net (Jon S.) wrote:
> Hi,
>
> I know this must seem dumb, but I'm trying to figure out the proper
> way to set a scalar as a boolean "true" or "false".
>
> Larry R. and others helped me before with a definition of a variable
> using a condition that was either true or false, but now I've found a
> spot where I just want to seed something a "true" value for later use.
>
> I've resorted to using
> $itstrue = 1;
>
> (I also contemplated just giving it the string "true".)
>
> But I keep wondering if there's a better way, more exact way.  (Like,
> is there some standard expression that comes up true which everyone
> uses?)
>
> Similarly, just what gets put into a variable when you set it as true
> or false?
>
> TIA,
>
> Jon
>
>
How bout this
my $bool = 1
print "$test\n" if ($bool);
	>> prints value of $test
$bool = 0;
print "$test\n" if ($bool);
	>>print nothing



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


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

Date: Wed, 4 Oct 2000 15:40:32 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: registry question with perl...
Message-Id: <MPG.14456ddabb56f22a9897ec@localhost>

  [ posted to comp.lang.perl.misc and CCed to boogiemonster@usa.net ]

J Joseph Yusko wrote ..
>I'm trying to create a script that locates a remote machine and modify a
>certain registry for a specific machine.  The sample code will display one
>of the directory with serviceroot but will not even try the if statment with
>softwareroot variable.
>
>can anyone help me out with this one?

not sure if you've received any email responses to this one .. it's been 
hanging around in the newsgroup without an answer .. so hopefully this 
will help

>use Win32::Registry;

I have a feeling that this is what it used to be called .. but the more 
recent versions are under the Win32API tree .. ie. Win32API::Registry .. 
you might consider getting a later version

also you're missing '-w' and 'use strict;' from your script (see more 
details below)

>%KeyName = (
>    softwareroot      =>  'Software\Folio\4',
>    serviceroot         =>  'System\CurrentControlSet\Services',
>);

ok .. so two keys called 'softwareroot' and 'serviceroot' (%KeyName 
should be declared with a 'my')

>$Root = $HKEY_LOCAL_MACHINE;

also .. $Root should be declared with a 'my' .. I'm guessing that 
$HKEY_LOCAL_MACHINE comes spewing out of Win32::Registry (even though no 
one asked it to)

>if( $Machine = $ARGV[0] )

not as safe as testing the scalar value of @ARGV which will be zero if 
there are no args

>if( $Root->Open( $KeyName{softwareroot}, $SoftwareRoot ) )
>{
>    if( $SoftwareRoot->Open( $KeyName{foliosubdirectory}, $Links ) )
                                       ^^^^^^^^^^^^^^^^^
that key (on the line above - indicated by the carets) does not exist in 
the %KeyName hash (using warnings would have told you this) .. so I 
don't know why you would think that the 'if' would succeed

as the first line of every program put the following (on Win32)

#!perl -w

this switches on warnings .. as the second line put the following

use strict;

this forces you to do the right thing with variables, references and 
subroutines

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 04 Oct 2000 04:34:15 GMT
From: "Blutimus" <webmaster@blutimus.com>
Subject: Running scripts from the Bash Shell
Message-Id: <bryC5.14303$s76.984350@bgtnsc06-news.ops.worldnet.att.net>

First let me say that I'm not sure what the Bash Shell is I just know I'm
running in it when I try to execute my scripts via a telnet session. I'm
fairly new to this whole process - I recently finished an introduction to
CGI programming class where we learned the basics of perl. I have since
purchased Learning Perl, The Perl Cookbook(in shipping) and programming the
Perl DBI (great price couldn't pass it up - I might need it someday!).
Anyway I'm working on Learning Perl and all the examples are for scripts
that are executed from the shell! Okay I know with a little modification I
can make the examples work from a browser using forms and hidden fields to
insert the data. But I still want to execute them from the shell - in fact I
WANT EVERYTHING! But that's a different story....anywise could someone give
me a clue? I am genuinely interested in learning the Perl language as what
I've learned so far has been very rewarding and I dunno  just kinda like
it.... By the way I'm connected to a UNIX server via telnet (using the
NetTerm client). My scripts run on that server just fine via a browser, but
in the shell I type the filename at the prompt and I get "bash: stroll.cgi:
command not found". I can run cat and it will list the contents of the file
and the permissions are correct. Is there a command I'm missing? Do I need
to be in another shell (shells confuse me!)? My host says that I can type
the filename at the prompt to run the script....mmmmmm...sorry this question
is damm near UNIX, but its because of PERL!
Blutimus




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

Date: 4 Oct 2000 03:57:08 +1100
From: "Kiel Stirling " <taboo@comcen.com.au>
Subject: Re: Running scripts from the Bash Shell
Message-Id: <39da0fe4$1@nexus.comcen.com.au>


"Blutimus" <webmaster@blutimus.com> wrote:
>First let me say that I'm not sure what the Bash Shell is I just know I'm>running in it when I try to execute my scripts via a telnet session. I'm
>fairly new to this whole process - I recently finished an introduction to
>CGI programming class where we learned the basics of perl. I have since
>purchased Learning Perl, The Perl Cookbook(in shipping) and programming the
>Perl DBI (great price couldn't pass it up - I might need it someday!).
>Anyway I'm working on Learning Perl and all the examples are for scripts
>that are executed from the shell! Okay I know with a little modification I
>can make the examples work from a browser using forms and hidden fields to
>insert the data. But I still want to execute them from the shell - in fact I
>WANT EVERYTHING! But that's a different story....anywise could someone give
>me a clue? I am genuinely interested in learning the Perl language as what
>I've learned so far has been very rewarding and I dunno  just kinda like
>it.... By the way I'm connected to a UNIX server via telnet (using the
>NetTerm client). My scripts run on that server just fine via a browser, but
>in the shell I type the filename at the prompt and I get "bash: stroll.cgi:
>command not found". I can run cat and it will list the contents of the file
>and the permissions are correct. Is there a command I'm missing? Do I need
>to be in another shell (shells confuse me!)? My host says that I can type
>the filename at the prompt to run the script....mmmmmm...sorry this question
>is damm near UNIX, but its because of PERL!

There are 2 ways to do this, run the script using the perl binary 
ie,
	bash$ perl <path 2 script > (see man perl) 

or use chmod ( see man chmod) to change the file mode so the script is 
executable ie, 
	$bash chmod +x <path 2 file>
then exec it like this ./<script> if your in the dir or supply the full path.

p.s to read a programs man page exec,
	bash$ man <program name>.

Kiel Stirling


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

Date: Wed, 04 Oct 2000 05:43:32 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: Running scripts from the Bash Shell
Message-Id: <8szC5.15538$cW3.2892647@typhoon.southeast.rr.com>

Blutimus <webmaster@blutimus.com> wrote in message
news:bryC5.14303$s76.984350@bgtnsc06-news.ops.worldnet.att.net...
[snip]
> NetTerm client). My scripts run on that server just fine via a browser,
but
> in the shell I type the filename at the prompt and I get "bash:
stroll.cgi:
> command not found". I can run cat and it will list the contents of the
file
> and the permissions are correct. Is there a command I'm missing? Do I need
[snip]

You probably just need to make sure that you either specify which directory
the program is in, or add that directory to your PATH environment variable.
Unlike MS-DOS, most *nix shells don't assume that the current directory is
in the path.
So, if the program is in your current directory, just try ./stroll.cgi

hth,
p




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

Date: Wed, 04 Oct 2000 06:06:39 GMT
From: aman2112@my-deja.com
Subject: Re: Running scripts from the Bash Shell
Message-Id: <8rehdd$7u0$1@nnrp1.deja.com>

In article <bryC5.14303$s76.984350@bgtnsc06-news.ops.worldnet.att.net>,
  "Blutimus" <webmaster@blutimus.com> wrote:
> First let me say that I'm not sure what the Bash Shell is I just know
I'm
> running in it when I try to execute my scripts via a telnet session.
I'm
> fairly new to this whole process - I recently finished an introduction
to
> CGI programming class where we learned the basics of perl. I have
since
> purchased Learning Perl, The Perl Cookbook(in shipping) and
programming the
> Perl DBI (great price couldn't pass it up - I might need it someday!).
> Anyway I'm working on Learning Perl and all the examples are for
scripts
> that are executed from the shell! Okay I know with a little
modification I
> can make the examples work from a browser using forms and hidden
fields to
> insert the data. But I still want to execute them from the shell - in
fact I
> WANT EVERYTHING! But that's a different story....anywise could someone
give
> me a clue? I am genuinely interested in learning the Perl language as
what
> I've learned so far has been very rewarding and I dunno  just kinda
like
> it.... By the way I'm connected to a UNIX server via telnet (using the
> NetTerm client). My scripts run on that server just fine via a
browser, but
> in the shell I type the filename at the prompt and I get "bash:
stroll.cgi:
> command not found". I can run cat and it will list the contents of the
file
> and the permissions are correct. Is there a command I'm missing? Do I
need
> to be in another shell (shells confuse me!)? My host says that I can
type
> the filename at the prompt to run the script....mmmmmm...sorry this
question
> is damm near UNIX, but its because of PERL!
> Blutimus
>
>
1)Make sure you have execute permissions
2)type which perl
this is the location of perl interpreter
add line #!/usr/bin/perl at the top of the script first line
where /usr/bin/perl is what was returned from which perl command
3) Type ./filename.pl
or if you want just type perl filename.pl


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


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

Date: Wed, 04 Oct 2000 06:58:32 GMT
From: "Blutimus" <webmaster@blutimus.com>
Subject: Re: Running scripts from the Bash Shell
Message-Id: <syAC5.16984$tl2.1196279@bgtnsc07-news.ops.worldnet.att.net>

Oh wow - I must be a moron! ./file.x worked! I thought I had tried
that...nevertheless thanks for all your help
Blutimus
Blutimus <webmaster@blutimus.com> wrote in message
news:bryC5.14303$s76.984350@bgtnsc06-news.ops.worldnet.att.net...
> First let me say that I'm not sure what the Bash Shell is I just know I'm
> running in it when I try to execute my scripts via a telnet session. I'm
> fairly new to this whole process - I recently finished an introduction to
> CGI programming class where we learned the basics of perl. I have since
> purchased Learning Perl, The Perl Cookbook(in shipping) and programming
the
> Perl DBI (great price couldn't pass it up - I might need it someday!).
> Anyway I'm working on Learning Perl and all the examples are for scripts
> that are executed from the shell! Okay I know with a little modification I
> can make the examples work from a browser using forms and hidden fields to
> insert the data. But I still want to execute them from the shell - in fact
I
> WANT EVERYTHING! But that's a different story....anywise could someone
give
> me a clue? I am genuinely interested in learning the Perl language as what
> I've learned so far has been very rewarding and I dunno  just kinda like
> it.... By the way I'm connected to a UNIX server via telnet (using the
> NetTerm client). My scripts run on that server just fine via a browser,
but
> in the shell I type the filename at the prompt and I get "bash:
stroll.cgi:
> command not found". I can run cat and it will list the contents of the
file
> and the permissions are correct. Is there a command I'm missing? Do I need
> to be in another shell (shells confuse me!)? My host says that I can type
> the filename at the prompt to run the script....mmmmmm...sorry this
question
> is damm near UNIX, but its because of PERL!
> Blutimus
>
>




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

Date: Wed, 4 Oct 2000 07:23:17 +0200
From: "Bostjan Kocan" <webmajster@fiver.si>
Subject: Script doesn't display the correct date. Help.
Message-Id: <tbzC5.446$bl3.3115@news.siol.net>

Hi,

Script I wrote located at (with all the notes suplied):
http://www.ixtc.com/cgi-bin/test.cgi displays the current date. The problem
is it displays the wrong month. Instead of the 10th it displays the 9th.

When you will run the script it will return all the notes on which commands
were used, so you will see also the second command which returned the right
month. The problem is that second command is of no use for me. I need that
first command to display the correct month.

Does anyone knows why it displays month like that?? Server date is 1000%
correct.

Best regards,
McSpike




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

Date: Wed, 04 Oct 2000 06:03:18 GMT
From: aman2112@my-deja.com
Subject: Re: Script doesn't display the correct date. Help.
Message-Id: <8reh75$7l5$1@nnrp1.deja.com>

In article <tbzC5.446$bl3.3115@news.siol.net>,
  "Bostjan Kocan" <webmajster@fiver.si> wrote:
> Hi,
>
> Script I wrote located at (with all the notes
suplied):
> http://www.ixtc.com/cgi-bin/test.cgi displays
the current date. The problem
> is it displays the wrong month. Instead of the
10th it displays the 9th.
>
> When you will run the script it will return all
the notes on which commands
> were used, so you will see also the second
command which returned the right
> month. The problem is that second command is of
no use for me. I need that
> first command to display the correct month.
>
> Does anyone knows why it displays month like
that?? Server date is 1000%
> correct.
>
> Best regards,
> McSpike
>
>

You need to add on to date.  In C array index
fassion months are returned 0..11.  Just add 1 to
$month


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


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

Date: Wed, 4 Oct 2000 17:28:37 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Script doesn't display the correct date. Help.
Message-Id: <MPG.1445872c29c744989897ef@localhost>

Bostjan Kocan wrote ..
>Script I wrote located at (with all the notes suplied):
>http://www.ixtc.com/cgi-bin/test.cgi displays the current date. The problem
>is it displays the wrong month. Instead of the 10th it displays the 9th.
>
>When you will run the script it will return all the notes on which commands
>were used, so you will see also the second command which returned the right
>month. The problem is that second command is of no use for me. I need that
>first command to display the correct month.
>
>Does anyone knows why it displays month like that?? Server date is 1000%
>correct.

take a look at the documentation .. it's all there in plain view

  perldoc -f localtime

if you haven't used the perldoc utility before then you can learn more 
about it by typing the following at a command prompt

  perldoc perldoc

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 3 Oct 2000 23:42:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Script doesn't display the correct date. Help.
Message-Id: <MPG.14447111d58e4e9398ae04@nntp.hpl.hp.com>

In article <tbzC5.446$bl3.3115@news.siol.net>, webmajster@fiver.si 
says...
> Script I wrote located at (with all the notes suplied):
> http://www.ixtc.com/cgi-bin/test.cgi displays the current date. The problem
> is it displays the wrong month. Instead of the 10th it displays the 9th.
> 
> When you will run the script it will return all the notes on which commands
> were used, so you will see also the second command which returned the right
> month. The problem is that second command is of no use for me. I need that
> first command to display the correct month.
> 
> Does anyone knows why it displays month like that?? Server date is 1000%
> correct.

Anyone who knows how to read the documentation knows why.

    perldoc -f localtime

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


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

Date: Wed, 04 Oct 2000 04:17:41 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: Re: scripts not working
Message-Id: <39DAB00D.BF89B483@geocities.com>

Jeff Zucker wrote:

> Jeff Zucker wrote:
> >
> > Pasquale wrote:
> > >
> > > <<This the top of my script;
> > > #!/usr/bin/perl
> > >
> > > use strict;
> > > use CGI qw(:standard);
> > > use CGI::Carp qw(fatalsToBrowser);
> > > use lib "/web/sites/125/username/www.username.f2s.com/cgi-bin";
> > > use CGI::Cookie;
> > > End top of script
> > >
> > > After putting in my directory path with the "use lib", the message I am getting
> > > now is:
> > > "Maybe you didn't strip carriage returns after a network transfer".  Does this
> > > mean anything to you?  If I move the "use lib" above "use CGI qw...", I get
> > > internal server error.
> >
> > Nope, your script looks fine.  (Only thing I'd recommend is a -w on the
> > top line to help debug).
>
> On second thought, if you leave "use lib" where it is, you will end up
> with two different versions of CGI.pm -- the main module loaded from the
> older version on your ISP and the cookie part you loaded yourself.  I am
> assuming you loaded all of CGI.pm rather than just the cookie part.  If
> so and if you do the stuff with text-mode FTP I recommended in the last
> message and you get another error, try moving the "use lib" line up
> above "use CGI".
>
> --
> Jeff

Thanks. Putting the FTP in ascii mode made the difference . One more thing that's a
little bit different type of a question.  After doing ascii mode, I then got the
message "Can't call method "value" without a package or object reference".
<<snippet
my %cookies = fetch CGI::Cookie;
my $from = $cookies{'email'}->value;
end snippet

I want to know if it is OK to remove the "->value" from the line?  Because after I did,
it worked.  What I mean by OK is, if it is proper practice of perl script writing?
Thanks very much for getting me over this hurdle!
P.S. I do have "-w" & "-T", I just forgot to add it earlier.
Pasquale



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

Date: Wed, 04 Oct 2000 04:28:39 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: Re: scripts not working
Message-Id: <39DAB29E.B06AA44F@geocities.com>



Pasquale wrote:

> Jeff Zucker wrote:
>
> > Jeff Zucker wrote:
> > >
> > > Pasquale wrote:
> > > >
> > > > <<This the top of my script;
> > > > #!/usr/bin/perl
> > > >
> > > > use strict;
> > > > use CGI qw(:standard);
> > > > use CGI::Carp qw(fatalsToBrowser);
> > > > use lib "/web/sites/125/username/www.username.f2s.com/cgi-bin";
> > > > use CGI::Cookie;
> > > > End top of script
> > > >
> > > > After putting in my directory path with the "use lib", the message I am getting
> > > > now is:
> > > > "Maybe you didn't strip carriage returns after a network transfer".  Does this
> > > > mean anything to you?  If I move the "use lib" above "use CGI qw...", I get
> > > > internal server error.
> > >
> > > Nope, your script looks fine.  (Only thing I'd recommend is a -w on the
> > > top line to help debug).
> >
> > On second thought, if you leave "use lib" where it is, you will end up
> > with two different versions of CGI.pm -- the main module loaded from the
> > older version on your ISP and the cookie part you loaded yourself.  I am
> > assuming you loaded all of CGI.pm rather than just the cookie part.  If
> > so and if you do the stuff with text-mode FTP I recommended in the last
> > message and you get another error, try moving the "use lib" line up
> > above "use CGI".
> >
> > --
> > Jeff
>
> Thanks. Putting the FTP in ascii mode made the difference . One more thing that's a
> little bit different type of a question.  After doing ascii mode, I then got the
> message "Can't call method "value" without a package or object reference".
> <<snippet
> my %cookies = fetch CGI::Cookie;
> my $from = $cookies{'email'}->value;
> end snippet
>
> I want to know if it is OK to remove the "->value" from the line?  Because after I did,
> it worked.  What I mean by OK is, if it is proper practice of perl script writing?
> Thanks very much for getting me over this hurdle!
> P.S. I do have "-w" & "-T", I just forgot to add it earlier.
> Pasquale

Sorry.  I fiqured out why I was getting that error message about the "value".  I didn't set
the cookie yet, before trying.
Thanks again and hopefully I will have enough knowledge be able to assist people here and
return the favor to others that need the help.




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

Date: Tue, 3 Oct 2000 23:33:47 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: some questions
Message-Id: <MPG.14446f1dfe9662b698ae03@nntp.hpl.hp.com>

In article <BAuC5.2538$Tx3.241940@news.uswest.net>, 
jerome@activeindexing.com says...
> <zoo.tv@btinternet.com> elucidates:
> > 
> > <jonrasm@my-deja.com> wrote in message news:8rdis9$g1f$1@nnrp1.deja.com...
> >> I am trying to remove some characters from
> >> strings by using:
> >>
> >> foreach $line (@line)
> >>   {
> >>   $line =~ tr/\"/ /;
> >>   }
> > 
> > Use s/// for this.
> 
> Why?  It's much, much slower.
> 
> Larry will be along any minute and explain why.

No, I won't explain why.  The Benchmark module can demonstrate that is 
is a fact, though.

But Ilya may be along any minute to explain why the dramatically slower 
performance of s/// is an implementation bug. 

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


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

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


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