[12041] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5640 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 12 14:27:16 1999

Date: Wed, 12 May 99 11:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 12 May 1999     Volume: 8 Number: 5640

Today's topics:
    Re: "Text file busy" error <jsware@att.com>
    Re: [Fwd: my hands are tied] (Andrew Allen)
    Re: [Fwd: my hands are tied] <gbartels@xli.com>
    Re: Accessing lexicals outside of scope? Any workaround zenin@bawdycaste.org
    Re: Accessing lexicals outside of scope? Any workaround (Andrew Allen)
        Can you check this script please? i am a perl newbie! <m.shapcott@NOSPAMvirgin.net>
        Can't call method "isaCGI" on unblessed reference at (e <bwlang@genome.wi.mit.edu>
        cgi submitting a form to another server michael_555@my-dejanews.com
    Re: change system time to mm/dd/yy format (Larry Rosler)
    Re: change system time to mm/dd/yy format (Charles R. Thompson)
    Re: change system time to mm/dd/yy format (Charles R. Thompson)
    Re: Exists win32 equivalent for fork? <cassell@mail.cor.epa.gov>
    Re: FAQ 9.10: How do I redirect to another page? <sstarre@my-dejanews.com>
    Re: Getting Access to Perl - how? <spike1965@worldnet.att.net>
        Getting file date (Howie)
    Re: Getting file date (Greg Bacon)
    Re: Here documents and indention. (Charles R. Thompson)
    Re: How do I get a hash slice as a hash in a Perlish wa <aqumsieh@matrox.com>
        How to CHMOD to 755 using check boxes? <mrblue@pd.jaring.my>
        Installing PERL on NT Server <jason@hyperspot.com>
        Matching & substituting escaped characters in a regexp. (jon ewing)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 May 1999 13:11:41 -0400
From: "John S. Ware" <jsware@att.com>
Subject: Re: "Text file busy" error
Message-Id: <3739B64D.C5443BB3@att.com>

in UNIX the text part of a program is the code (as opposed to data), I
remember getting "text file busy" errors under UNIX System V if you
tried to modify the file of a running program. I guess it is locked
since you wouldn't want to change something while the OS is trying to
swap pages into memory. I didn't think this held with perl, since perl
reads and translates the complete source before execution.

for anything beyond a couple of lines CGI, using the CGI module is a
great idea - you can run it for testing from the command line.

jsw

Timothy Larson wrote:
> 
> In article <37302bb5.1393007@news.skynet.be>,
> Bart Lateur <bart.lateur@skynet.be> wrote:
> >Timothy Larson wrote:
> >
> >>OK, I'm not trying to overwrite anything intentionally.  All I know is that
> >>I will get one or two runs out of the script (from the command line or
> >>web hits, whatever) and then the "text file busy" errors start in.  If I
> >>wait long enough they stop, and I can use the script a few more times.  I'm
> >>admittedly a newbie to using Perl, but this doesn't happen with CGI's I
> >>have written in other languages.  Is there something special I need to
> >>do in Perl to say "Hey, I'm done now" other than simple program termination?
> >>I can't very well have a CGI that only works half the time, now, can I?
> >>:)
> >
> >Platform? I don't think you can get a "file busy" error on Unix. On
> >other platforms, yes, but that's because of implicit file locking. Unix
> >gladly lets multiple programs open a file for writing at the same time
> >(urgh!). Not so on Windows, DOS, or Mac, to name a few.
> >
> >On those platforms, try making the script wait a while (see sleep()) and
> >then retry.
> >
> >Maybe you're suffering from some sort of file caching problem. Explicit
> >flushing should then solve that. Close the file explicitely, that might
> >help.
> >
> >       Bart.
> 
> Thanks, I will try closing my data files explicitly.  However, given that
> Perl is (in general) so good with error messages, you'd think it would tell
> me that it is my data files that are busy, not the perl files.
> I'm not very hopeful on this one, because I've hit the same problem a few
> times with a form-to-email script that doesn't open data files.
> My platform, BTW, is linux 2.0.34.  We're running perl5 here, too.
> 
> Tim


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

Date: 12 May 1999 16:47:39 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: [Fwd: my hands are tied]
Message-Id: <7hcbbb$4t5$1@fcnews.fc.hp.com>

Greg Bartels (gbartels@xli.com) wrote:
: Andrew Allen wrote:
: > 
: > Greg Bartels (gbartels@xli.com) wrote:

