[25675] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7916 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 29 13:02:18 2005

Date: Tue, 29 Mar 2005 10:02:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Mar 2005     Volume: 10 Number: 7916

Today's topics:
        passing perl variable to output html file andy.t.chou@gmail.com
    Re: passing perl variable to output html file <nospam@bigpond.com>
    Re: passing perl variable to output html file <nobull@mail.com>
    Re: passing perl variable to output html file <spamtrap@dot-app.org>
    Re: passing perl variable to output html file <gregs@trawna.com>
    Re: Perl FAQ in PDF? <mritty@gmail.com>
        perl script at godaddy cgidatabase@yahoo.com
    Re: perl script at godaddy <nobull@mail.com>
    Re: perl script at godaddy axel@white-eagle.invalid.uk
        Perl script hangs (Kurt)
    Re: Perl script hangs <wyzelli@yahoo.com>
    Re: Perl script hangs <phaylon@dunkelheit.at>
        perl update - what about the modules? alythh@netscape.net
    Re: perl update - what about the modules? (Karl Aminov)
    Re: perl update - what about the modules? <tzz@lifelogs.com>
        perl5.8.6 won't install on FreeBSD5.3 ravenslay3r@gmail.com
    Re: perl5.8.6 won't install on FreeBSD5.3 <1usa@llenroc.ude.invalid>
    Re: perl5.8.6 won't install on FreeBSD5.3 <pertti.kosunen@pp.nic.fi>
    Re: piping cmd output  problem <nobull@mail.com>
    Re: piping cmd output problem <dimsol@gmail.com>
        Posting Guidelines conserning the __DATA__ token <lynn.watts@ugs.com>
    Re: Posting Guidelines conserning the __DATA__ token <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 26 Mar 2005 00:14:20 -0800
From: andy.t.chou@gmail.com
Subject: passing perl variable to output html file
Message-Id: <1111824860.861311.61880@l41g2000cwc.googlegroups.com>

I need to be able to have a hidden field (signiture) with each output
html file generated.


# (Get the first and last name from the html form)
$first_name = $q->param('FirstN');
$last_name = $q->param('LastN');


# attempting to pass the variable information to an output html    file

to be used as hidden info needed to use later.