: > : my $first; tie $first, 'stoplight', \$first, 4;
: > : is about as ugly as you can get.
: > 
: > : is there anyway to write a subroutine that I could
: > : say something like:
: > : my $first = magic_routine(4);
: > 
: > Yes. Just write it:
: > 
: > sub magic_routine
: > {
: >   my $tievar;
: >   tie $tievar,'stoplight',\$tievar,@_;
: >   return $tievar;
: > }
: > 
: > Andrew

: I've already tried a version of your magic_routine, the problem
: is $tie_var is tied, but $first is not.
: something gets lost when you return $tievar.

Absolutely right. Temporary brain damage...

sub my_tie
{
  tie $_[0],'stoplight',\$_[0],@_[1..$#_];
}

and then

my_tie($first,7);

Andrew


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

Date: Wed, 12 May 1999 12:24:06 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: [Fwd: my hands are tied]
Message-Id: <3739AB26.68A59514@xli.com>

Andrew Allen wrote:
> 
> Greg Bartels (gbartels@xli.com) wrote:
> : Andrew Allen wrote:
> : >
> : > Greg Bartels (gbartels@xli.com) wrote:
> 
> : > : my $first; tie $first, 'stoplight', \$first, 4;
> : > : is about as ugly as you can get.
> : >
> : > : is there anyway to write a subroutine that I could
> : > : say something like:
> : > : my $first = magic_routine(4);
> : >
> : > Yes. Just write it:
> : >
> : > sub magic_routine
> : > {
> : >   my $tievar;
> : >   tie $tievar,'stoplight',\$tievar,@_;
> : >   return $tievar;
> : > }
> : >
> : > Andrew
> 
> : I've already tried a version of your magic_routine, the problem
> : is $tie_var is tied, but $first is not.
> : something gets lost when you return $tievar.
> 
> Absolutely right. Temporary brain damage...
> 
> sub my_tie
> {
>   tie $_[0],'stoplight',\$_[0],@_[1..$#_];
> }
> 
> and then
> 
> my_tie($first,7);
> 
> Andrew

wow, thanks. I never would have figured that one out.

theres something about the @_ variable that I'm not understanding.
I thought it was like a stack that contained a copy of hte
variables for subroutine call, but your code shows there is 
some kind of underlying difference. if it was just a copy,
then saying my $temp = shift; tie $temp ..... blah....
would be the same as tie $_[0] ... blah ....
but since tie'ing $temp doesn't work, there is something going
on underneath it all.

thanks again for the help.

Greg


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

Date: 12 May 1999 17:21:07 GMT
From: zenin@bawdycaste.org
Subject: Re: Accessing lexicals outside of scope? Any workarounds?
Message-Id: <926529804.876867@thrush.omix.com>

Julien B Beasley <jbb@my-dejanews.com> wrote:
: Problem: I am writing extra code to computer generated code.
: Specifically , I am using specPerl to generate gui template code that I
: then write specific subroutines for. The problem is that specPerl's
: interface for writing the code isn't very good. I can specify an
: external editor like xemacs to write add-on code, but specPerl wants me
: to kill xemacs before generating the code (taking my add-ons into
: account), and it becomes annoying to have to shutdown and restart xemacs
: everytime I want to make a minor change.

	This is a fault of BloatXEmacs, not specPerl.

: So I figured I would put all my extra code in file called mylib.pl, and
: just put "require 'mylib.pl'" where I normally add my own code to the
: generated code. The problem is that the generated code creates lexicals,
: and part of my add-on code involves those lexicals.

	I'm assuming you need to specify call backs that involve lexicals?

: What I wanted to have is a nice, seperate file (library or module) that I
: can edit at my convenience that can be independent from generated code
: file. However, it seems that as soon as I go into a new file, I leave
: scope, and lose track of all lexicals.

	Yep.

: Can anyone please help with my problem?

	Get a better editor.  I'd recommend joe (Joe's Own Editor) in
	"jmacs" mode.  Small, *fast*, and in jmacs mode you won't have
	to learn any new bindings.

-- 
-Zenin (zenin@archive.rhps.org)

        My code is filled with comments!  It's just that my comments are
        written in Perl.


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

Date: 12 May 1999 17:29:28 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Accessing lexicals outside of scope? Any workarounds?
Message-Id: <7hcdpo$4t5$2@fcnews.fc.hp.com>

Julien B Beasley (jbb@my-dejanews.com) wrote:
: I am writing a library, and I need to access the calling code's
: lexicals. Everything I've read says there is no way to do this. Is there
: perhaps another way to get around my problem?

: I can specify an
: external editor like xemacs to write add-on code, but specPerl wants me
: to kill xemacs before generating the code (taking my add-ons into
: account), and it becomes annoying to have to shutdown and restart xemacs

use gnuclient. See the gnuserv(1) manpage with your emacs distribution.

: everytime I want to make a minor change. So I figured I would put all my
: extra code in file called mylib.pl, and just put "require 'mylib.pl'"
: where I normally add my own code to the generated code. The problem is
: that the generated code creates lexicals, and part of my add-on code
: involves those lexicals.

how about something like

BEGIN {eval `cat mylib.pl`;}

It's not pretty, but...

(course, you might want to check @INC, file existence, check $@, etc.)

Andrew


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

Date: Wed, 12 May 1999 17:41:23 +0100
From: "Tim Shapcott" <m.shapcott@NOSPAMvirgin.net>
Subject: Can you check this script please? i am a perl newbie!
Message-Id: <7hcb15$n8l$1@nclient3-gui.server.virgin.net>

This is a multi-part message in MIME format.

------=_NextPart_000_0018_01BE9C9E.A75CDF80
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0019_01BE9C9E.A75CDF80"


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

Hi folks
=20
I am completely new to cgi/perl, so i know practically nothing about it. =
I'm trying to learn as i go along.
I have this script for a guestbook for my site, but as i know nothing i =
don't know whether it is likely to work or not. it is basically someone =
else's script that i downloaded, i just modified it to do what i need it =
to.
Do you think that you could possibly check it, to see if it would =
work???
=20
TIA
=20
Tim Shapcott

------=_NextPart_001_0019_01BE9C9E.A75CDF80
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>
<DIV><FONT color=3D#000000><FONT size=3D3>Hi folks</FONT></FONT><FONT=20
size=3D3></FONT></DIV>
<DIV><FONT color=3D#000000><FONT size=3D3></FONT></FONT><FONT=20
size=3D3></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3>I am completely new to =
cgi/perl, so i=20
know practically nothing about it. I'm trying to learn as i go=20
along.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3>I have this script for a =
guestbook for=20
my site, but as i know nothing i don't know whether it is likely to work =
or not.=20
it is basically someone else's script that i downloaded, i just modified =
it to=20
do what i need it to.</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3>Do you think that you =
could possibly=20
check it, to see if it would work???</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3>TIA</FONT></DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 face=3D"" size=3D3>Tim=20
Shapcott</FONT></DIV></DIV></BODY></HTML>

------=_NextPart_001_0019_01BE9C9E.A75CDF80--

------=_NextPart_000_0018_01BE9C9E.A75CDF80
Content-Type: application/octet-stream;
	name="guest.cgi"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="guest.cgi"

#!/usr/local/bin/perl

$directory_gbook =3D =
"http://www.moreno-band.freeserve.co.uk/guestsv.html";
$guestbook =3D "http://www.moreno-band.freeserve.co.uk/guestsv.html";
$cgi =3D "http://thor.prohosting.com/~nmoreno/html/cgi-bin/guest.cgi";
$base =3D "http://www.moreno-band.freeserve.co.uk/";

$mail =3D 1;
$mailto =3D 'moreno_band@hotmail.com';

############################################################
$mailprog =3D '/usr/lib/sendmail';
$entry =3D 1;
$allow =3D 1;
$date_command =3D "/usr/bin/date";
############################################################
$date =3D `$date_command +"%B %d, %Y"`; chop($date);

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs =3D split(/&/, $buffer);
foreach $pair (@pairs) {
	($name, $value) =3D split(/=3D/, $pair);
	$value =3D~ tr/+/ /;
	$value =3D~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
	$value =3D~ s/<!--(.|\n)*-->//g;
=09
	if ($allow !=3D 1) {
		$value =3D~ s/<([^>]|\n)*>//g;
	}
=09
	$FORM{$name} =3D $value;
}

########
#Checks to see that the comments, name and e-mail address were added!
&no_comments unless $FORM{'message'};
&no_name unless $FORM{'name'};
&no_email unless $FORM{'email'};

######
#Checks to see if the E-mail address is in the normal form

if (&email_check($FORM{'email'})) {
}
else {
	&no_email;
}

#######
#Opens 'guestsv.html' for writting
open (FILE,"$directory_gbook") || die "Can't Open $directory_gbook: =
$!\n";
@LINES=3D<FILE>;
close(FILE);
$SIZE=3D@LINES;

# Open Link File to Output
open (GUEST,">$directory_gbook") || die "Can't Open $directory_gbook: =
$!\n";

for ($i=3D0;$i<=3D$SIZE;$i++) {
	$_=3D$LINES[$i];
	if (/<!--add-->/) {
		if ($entry eq '1') {
			print GUEST "<p></p>\n";
		}
		print GUEST "<table border=3D4>\n";
		if ( $FORM{'name'}) {
				print GUEST "<tr valign=3Dtop><td width=3D"20%"><h3>Name</h3></td> =
<td width=3D"80%"><b>$FORM{'name'} - $date</b></td></tr>\n";
		}
		if ($FORM{'email'}) {
				print GUEST "<tr valign=3Dtop><td><h3>Email Address</h3></td> =
<td><b><a href=3D"mailto:$FORM{'email'}\"> =
$FORM{'email'}</a></b></td></tr>\n";
		}
		if ($FORM{'url'} ne "http://") {
				print GUEST "<tr valign=3Dtop><td><h3>Homepage</h3></td> <td><b><a =
href=3D$FORM{'url'}>$FORM{'url'}</a></b></td></tr>\n";
		}
		if ( $FORM{'howfind'} ){
				print GUEST "<tr valign=3Dtop><td><h3>How you found the =
site</h3></td> <td><b>$FORM{'howfind'}"</b></td></tr>\n";
		}
		if ( $FORM{'message'} ){
				print GUEST "<tr valign=3Dtop><td><h3>Message</h3></td> =
<td><b>$FORM{'message'}</b></td></tr>\n";
			print GUEST "</table>\n";
			if ($entry eq '0') {
				print GUEST "<!--add->\n";
			}
		}
		else {
			print GUEST $_;
		}
	}
}
close (GUEST);

##############
# Print Thank You HTML
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<TITLE>Thank You</TITLE>\n";
print "<BODY BGCOLOR=3D#FFFFFF =
background=3D"http://www.moreno-band.freeserve.co.uk/background.jpg" =
bgproperties=3D"fixed">\n";
print "<h1 align=3D"center">Thankyou $FORM{'name'}!<BR>\n";
print "Your entry has been added to our";
print "<A HREF=3D\"$guestbook\"> guestbook.</A><P>\n";
print "Here is what you submitted:<P>\n";

if ( $FORM{'name'}) {
		print "<B>Name:</B> $FORM{'name'} - $date<BR>\n";
}
if ($FORM{'email'}) {
		print "<B>My E-mail:</B> <a href=3D\"mailto:$FORM{'email'}\"> =
$FORM{'email'}</a><BR>\n";
}
if ($FORM{'url'} ne "http://") {
		print "<B>My URL:</B> <a href=3D$FORM{'url'}>$FORM{'url'}</a><BR>\n";
}
if ($FORM{'howfind'}) {
		print "<B>How you found the site:</b> $FORM{'howfind'}<BR>\n"
}
else {
}

print "<BR><BR><B>Comments:</B>\n";
print "$FORM{'message'}<BR>\n";
print "</body></html>\n";
exit;


#######################
# Subroutines
sub no_name {
	print "Content-type: text/html\n\n";
	print "<HTML>\n";
	print "<TITLE>No Name</TITLE>\n";
	print "<BODY BGCOLOR=3D#FFFFFF =
background=3D"http://www.moreno-band.freeserve.co.uk/background.jpg" =
bgproperties=3D"fixed">\n";
	print "<h1 align=3D"center">No Name</h1>\n";
	print "<p>You forgot to fill in your Name. We need this in order to\n";
	print "process your entry. Please add your name in the blank =
below.</p>\n";
	print "<p><TABLE  CELLSPACING=3D3 CELLPADDING=3D2>\n";
	print "<FORM METHOD=3DPOST ACTION=3D\"$cgi\">\n";
	print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"name\" =
";
	print "SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"email\" ";
	print "VALUE=3D\"$FORM{'email'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"url\" ";
	print "VALUE=3D\"$FORM{'url'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>How you found the site</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"howfind\" ";
	print "VALUE=3D\"$FORM{'howfind'}\" SIZE=3D15>\n";
	print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
	print "<TR><TD><B>Message</B></TD><TD>Comments are stored and saved";
	print "<INPUT TYPE=3DHIDDEN NAME=3D\"message\" ";
	print "VALUE=3D\"$FORM{'message'}\"></TD></TR>\n";
	print "<TR><TD>&nbsp;&nbsp;</TD><TD></TD></TR>\n";
	print "</TABLE>\n";
	print "</FORM>\n";
	print "</BODY></HTML>\n";
	exit;
}

sub no_email {
	print "Content-type: text/html\n\n";
	print "<HTML>\n";
	print "<TITLE>No E-Mail</TITLE>\n";
	print "<BODY BGCOLOR=3D#FFFFFF =
background=3D"http://www.moreno-band.freeserve.co.uk/background.jpg" =
bgproperties=3D"fixed">\n";
	print "<h1 align=3D"center">No Email</h1><BR>\n";
	print "You forgot to fill in your E-mail address or the e-mail addres =
you added\n";
	print "is invalid. We need this in order to\n";
	print "process your entry. Please add your E-mail in the blank =
below.<p>\n";
	print "<TABLE  CELLSPACING=3D3 CELLPADDING=3D2>\n";
	print "<FORM METHOD=3DPOST ACTION=3D\"$cgi\">\n";
	print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"name\" =
VALUE=3D\"$FORM{'name'}\" ";
	print "SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"email\" ";
	print "VALUE=3D\"$FORM{'email'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"url\" ";
	print "VALUE=3D\"$FORM{'url'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>How you found us:</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"howfind\" ";
	print "VALUE=3D\"$FORM{'howfind'}\" SIZE=3D15>\n";
	print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
	print "<TR><TD><B>Comments:</B></TD><TD>Comments are stored and saved";
	print "<INPUT TYPE=3DHIDDEN NAME=3D\"comments\" ";
	print "VALUE=3D\"$FORM{'comments'}\"></TD></TR>\n";
	print "<TR><TD>&nbsp;&nbsp;</TD><TD></TD></TR>\n";
	print "</TABLE>\n";
	print "</FORM>\n";
	print "</BODY></HTML>\n";
	exit;
}

sub no_comments {
	print "Content-type: text/html\n\n";
	print "<HTML>\n";
	print "<TITLE>No Comments</TITLE>\n";
	print "<BODY BGCOLOR=3D#FFFFFF =
background=3D"http://www.moreno-band.freeserve.co.uk/background.jpg" =
bgproperties=3D"fixed">\n";
	print "<h1 align=3D"center">No Comments</h1><BR>\n";
	print "You forgot to fill in your Message. We need this in order to\n";
	print "process your entry. Please add a comment in the blank =
below.<p>\n";
	print "<TABLE CELLSPACING=3D3 CELLPADDING=3D2>\n";
	print "<FORM METHOD=3DPOST ACTION=3D\"$cgi\">\n";
	print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"name\" =
";
	print "VALUE=3D\"$FORM{'name'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"email\" ";
	print "VALUE=3D\"$FORM{'email'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=3DTEXT NAME=3D\"url\" ";
	print "VALUE=3D\"$FORM{'url'}\" SIZE=3D50></TD></TR>\n";
	print "<TR><TD><B>How you found us:</B></TD><TD><INPUT TYPE=3DTEXT =
NAME=3D\"howfind\" ";
	print "VALUE=3D\"$FORM{'howfind'}\" SIZE=3D15>\n";
	print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
	print "<TR><TD><B>Comments:</B></TD><TD><TEXTAREA NAME=3D\"comments\" =
";
	print "COLS=3D50 ROWS=3D7></TEXTAREA><p>\n";
	print "<TR><TD>&nbsp;&nbsp;</TD><TD></TD></TR>\n";
	print "</TABLE>\n";
	print "</FORM>\n";
	print "\n</BODY></HTML>\n";
	exit;
}

sub email_check {
	local($emails) =3D $_[0];
=09
	if ($emails =3D~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ ||
		($emails !~ /^.+\@localhost$/ &&
			$emails !~ /^.+\@\[?(\w|[-.])+\.[a-zA-Z]{2,3}|[0-9]{1,3}\]?$/)) {
			return(0);
	}
=09
	else {
		return(1);
	}
}
1;

------=_NextPart_000_0018_01BE9C9E.A75CDF80--



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

Date: Wed, 12 May 1999 13:53:14 -0400
From: "Bradley W. Langhorst" <bwlang@genome.wi.mit.edu>
Subject: Can't call method "isaCGI" on unblessed reference at (eval 11) line 1.
Message-Id: <3739C009.F9D23963@genome.wi.mit.edu>

okay
my program seems to work okay but i get this nasty
message on every page.  Here is what I am doing.

I have a main cgi script that calls  functions in
 .pm files to generate various pages.
I get a query object in the main function buy
$q = new CGI
$q->header();
I am passing the function ($q, $cgi_name)

on the first reference to $q
    print $q->start_html(-Title=>'Genotyping projects list.',
                                    -Script=>$JSCRIPT,
                                    -bgcolor=>'#003366',
                                    -text=>'#FFFFF0',
                                    -Link=>'#3366FF',
                                    -vlink=>'#000000',
                                    -alink=>'#FF0000'), "\n";
this error message is generated
Can't call method "isaCGI" on unblessed reference at (eval 11) line 1.
but the program proceeds to print out what I expect and my pages
otherwise look normal.

I am using perl5.00404

does the $q variable get unblessed when i call funcitions in a
perlmodule?

any clues?

thanks!

brad



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

Date: Wed, 12 May 1999 17:35:06 GMT
From: michael_555@my-dejanews.com
Subject: cgi submitting a form to another server
Message-Id: <7hce4a$f8u$1@nnrp1.deja.com>

I have the following in a .html file:

<FORM method="POST" action="https://www.xxxx.com/scripts/xxxx/xxxx.xxx">
<INPUT type="hidden" name="LOGIN" value="xxxxxxxx">
 ... </FORM>

The data within the FORM method doesn't change.

When the surfer presses the button they get a form
from another company (on another server) to fill out.

My concern is that anyone can read my LOGIN value by
doing a 'view source' on my page. Although maintenance
features on this account are password protected, and
the .html file containing the button must reside on
my server to work, I don't want anyone to get my LOGIN
id. Maybe they could guess the password and really
screw me up...

Is there a way I can put a button on my .html page
that executes a .cgi script that in turn submits
the form data to the other server? Can I make it
so the .cgi script is not directly accessible to
surfers (or this was all pointless...)?

I have full .cgi access on my server, and can set
file protections (unix). I have done some basic
 .cgi programming, like a counter, and a custom
access log, but I don't know how to do this.

Thanks,

Michael


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 12 May 1999 09:12:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a34851439e4f78989a40@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.  Crossposted and followups to 
comp.lang.perl.misc.]

In article <7hbu76$voi$1@nnrp1.deja.com> on Wed, 12 May 1999 13:03:35 
GMT, mvq2@my-dejanews.com <mvq2@my-dejanews.com> says...
> Does someone know how I could take Sun 9, May 1999 11:14:00 into
> mm/yy/dd  and HH::MM format?

Use a regex or substr or unpack to pick out the components you want.

Use sprintf (with '%.2d' formats for the integers) to generate the 
result.

I've never seen 'mm/yy/dd' or 'HH::MM' formats.  Is there some locale I 
don't know of that uses them?

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


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

Date: Wed, 12 May 1999 17:47:14 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a38a01f89ab4f69896a2@news>

In article <MPG.11a34851439e4f78989a40@nntp.hpl.hp.com>, Larry Rosler 
says...
> > Does someone know how I could take Sun 9, May 1999 11:14:00 into
> > mm/yy/dd  and HH::MM format?

> Use a regex or substr or unpack to pick out the components you want.
> Use sprintf (with '%.2d' formats for the integers) to generate the 
> result.
> I've never seen 'mm/yy/dd' or 'HH::MM' formats.  Is there some locale I 
> don't know of that uses them?

I can't help but wonder if this is being asked in reverse.Perhaps you are 
seeing the system time as it is shown and thinking that is the format it 
exists in?  FPerhaps it would be complete to add the standard gizmo...