print HISTORY ('<INPUT TYPE="hidden" name="TestFirstN"
value="$first_name"\>');


print HISTORY ('<INPUT TYPE="hidden" name="TestLastN"
value="$last_name"\>');


When my second cgi script calls on the output html file from above..


my $fir = $q->param('TestFirstN');
my $la = $q->param('TestLastN');
print "$fir";
print "$la";


the debug print statements print out $first_name and $last_name instead

of the values that they are suppose to have.  Can someone please help
me with this or provide another solution to basically be able to pass
variable from perl/cgi script to output html file.  Thanks.



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

Date: Sat, 26 Mar 2005 18:16:46 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: passing perl variable to output html file
Message-Id: <3akk3fF6cltdcU1@individual.net>

andy.t.chou@gmail.com wrote:

> print HISTORY ('<INPUT TYPE="hidden" name="TestLastN"
> value="$last_name"\>');

Hint: What is the difference between '' and "" ?

gtoomey


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

Date: Sat, 26 Mar 2005 09:30:05 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: passing perl variable to output html file
Message-Id: <d239o1$n1u$1@sun3.bham.ac.uk>



Gregory Toomey wrote:

> andy.t.chou@gmail.com wrote:
> 
> 
>>print HISTORY ('<INPUT TYPE="hidden" name="TestLastN"
>>value="$last_name"\>');
> 
> 
> Hint: What is the difference between '' and "" ?

Second hint: Since the HTML contains " characters see also the qq 
quoting operator.

Third hint: If $last_name could ever contain the characters '"' or '&' 
or then it needs escaping with something like CGI->escapeHTML(). ( It's 
probably also wise although not strictly necessary if it could ever 
contain '<' or '>').



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

Date: Sat, 26 Mar 2005 09:15:22 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: passing perl variable to output html file
Message-Id: <7ICdncE6x5bm89jfRVn-2Q@adelphia.com>

Gregory Toomey wrote:

> andy.t.chou@gmail.com wrote:
> 
>> print HISTORY ('<INPUT TYPE="hidden" name="TestLastN"
>> value="$last_name"\>');
> 
> Hint: What is the difference between '' and "" ?

Meta-hint: Have a look in "perldoc perlop" to find out, in the "Quote and
Quote-like Operators" section.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sat, 26 Mar 2005 12:07:44 -0500
From: Greg Schmidt <gregs@trawna.com>
Subject: Re: passing perl variable to output html file
Message-Id: <85ibthubo94w$.dlg@trawna.com>

On 26 Mar 2005 00:14:20 -0800, andy.t.chou@gmail.com wrote:

> I need to be able to have a hidden field (signiture) with each output
> html file generated.
> 
> # (Get the first and last name from the html form)
> $first_name = $q->param('FirstN');
> $last_name = $q->param('LastN');
> 
> # attempting to pass the variable information to an output html    file
> 
> to be used as hidden info needed to use later.
> 
> print HISTORY ('<INPUT TYPE="hidden" name="TestFirstN"
> value="$first_name"\>');
> 
> print HISTORY ('<INPUT TYPE="hidden" name="TestLastN"
> value="$last_name"\>');
> 
> When my second cgi script calls on the output html file from above..
> 
> my $fir = $q->param('TestFirstN');
> my $la = $q->param('TestLastN');
> print "$fir";
> print "$la";
> 
> the debug print statements print out $first_name and $last_name instead
> 
> of the values that they are suppose to have.  Can someone please help
> me with this or provide another solution to basically be able to pass
> variable from perl/cgi script to output html file.  Thanks.

What others have said is certainly all good to know, but in this
particular situation, since you're already using CGI.pm, you might look
up the "hidden" function in that module.  I don't know whether you'd
need to use escapeHTML in conjunction with it; I suspect it would
automatically handle such details internally.

-- 
Greg Schmidt  gregs@trawna.com
  Trawna Publications  http://www.trawna.com/


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

Date: Fri, 25 Mar 2005 12:57:15 GMT
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Perl FAQ in PDF?
Message-Id: <LUT0e.16328$aS5.15752@trndny05>

Zack wrote:
> Where I can find Perl FAQ in PDF, or some suitable format to read it 
> offline?
> Right web address for Perl FAQ is 
> http://www.perldoc.com/perl5.8.4/pod/perlfaq.html?

Read it offline by installing Perl on your system and then typing
perldoc perlfaq
at your command prompt.

Paul Lalli


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

Date: 28 Mar 2005 00:28:40 -0800
From: cgidatabase@yahoo.com
Subject: perl script at godaddy
Message-Id: <1111998520.399605.247090@l41g2000cwc.googlegroups.com>

I've been trying to get my perl program going at godaddy.
all I'm trying to do is open a file and read it and write to a file. It
seems to go through the motions witout errors but doesn't produce any
results.
This script works on another server ok but doesn't at godaddy.
i have emailed support and they want to charge for looking at my
script. i'm cheap i know but what i'm trying to do is not that
complicated. thanks for any help.
Tim

$afile = "../folder/afile.htm";

$tempfile = "../folder/temp1.htm";

open(FILB1,"$afile") || die "tryin FILE\n";
@data1 = <FILB1>;
close(FILB1);

open(TEMPFILE,">$tempfile") || die "trying tempfile\n";

foreach $d (@data1)
{
chop($d);
print TEMPFILE "$d\n";
if ($d =~ /<! -- BEGINNING -- >/i)
{
print TEMPFILE "$in{'email'}<br>"$in{'message'}<hr>\n\n";
}
}
close(TEMPFILE);
rename ("$afile", "$afile.old");
rename ("$tempfile", "$afile");
exit(0);



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

Date: Mon, 28 Mar 2005 09:48:59 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: perl script at godaddy
Message-Id: <d28jjf$qpn$1@sun3.bham.ac.uk>

cgidatabase@yahoo.com wrote:

> I've been trying to get my perl program going at godaddy.
> all I'm trying to do is open a file and read it and write to a file. It
> seems to go through the motions witout errors but doesn't produce any
> results.

How do you reconcile "goes through the motions" and "doesn't produce any 
results".  It is impossible to infer that it is going through any 
motions other than by observing results.

Anyhow it's impossible that it "doesn't produce any results".  A blank 
page is a result.  A timeout is a result.  Unless running your script 
actually causes the passage time to cease there must be some result. 
(Although arguably even that would be a result of sorts).

> This script works on another server ok but doesn't at godaddy.
> i have emailed support and they want to charge for looking at my
> script.

Yeah, well it is hardly pleasant to look at is it?

No variable declarations.

No indentation.

A couple of race conditions.

Errors not included in the error messges.

Calls to an operating system fuction (rename()) without checking to see 
if/why it failed.

Redundant quoting of string variables.

chop() where you probably meant chomp() but really shouldn't bother at all.

Forgets to escapeHTML when inserting plaintext into an HTML document.

It even looks like it may be using the nasty old cut-n-paste CGI request 
parser.



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

Date: Mon, 28 Mar 2005 18:23:28 -0600
From: axel@white-eagle.invalid.uk
Subject: Re: perl script at godaddy
Message-Id: <tcWdnaRQIeWdPdXfRVn-3w@adelphia.com>

cgidatabase@yahoo.com wrote:
> This script works on another server ok but doesn't at godaddy.

If it does, it shouldn't.

> print TEMPFILE "$in{'email'}<br>"$in{'message'}<hr>\n\n";
                                 ^^^

Axel



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

Date: 29 Mar 2005 04:59:36 -0800
From: kurt.semba@gmx.de (Kurt)
Subject: Perl script hangs
Message-Id: <4ac4c245.0503290459.52d59ed@posting.google.com>

Hi,

I have a perl (5.8.3) daemon running that hangs very strangely.

It will work for 6-12 hours and then it will hang in a way that 

- it won't log anything anymore (I'm logging pretty regularly)
- logging stops at various points of the code and even: the last
logged message is often even incomplete!
- "top" shows me a CPU usage of 99.9% for its process-id

I have no clue what the process does but it is alive but surely not
functioning anymore.

Help is appreciated,
Kurt


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

Date: Tue, 29 Mar 2005 13:11:00 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: Perl script hangs
Message-Id: <Etc2e.16742$C7.2449@news-server.bigpond.net.au>

"Kurt" <kurt.semba@gmx.de> wrote in message 
news:4ac4c245.0503290459.52d59ed@posting.google.com...
: Hi,
:
: I have a perl (5.8.3) daemon running that hangs very strangely.
:
: It will work for 6-12 hours and then it will hang in a way that
:
: - it won't log anything anymore (I'm logging pretty regularly)
: - logging stops at various points of the code and even: the last
: logged message is often even incomplete!
: - "top" shows me a CPU usage of 99.9% for its process-id
:
: I have no clue what the process does but it is alive but surely not
: functioning anymore.


no shebang
no 'use strict'
no 'use warnings'
no variables defined
no procedural statements
no print statements
in fact no anything....

bit hard to help really....

:)

P 




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

Date: Tue, 29 Mar 2005 15:36:37 +0200
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Perl script hangs
Message-Id: <pan.2005.03.29.13.36.36.527708@dunkelheit.at>

Kurt wrote:

> Help is appreciated

"You are doing something wrong, maybe." *scnr*.

For maybe real help: Do you check the return values of your open's,
close's and so on? Do you use warnings and strict? Have you turned off
buffering (per C<$|++>)? So you could maybe see more exactly where your
script hangs.

Without codeparts there's nothing else that would come into my mind at
this point. Maybe you find something in common on the parts that stopped
working.

hth,p

-- 
http://www.dunkelheit.at/
bellum omnium pater.



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

Date: 29 Mar 2005 03:05:26 -0800
From: alythh@netscape.net
Subject: perl update - what about the modules?
Message-Id: <1112094326.260378.28700@l41g2000cwc.googlegroups.com>

I am running a faithful RedHat7.3 box - so my Perl version is v5.6.1.
I was thinking about updating to the current Perl version
(5.8.something, right?), since I'm getting tired of receiving errors
about:
--- Error:  Constant name 'HASH(0x822f93c)' has invalid characters at
<filename> line xxx   (damn constant.pm!)

 ... but I was thinking: what happens to all the modules I've installed
- and they're quite a lot? I have to re-install everything????

thanks for any info

Alessandro Magni



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

Date: 29 Mar 2005 06:49:04 -0800
From: aminov@edv.bvg.de (Karl Aminov)
Subject: Re: perl update - what about the modules?
Message-Id: <106a291b.0503290649.58dddde2@posting.google.com>

alythh@netscape.net wrote in message news:<1112094326.260378.28700@l41g2000cwc.googlegroups.com>...
> I am running a faithful RedHat7.3 box - so my Perl version is v5.6.1.
> I was thinking about updating to the current Perl version
> (5.8.something, right?), since I'm getting tired of receiving errors
> about:
> --- Error:  Constant name 'HASH(0x822f93c)' has invalid characters at
> <filename> line xxx   (damn constant.pm!)
> 
> ... but I was thinking: what happens to all the modules I've installed
> - and they're quite a lot? I have to re-install everything????


Yes, that's the cleanest solution.
A rude, but working solution is to include the old library path in
your perl script:

#! /usr/bin/perl
use lib '/usr/lib/perl5/site_perl/5.6.1';

A better solution is to install all libs with the CPAN Perl Module
(interactive command line interface)

user @bash> cpan
>install MIME::Lite
 ...


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

Date: Tue, 29 Mar 2005 11:04:29 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: perl update - what about the modules?
Message-Id: <4nr7hy1lrm.fsf@lifelogs.com>

On 29 Mar 2005, alythh@netscape.net wrote:

> I am running a faithful RedHat7.3 box - so my Perl version is v5.6.1.
> I was thinking about updating to the current Perl version
> (5.8.something, right?), since I'm getting tired of receiving errors
> about:
> --- Error:  Constant name 'HASH(0x822f93c)' has invalid characters at
> <filename> line xxx   (damn constant.pm!)
> 
> ... but I was thinking: what happens to all the modules I've installed
> - and they're quite a lot? I have to re-install everything????

The CPAN module can generate a snapshot bundle, which will make
reinstalling everything from CPAN easier.  From "perldoc CPAN":

autobundle

       "autobundle" writes a bundle file into the
       "$CPAN::Config->{cpan_home}/Bundle" directory. The file
       contains a list of all modules that are both available from
       CPAN and currently installed within @INC. The name of the
       bundle file is based on the current date and a counter.

This is not a silver bullet, but it will help you immensely if you
have a sizeable base of CPAN modules.

Good luck
Ted

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


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

Date: 28 Mar 2005 20:11:14 -0800
From: ravenslay3r@gmail.com
Subject: perl5.8.6 won't install on FreeBSD5.3
Message-Id: <1112069474.920712.119350@l41g2000cwc.googlegroups.com>

has anyone encountered problems installing Perl5.8.6 on FreeBSD 5.3
Stable?
I'm trying to do it to install KDE3.4 on a clean install of FreeBSD.

Everytime I update to the new perl, if i try to compile everything else
it goes into an infinite loop, essentially telling me Automake, and
AutoConf are not installed. Once I hit that point I can't install
anything, including Automake and Autoconf.

The only system change i've made since this last happened was that I
had the CXXFLAGS line uncommented by accident in /etc/make.conf and now
i have fixed that. I don't *think* that would affect this though.

I also just saw the instructions here:
http://www.freshports.org/lang/perl5.8/

but am not sure they would work because once I've done the first step
my system is already FUBAR and I doubt the final step would do anything
except hit my infinite loop again.

Alas if there are no other suggestions I may be trying this soon
anyways, but i've already tried installing FreeBSD from scratch 5 times
this weekend (because of this issue) and would like to get it right
this time. 

Any help would be appreciated!
Much Thanks,
RavenSlay3r



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

Date: Tue, 29 Mar 2005 04:19:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl5.8.6 won't install on FreeBSD5.3
Message-Id: <Xns9627ED350F5CEasu1cornelledu@127.0.0.1>

ravenslay3r@gmail.com wrote in news:1112069474.920712.119350
@l41g2000cwc.googlegroups.com:

> has anyone encountered problems installing Perl5.8.6 on FreeBSD 5.3
> Stable?
> I'm trying to do it to install KDE3.4 on a clean install of FreeBSD.
> 
> Everytime I update to the new perl, if i try to compile everything
> else it goes into an infinite loop, essentially telling me Automake,

How are you doing this? I have installed various versions of FreeBSD over 
time (although not 5.3). In each case, I upgraded Perl after installation 
using the ports collection. 

Sinan


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

Date: Tue, 29 Mar 2005 13:33:33 +0300
From: Pertti Kosunen <pertti.kosunen@pp.nic.fi>
Subject: Re: perl5.8.6 won't install on FreeBSD5.3
Message-Id: <saa2e.4527$37.1290@reader1.news.jippii.net>

ravenslay3r@gmail.com wrote:
> Everytime I update to the new perl, if i try to compile everything else
> it goes into an infinite loop, essentially telling me Automake, and
> AutoConf are not installed. Once I hit that point I can't install
> anything, including Automake and Autoconf.

Did you read /usr/ports/UPDATING ?


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

Date: Wed, 23 Mar 2005 08:55:28 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: piping cmd output  problem
Message-Id: <d1raj3$mn4$2@sun3.bham.ac.uk>

dimsol@gmail.com wrote:

> Hi
> 
> I have the following scenarion:
> 
> open(FILE, "some_cmd |") || die "some error message";
> my $output = <FILE>;
> close(FILE) || die "some error message";
> 
> The problem is that some_cmd failes (exit status 1) and prints error
> message to STDOUT.
> 
> The return value of open() according to man pages is the pid of forked
> process.
> Now, the problem, how I can find out that some_cmd failed.

Think logically.  You cannot get this answer from open() because that 
would need information to travel backwards in time.  So perhaps the 
information is available from close().

perldoc -f close



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

Date: 23 Mar 2005 02:19:29 -0800
From: "dimsol@gmail.com" <dimsol@gmail.com>
Subject: Re: piping cmd output problem
Message-Id: <1111573169.490394.4910@z14g2000cwz.googlegroups.com>

Parsing output of some_cmd is not good idea, since I can't filter all
error messages (I just don't know all possibilities and in the future
the author of some_cmd can add/modify them).

The safest and the simplest way is to know exit status of some_cmd.
$? returns zero.
close doesn't fail (since FILE is open file descriptor)

Dima



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

Date: Fri, 25 Mar 2005 12:20:32 -0800
From: "lynn" <lynn.watts@ugs.com>
Subject: Posting Guidelines conserning the __DATA__ token
Message-Id: <424471a3$1@usenet.ugs.com>

Hi All,

The posting guidelines are a great resource for us newbie's but sometimes
they are not as clear
as they could be. An example of this is the use of the __DATA__ token. From
the guidelines

"Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program."

This is good but it does not show an example of how to do this. I checked
the perldata documentation (perldoc perldata) and the explantion is OK
but the docs in Selfloader I think are better (perldoc Selfloader)
Would it be possible to (at least add) the Selfloader reference to the
guidelines? Something like
__DATA__ token (Selfloader.pod ,perldata.pod) to provide the file...

Thanks

Lynn




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

Date: Fri, 25 Mar 2005 16:40:50 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Posting Guidelines conserning the __DATA__ token
Message-Id: <slrnd494ri.dhl.tadmc@magna.augustmail.com>


[ If you want to ensure that the maintainer of the guidelines sees
  suggestions for changes, then the suggestion should appear as
  a followup to the posting of the guidelines themselves rather
  than in an unrelated thread that may be unnoticed.
]


lynn <lynn.watts@ugs.com> wrote:

> The posting guidelines are a great resource for us newbie's but sometimes
> they are not as clear
> as they could be. An example of this is the use of the __DATA__ token. From
> the guidelines
> 
> "Describe *precisely* the input to your program. Also provide example
> input data for your program. If you need to show file input, use the
> __DATA__ token (perldata.pod) to provide the file contents inside of
> your Perl program."


I don't see how the *guideline* could be made any more clear.

   Use the __DATA__ token

is the guideline.


> This is good but it does not show an example of how to do this. 


Another guideline is to have "use strict". Must the guidelines
show how to use that too?

And show how to use "use warnings"?

and ...

 ... what started as mere guidelines that someone could read in
10 minutes becomes the Perl Documentation that takes a week
to read it all.

The guidelines are not the documentation for Perl.


> I checked
> the perldata documentation (perldoc perldata) and the explantion is OK


Then if they follow the guideline as-is, they will discover how
to use the __DATA__ token.

What is the problem to be solved here?


> but the docs in Selfloader I think are better (perldoc Selfloader)

(perldoc SelfLoader, case matters...)

perldata.pod already points there.


> Would it be possible to (at least add) the Selfloader reference to the
> guidelines? 


No, it is not needed.

It suggests perldata.pod.

perldata.pod suggests Selfloader.

A conscientious programmer would already be led to the docs 
you recommend they see.

(and the guidelines are not for unconscientious programmers, they're
 not going to listen anyway.
)

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


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 7916
***************************************


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