#stupid line wraps :)
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
localtime(time());  

print "$min\/$mday\/$year $hour\:$min";

-- 
Charles R. Thompson
RainCloud Studios
"That? That's no script. That's your attempt at a rather complex README 
file."


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

Date: Wed, 12 May 1999 17:55:59 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a38c0c622664ee9896a3@news>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <MPG.11a34851439e4f78989a40@nntp.hpl.hp.com>, Larry Rosler 
says...
> > Does someone know how I could take Sun 9, May 1999 11:14:00 into
> > mm/yy/dd  and HH::MM format?


> Use a regex or substr or unpack to pick out the components you want.
> Use sprintf (with '%.2d' formats for the integers) to generate the 
> result.
> I've never seen 'mm/yy/dd' or 'HH::MM' formats.  Is there some locale I 
> don't know of that uses them?

I can't help but wonder if the user is looking at the system time as 
reported by localtime; and thinking this is what he has to work with, or 
if hee actually has a string in that manner that needs formatting.

For the sake of completeness...

# darn line wraps. :)
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)= 
localtime(time());

print "$mon\/$mday\/$year $hour\:$min";

or...

print "the month is.. (localtime)[4])"; # 0 based though! :)

assuming other solutions will follow... 

-- 
CT


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

Date: Wed, 12 May 1999 10:54:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Exists win32 equivalent for fork?
Message-Id: <3739C06B.915F6465@mail.cor.epa.gov>

Scott McMahan wrote:
> 
> Pavel Kotala (pkotala@logis.cz) wrote:
> > Can I create child processes on Win32? Fork does not work.

What happened when you looked this up in the FAQ?  You could
have gotten this info just by typing:
   perldoc -q fork
 
> No, you can not create a child process the way
> UNIX does. The Win32 process model doesn't allow it.

Agreed.

> Use threads.

If you have a thread-stable installation of Perl. 

You might look into Win32::Process::Create() as well.

And you might try going to:
   http://www.perlmonth.com/articles//rtfm.html
to learn how to use all the great documentation that comes with Perl.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 12 May 1999 16:59:16 GMT
From: S Starre <sstarre@my-dejanews.com>
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <7hcc11$di9$1@nnrp1.deja.com>



I've derived an algorithm to determine if a post is off-topic:

(($author ne 'TC')||($author ne 'LW'))&&($topic ~=/^perlish$/))&&
(print 'Hey thatz not perl!';) #note lim lw (as t->Y2K) = 0

Personally, since I spend 90% of my newstime in this group, I welcome
the diverse postings- I think they add variety, and generally I'll read
any snippets from tc or lw... but I realize that opinions may vary.

-S

***********************************************************************



In article <Pine.HPP.3.95a.990511172226.21220J-100000@hpplus01.cern.ch>,
  "Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Tue, 11 May 1999, Bart Lateur wrote:
>
> > Strange. I would have thought people would consider this question as
> > off-topic for this newsgroup. And now it's even posted as a FAQ.
>
> I followed-up to attempt some discussion along the same lines, and
> trying to move the discussion to comp.infosystems.www.authoring.cgi.
> But it seems that the automoderation for that group has suppressed the
> copy that I intended to be posted here.
>
> To avoid multi-posting, could I respectfully draw attention to the
> followup in the CGI group?   If I was talking nonsense then I'd
> appreciate some reasoned discussion ;-)
>
> all the best
>
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 12 May 1999 11:03:19 -0400
From: "Terry Mealy" <spike1965@worldnet.att.net>
Subject: Re: Getting Access to Perl - how?
Message-Id: <7hceig$6fr$1@bgtnsc02.worldnet.att.net>

You can practice perl on a machine that isn't even connected to the net.
But if you want to see the CGI's in action, you have to have a website and a
server.

FYI, www.webjump.com offers free site hosting and they support Perl, though
a few UNIX utilities aren't enabled (Sendmail).  It's free, but you gotta
look at a frame with their advertising.  Worked for me!

Orlando C. Fernando <ocfernan@rochester.rr.com> wrote in message
news:37390487.74B98912@rochester.rr.com...
> I'm very curious to learn from the people here how you are able to use
> perl for your cgi scripts. Many ISPs that I'm trying to look at don't
> support CGI scripting, or don't allow to do your own. Actually, there's
> one I know that lets you customize their existing scripts (changing a
> NAME variable or so). But I was really hoping for a good internet
> resource at a modest/free price so that I can start learning and
> practicing using perl to make my own simple scripts.





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

Date: Wed, 12 May 1999 16:25:21 GMT
From: noone@home.com (Howie)
Subject: Getting file date
Message-Id: <RXh_2.11556$tm6.5540@news.rdc1.sdca.home.com>

How do I get the date on a file to see when it was last modified? thanks for 
any help.


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

Date: 12 May 1999 16:36:57 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Getting file date
Message-Id: <7hcan9$m1h$2@info2.uah.edu>

In article <RXh_2.11556$tm6.5540@news.rdc1.sdca.home.com>,
	noone@home.com (Howie) writes:
: How do I get the date on a file to see when it was last modified?
: thanks for any help.

Perl's stat() operator (and, consequently, the underlying system call)
is usually very helpful in uncovering all sorts of information about
files.

Greg
-- 
Scotsmen wear kilts because sheep can hear zippers...


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

Date: Wed, 12 May 1999 17:40:30 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: Here documents and indention.
Message-Id: <MPG.11a3886bf239b9769896a1@news>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <373c9cdd.16909759@news.skynet.be>, Bart Lateur says...
> >If Perl doesn't really care that much about whitespace, why do here 
> >document terminators have to be flush left in scripts?

> Seriously, I too don't really understand why Perl couldn't be patched to
> disregard any whitespace (and only whitespace, both before and after) on
> those lines. Any time sacrifice would only be once, at compile-time. It
> probably would even be minimal. That doesn't seem so bad.

The only *real* reason I point it out is for the sake of readable code. 
Let's say you had a nested structure like so...

foreach(@thing){
  if(!$_){
    while($stuff){
      &dothing;
      print END_OF_HTML;
      <blah>
      de lots of stuff and lines
      </blah>
      END_OF_HTML
    }
  }
}

compared to now...

foreach(@thing){
  if(!$_){
    while($stuff){
      &dothing;
print <<END_OF_HTML;
<blah>
de lots of stuff and lines
</blah>
END_OF_HTML
    }
  }
}

>From the point of legibility, this is way off base and while it *works* 
fine it does nothing but 'hiccup' the reading of the code, especially if 
you have a run of complex structures.

Who really cares if the end result HTML source itslef is totally whacked 
out? Anyone looking in there anyway is trying to figure out what you did 
to achieve a certain layout. I say make um work for it. :)

The only argument against stripping all whitespace I can think of 
for HTML would be for the <pre></pre> tag which would need to be left the 
heck alone. Now that I say that, I can understand from a text-only 
outlook why it is the way it is. Perl most likely wouldn't know the 
difference between your layout spacing and where it needed to strip. 
Well.. drat talked myself out of it. :P

-- 
Charles R. Thompson
RainCloud Studios
"That? That's no script. That's your attempt at a rather complex README 
file."


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

Date: Wed, 12 May 1999 11:00:37 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How do I get a hash slice as a hash in a Perlish way?
Message-Id: <x3yyaiunxii.fsf@tigre.matrox.com>


Dwayne Retsky <a794636757612661@mailcity.com> writes:

> I have a hash
> 
> 	%gundark = ('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
> 
> Now, I'm only interested in what vowels are associated with, so I want
> a hash that contain all the key-value pairs that %gundark has where
> the key is a vowel.  My friend still wants the whole %gundark though,
> so I do
> 
> 	%nerfherder = ('a' => $gundark{'a'}, 'e' => $gundark{'e'});
> 
> Is there a better way to do this?  

How about something like:

	my @vowels = qw/a e i o u/;

	@nerfherder{@vowels} = @gundark{@vowels};

HTH,
Ala



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

Date: Thu, 13 May 1999 01:30:53 +0800
From: "Blue" <mrblue@pd.jaring.my>
Subject: How to CHMOD to 755 using check boxes?
Message-Id: <7hcdtg$2j1$1@news6.jaring.my>

I do not know how to CHMOD my cgi to 755. My FTP only give me 9 check boxes
to click (can't key in numbers):

Owner: 1) Read 2) Write 3) Execute
Group: 1) Read 2) Write 3) Execute
Others: 1) Read 2) Write 3) Execute

I am currently have all the nine boxes selected. Although it works, I don't
think it is correct. Is it?

Thanks.




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

Date: Wed, 12 May 1999 17:54:13 GMT
From: Jason Levine <jason@hyperspot.com>
Subject: Installing PERL on NT Server
Message-Id: <3739BF96.6BC934C0@yitbos.com>

Does anyone know of a good resource for problems with installing PERL on
NT Server

Thanks,
Jason


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

Date: 12 May 1999 12:24:08 -0500
From: jon@webdev.co.uk (jon ewing)
Subject: Matching & substituting escaped characters in a regexp.
Message-Id: <3739b492.5689747@news1.newscene.com>

hello,

i recently wrote a script to parse a text file, replacing all escaped
characters with their HTML equivalent. So, eg the data file contained

march\351

which was to be replaced with

march&#233;

For any particular escaped character, this was easy, eg:

s/\351/&#233/

but I wanted to come up with a regexp that could match any escaped
character and do the substitution.

So..... is it possible to match any escaped character on the LHS of a
regexp? Things like:

s/\\\d\d\d/ 

don't work, since the escaped character doesn't register as 4 distinct
characters.

In the end I had to read the file in line by line, then:

foreach $char (split \\, @_) {
	if (unpack('c', $char) < 0) {
	$line .= '&#'.(ord $char).';';
} else {
	$line .= $char;				
}			

which is pretty slow.

Any ideas? 

ta,

Jon.




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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5640
**************************************

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