[11628] in Perl-Users-Digest
Perl-Users Digest, Issue: 5228 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 25 17:01:58 1999
Date: Thu, 25 Mar 99 14:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 25 Mar 1999 Volume: 8 Number: 5228
Today's topics:
Re: $alreadyHaveError parameter problem <Wm.Blasius@ks.sel.alcatel.de>
Re: ANNOUNCE: Boston.pm Social Meeting, Thurs Mar 25 (Clinton Pierce)
change default file type in file upload esun_@yahoo.com
cron and script output beckb1@mama.indstate.edu
Re: Date/Time calculation: % through current month? (Larry Rosler)
Re: don't understand ||= operator <Wm.Blasius@ks.sel.alcatel.de>
Re: don't understand ||= operator (Larry Rosler)
Help: CGI.PM: Table of textfield ? (Eisen Chao)
How do you extract the desc. out of a meta tag? (Rollo Lawson)
newbie:need help stripping out comments <mlfergu1@cca.rockwell.com>
Re: newbie:need help stripping out comments (Larry Rosler)
Re: Not possible in Perl?? (John Moreno)
Perl script ignoring system() command c_evans@my-dejanews.com
Re: Perl/DBI/MS-Access: Problems inserting an integer.. <"rhrh@hotmail.com,or,rhardicr"@ford.com>
problem testing Net-Daemon-0.17 at threadm.t <johnsonw@email.unc.edu>
Re: protecting perl scripts <reich@pants.internetcds.com>
Re: regular expression (Larry Rosler)
Re: Resizing File (Clinton Pierce)
Re: Simple DOS/Win95 originated Perl script not working vkoslak@my-dejanews.com
Re: Values of 'true' and 'false'? (Bart Lateur)
Re: Values of 'true' and 'false'? (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Mar 1999 21:08:49 +0100
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: "Dan Smorey Jr." <dsmorey@unconundrum.com>
Subject: Re: $alreadyHaveError parameter problem
Message-Id: <36FA97D1.794BDF32@ks.sel.alcatel.de>
Dan Smorey Jr. wrote:
>
> I got to ask this question. This problem does not make any sense to me.
> I wanted to use a parameter named $alreadyHaveError. Problem is, it
> kept showing up blank. Nothing could be assigned to it. It was a
> simple assignment...
>
> $alreadyHaveError = $haveError;
>
> $haveError always has something in it, either 1 or 0, so
> $alreadyHaveError should be assigned. First thing I thought was, global
> variable, maybe this variable is assigned somewhere else and being
> assigned null. I grep'd all the files in my project and didn't find a
> single $alreadyHaveError. So, I thought maybe it's the away I'm
> assigning it...
>
> ($alreadyHaveError) = $haveError;
> my ($alreadyHaveError) = $haveError;
>
> Tried both of those and they both didn't work. So, after that, I
> thought the next best thing, try another parameter name. I tried...
>
> $alreadyHadError = $haveError;
>
> Worked the first time. Can somebody explain this to me? Is
> $alreadyHaveError a system supplied parameter or something? How can
> changing...
>
> $alreadyHaveError = $haveError;
>
> to this...
>
> $alreadyHadError = ;
>
> change anything?
>
> Thanks in advance for an answer to my perplexing problem.
>
> Dan R. Smorey Jr.
> Programmer/Analyst
> UnConundrum, Inc.
> www.unconudnrum.com
> dsmorey@unconundrum.com
> smory@ptdprolog.net
A little more info would be helpful here - maybe even a code snip. The
answer to the question as stated is that it makes no difference run in
isolation on my system. I'm sure you used -w to make sure $haveError's
value is not undef but have you tried setting a breakpoint at the line
where the assignment takes place and using x to look at the values for
the variables before and after? Does $alreadyHaveError contain a blank
or no value?
man perldebug
Your contention that
$alreadyHaveError = $haveError;
($alreadyHaveError) = $haveError; and
my ($alreadyHaveError) = $haveError;
are equivalent (except for localization) is true AFAIK.
hth
Wm Blasius
--
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Thu, 25 Mar 1999 16:44:20 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: ANNOUNCE: Boston.pm Social Meeting, Thurs Mar 25
Message-Id: <370267d1.1298837429@news.ford.com>
On Tue, 23 Mar 1999 23:02:39 -0500, Elaine Ashton <elaine@cts.wustl.edu>
wrote:
>You know, I also had this wacky idea today to turn my rusting 16yo volvo
>wagon into the "Perl Mobile" in time for YAPC...so..if you were a perl
>mobile what would you look like?
One hump or two?
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Thu, 25 Mar 1999 21:40:58 GMT
From: esun_@yahoo.com
Subject: change default file type in file upload
Message-Id: <7deah8$77t$1@nnrp1.dejanews.com>
Hi there,
I used Jeffrey Carnahan's file upload script to upload files. Basically it
uses a field with input type of "FILE" in a form with ENCTYPE as
"multipart/form-data". One small nuance is that in netscape browser when you
click on "Browse" button to browse and select files, it initially only shows
HTML files. I then change it to "All Files", to be able to choose the files I
want. Internet explorer shows all files instead of only html files.
Is there any way to make sure netscape browser shows all types of file when
"Browse" button is pressed? Your help is appreciated in fixing this problem.
/E.S.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 25 Mar 1999 20:28:03 GMT
From: beckb1@mama.indstate.edu
Subject: cron and script output
Message-Id: <7de687$2v5$1@nnrp1.dejanews.com>
Hello,
I have this script below: #!/usr/local/bin/perl -w # below is actual command
minus escape codes needed for " > characters # /usr/lpp/p21pro/bin/p21pro -c
-P /usr/local/bin/ilcheck.p -p "-b >/dev/null" # run database lookup, output
to file system("/usr/lpp/p21pro/bin/p21pro -c -P /usr/local/bin/ilcheck.p -p
\x22-b \x3E /dev/null\x22");
@lines =();
open(VER, "</tmp/ilcheck.tmp");
while(<VER>){
chomp;
push(@lines, $_);
}
close(VER);
unlink("/tmp/ilcheck.tmp");
# file is approaching full level and check-file doesn't exist # send mail to
dp dept if(($lines[1] ne "file is fine")&&(! -f "/tmp/item_ledger.tmp")){
open(MAIL, "|/usr/bin/mail me"); print MAIL "The ITEM LEDGER file is
approaching capacity\n$lines[1]\n$lines[2 ]\n$lines[3]\n\nThis message has
been sent to: me, you, her, him"; close(MAIL); system("/usr/bin/touch
/tmp/item_ledger.tmp");
}
elsif($lines[1] eq "file is fine"){
unlink("/tmp/item_ledger.tmp");
}
END
What this thing does is: run a database lookup, with the output to a file
Output from DB lookup:
Name CURRECS MAXRECS
------ ---------- ----------
ILDGD 580,227 585,000
If the file does not say "file is fine" then the script will email "me" the
contents of this file, otherwise no email is sent.
The thing is, that when I run this manually from the shell, it works fine.
That meaning that I receive the email and it looks right. Here's what I
should receive: The ITEM LEDGER file is approaching capacity Name CURRECS
MAXRECS ------ ---------- ---------- ILDGD 580,233 585,000
This has been sent to: me, you, her, him
But, when this is run from cron, I get this:
The ITEM LEDGER file is approaching capacity
This message has been sent to: me, you, her, him
And this from daemon user:
Read on closed filehandle <VER> at /usr/local/bin/item_ledger_check.pl
line 13. Use of uninitialized value at /usr/local/bin/item_ledger_check.pl
line 22. Use of uninitialized value at /usr/local/bin/item_ledger_check.pl
line 24. Use of uninitialized value at /usr/local/bin/item_ledger_check.pl
line 24. Use of uninitialized value at /usr/local/bin/item_ledger_check.pl
line 24.
*****************************************************************
cron: The previous message is the standard output
and standard error of one of the cron commands.
I cannot understand why this is happening. I do not know why cron would
cause this script to behave differently than when run from a shell. It's
obvious that the array @lines isn't being populated, and that there is a
read on a closed filehandle, VER, but again, I don't know why!! This is very
agravating.
Thank you very much for your help,
Brad Beck
LAN, WAN, UNIX admin.
Industrial Supply Company
bjb@dontspamme.ind-supply.com
remove dontsmamme for real email address
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 25 Mar 1999 12:52:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date/Time calculation: % through current month?
Message-Id: <MPG.116441f3ef69d7a9897cb@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <922389401.346646@news.tibus.net> on 25 Mar 1999 19:17:00
GMT, Tony Bowden <tony@crux.blackstar.co.uk> says...
> : Try Time::Local
> : specifically the 'timelocal' function
> : $sec=$min=$hour=0;
> : $day=1;
> : $month=2; #2=March
> : $year=1999;
> : $march1st=timelocal($sec,$min,$hour,$day,$month,$year);
> : $april1st=timelocal($sec,$min,$hour,$day,$month+1,$year);
>
> Is there an easy way of working this out though .. I don't want to hardcode
> the date, and I want it to work all the time ... this code will start
> breaking nastily in December ...
So will lots of other code, for other reasons! :-)
> : $now=time;
> : $equation=($now-$march1st)/($april1st-$march1st);
#!/usr/local/bin/perl -w
use strict;
use Time::Local;
my ($month, $year) = (localtime(my $now = time))[4, 5];
my $this = timelocal(0, 0, 0, 1, $month, $year);
++$month > 11 and ($month, $year) = (0, $year + 1);
my $next = timelocal(0, 0, 0, 1, $month, $year);
my $equation = ($now - $this) / ($next - $this);
printf "%.3f\n", $equation;
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 25 Mar 1999 20:30:05 +0100
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: Jane Dudley <jdudley@inna.net>
Subject: Re: don't understand ||= operator
Message-Id: <36FA8EBD.446B9B3D@ks.sel.alcatel.de>
Jane Dudley wrote:
>
> Hello, all.
>
> I am trying to understand a script fragment I found, that has an ||=
> expression. I looked at
> http://www.effectiveperl.com/recipes/searching.html and
> http://www.codebits.com/p5be/ch04.cfm, which have brief explanations, but
> I'm afraid I don't understand them. I think I don't understand the
> difference between |, which is "bitwise" and || which is "logical."
> (Hey, I'm a mechanical engineer. Either there IS water flowing in that
> pipe OR there isn't. There ain't no logical or bitwise flow about it).
> Can someone make up a simple example to illustrate the difference?
>
> Jane
The difference is that the || operator short circuits. Perl evaluates
$var ||= EXPR as $var = $var || EXPR
which means that EXPR won't be evaluated if $var evaluates to TRUE. A
trivial example might be:
my ($var, $i);
$var = $i =0;
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=0, $i=0
$var ||= ++$i; # var is false, $i++ is evaluated (PREincr)
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=0, $i=1
$var ||= ++$i; # var is true, $i++ is not evaluated
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=1, $i=1
...but for |=, it is done bitwise with no short circuit:
my ($var, $i);
$var = $i =0;
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=0, $i=0
$var |= ++$i; # var is false, $i++ is evaluated (PREincr)
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=1, $i=1
$var |= ++$i; # var is true, $i++ is evaluated and OR'd
printf "\$var=%d, \$i=%d\n", $var, $i;
# $var=3, $i=2
I hope that clears things up a little.
Wm Blasius
---
* I am Pentium of Borg. Division is futile. You will be approximated. *
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Thu, 25 Mar 1999 13:06:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: don't understand ||= operator
Message-Id: <MPG.1164453e6f9496289897cd@nntp.hpl.hp.com>
In article <36fa8d14.2673613@news2.tmisnet.com> on Thu, 25 Mar 1999
19:33:44 GMT, George Crissman <strads@tmisnet.com> says...
...
> If you would like dessert, you must either (pick one or more)
> a) eat your vegetables,
> b) eat your salad, or
> c) drink your milk.
> Think of it as dessert = vegetables || salad || milk
> dessert will occur if any one (or more) of the conditions occur.
>
> Wrapup:
> A single | (bitwise) gives you a binary/numeric answer.
> A double || (logical) gives you a true/false answer.
The last statement is correct in C, and correct in Perl but incomplete.
One of the neat features of Perl is that the value of the expression is
the value of the first 'true' element (if any), not simply a Boolean
value.
So the value of $dessert in your example would be either the value of
$vegetables (if 'true') or the value of $salad (if 'true') or the value
of $milk (if 'true') or 'false' (0 or ""). 'true' means any value other
than 0, '0', "", or the undefined value.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 25 Mar 1999 21:04:15 GMT
From: echao@interaccess.com (Eisen Chao)
Subject: Help: CGI.PM: Table of textfield ?
Message-Id: <922395855.579.21@news.remarQ.com>
Hi All:
I am using CGI.PM to create a form that has a
table of textfields, that is a spreadsheet-like
matrix of fields that users can enter data into.
My problem is that textfield requires a unique
name for each field. But I need to handle all
the textfields at the same time (i.e. as an array):
Tr([
th(['Category', 'Observation']),
td([textfield(-name=>'Cat'),
textfield(-name=>'Obs']),
td([textfield(-name=>'Cat'),
textfield(-name=>'Obs')])
]
)
creates a 2-column, 2-rowed table. But instead of
appending an additional value to param('Cat'), I
merely get the last value overwritten to param('Cat').
Am I going to have to add each unique textfield to an array,
one-by-one ?
I already looked at textarea and all that creates is a
big text box, not a matrix of textfields.
Thanks in advance,
Eisen
------------------------------
Date: Thu, 25 Mar 1999 12:01:14 -0800
From: rollo_lawson@yahoo.com (Rollo Lawson)
Subject: How do you extract the desc. out of a meta tag?
Message-Id: <5CwK2.24306$EF1.91898713@WReNphoon1>
I have been writing a simple search program in Perl to search my website. I
have looked around to see where I can find out how they extract the meta tag
description value to no avail. Can someone show me the simple syntax on how
to do this. Iam just trying to add a simple description to the search
results my script generates.
Please Help
rollo@enter.net
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
------------------------------
Date: Thu, 25 Mar 1999 14:08:30 -0600
From: Martha Ferguson <mlfergu1@cca.rockwell.com>
Subject: newbie:need help stripping out comments
Message-Id: <36FA97BD.522CE287@cca.rockwell.com>
I have a file that I want to strip out comments. Comments start with
/* and end with */. Some of these comments extend over several
lines. If I do a regular expression:
s{/\*.*?\*/}[]gmx; (global replace of comment line with blank line)
I get all the lines that start and end with /* */ but none of the lines
that span multiple lines ( neither the first nor last.in the
multi-line). But if I do the range operator:
if (/\/\*/ .. /\*\//)
all comments lines are found, but I don't know how to get those lines
replaced with a blank line. I need to have the same number of lines in
the file after comments are replaced as there was with the comments.
Any suggestions would be greatly appreciated.
Thanks, Matha.
------------------------------
Date: Thu, 25 Mar 1999 13:09:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie:need help stripping out comments
Message-Id: <MPG.116445d250bd99069897ce@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36FA97BD.522CE287@cca.rockwell.com> on Thu, 25 Mar 1999
14:08:30 -0600, Martha Ferguson <mlfergu1@cca.rockwell.com> says...
> I have a file that I want to strip out comments. Comments start with
> /* and end with */.
perlfaq6: "How do I use a regular expression to strip C style comments
from a file?"
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 25 Mar 1999 16:23:06 -0500
From: planb@newsreaders.com (John Moreno)
Subject: Re: Not possible in Perl??
Message-Id: <1dp8d3p.18y541b14tag1qN@roxboro0-0030.dyn.interpath.net>
Joe <painter2000@Cybernex.Net> wrote:
> I wish to read in a file, add 10 to each byte in the file and write it
> back out to another file. I checked PERL FAQ, asked PERL programmers,
> checked the FAQ and I cannot find a simple answer on how to do such an
> elementary task. Is it possible??
Yes.
> Help!
> [our email address is 'painter2000@Cybernex.Net' but WITHOUT
> the numbers and with all letters lowercase. Very sorry about
> that but I am trying to avoid all those spammers.]
If using an undeliverable address one should terminate the domain name
with ".invalid".
The right hand side of the address isn't case sensitive. Perhaps
painter2000 doesn't appreciate getting your mail.
If you want to receive a Cc of responses to your post, put a valid
address in a Mail-Copies-To header...
"our email address"? Are you royalty or crazy or are you speaking on
behalf of a company? If the latter what the hell are they paying you
for, certainly not for programming.
--
John Moreno
------------------------------
Date: Thu, 25 Mar 1999 20:30:55 GMT
From: c_evans@my-dejanews.com
Subject: Perl script ignoring system() command
Message-Id: <7de6e0$3ag$1@nnrp1.dejanews.com>
Hey, I'm trying to send email using blat in a perl script on NT. The system
call to blat is being ignored. The system command won't execute anything. It
works fine on one web server and gets ignored on another. Here is the system
command:
system ("blat $tempfile -t tome@me.com ");
The Path isn't an issue because I include the full path. Blat works fine from
the command line but choaks in the Perl Script. It doesn't error, its just
ignored. It must be a server config issue because it works on one server but
not another. Any thoughts?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 25 Mar 1999 09:26:35 +0000
From: Richard H <"rhrh@hotmail.com,or,rhardicr"@ford.com>
Subject: Re: Perl/DBI/MS-Access: Problems inserting an integer...
Message-Id: <7dcvfb$i8t5@eccws1.dearborn.ford.com>
> $cursor = $dbh->prepare(q{SELECT * FROM EMP WHERE EMPID = ?})
> || die $dbh->errstr;
> $cursor->execute($employeeID);
>
> $cursor->execute(int($employeeID));
This looks wrong, you're using the excute method on a number with no
sql? though that may be my understanding of DBi thats wrong
the variable may need to have been interpolated for the prepare step?
Ive been using the follwowing structure for numbers and its worked:
> $employeeID = 21;
> $cursor = $dbh->prepare("SELECT * FROM EMP WHERE EMPID =$employeeID")
> || die $dbh->errstr;
> $cursor->bind_columns(undef,\($vars));
> $cursor->execute;
------------------------------
Date: Thu, 25 Mar 1999 12:21:52 -0500
From: Wynee Johnson <johnsonw@email.unc.edu>
Subject: problem testing Net-Daemon-0.17 at threadm.t
Message-Id: <36FA70B0.206D58FE@email.unc.edu>
I have compiled it under Solaris 2.5.1 and 2.6. When Testing it it both
systems hang at t/threadm.t
on 2.6 , perl -d produces:
main::(t/threadm.t:92): push(@threads, $tid);
Can't use string ("IO::Socket::INET") as a symbol ref while "strict
refs" in use at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/sun4-solaris-thread/IO/Handle.pm
line 379.
Use of uninitialized value at t/threadm.t line 52, <GEN2> chunk 12.
main::ReadWrite called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1197
DB::sub('IO::Socket::INET=GLOB(0x4f5344)') called at t/threadm.t
line 52
main::ReadWrite called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1199
DB::sub('IO::Socket::INET=GLOB(0x4f5344)', 1, 12) called at
t/threadm.t line 73
eval {...} called at t/threadm.t line 68
main::MyChild called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1181
DB::sub(1) called at t/threadm.t line 87
eval {...} called at t/threadm.t line 87
Server cannot parse input:
It repeats the general message for several more lines in the program
before hanging.
On 2.5.1 , the problem starts at the same general location and produces-
IO::Socket::INET::new(t/threadm.t:92):
92: push(@threads, $tid);
DB<3> Not a GLOB reference at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/SelectSaver.pm line 43.
SelectSaver::new called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1197
DB::sub('SelectSaver', 'Term::ReadLine::Stub=ARRAY(0x24c104)')
called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/sun4-solaris-thread/IO/Handle.pm
line 440
IO::Handle::autoflush called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1197
DB::sub('Term::ReadLine::Stub=ARRAY(0x24c104)') called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/Term/ReadLine.pm line 177
Term::ReadLine::Stub::readline('Term::ReadLine::Stub=ARRAY(0x24c104)',
' DB<3> ') called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1516
DB::readline(' DB<3> ') called at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 472
DB::DB called at t/threadm.t line 92
Usage: Socket::inet_aton(host) at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/perl5db.pl line 1197.
END failed--cleanup aborted.
IO::Socket::socket(/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/sun4-solaris-thread/IO/Socket.pm:78):
78: ${*$sock}{'io_socket_proto'} = $protocol;
On Aix 4.2.1.0 it produces:
Not a GLOB reference at
/afs/isis.unc.edu/pkg/perl-500502/lib/5.00502/aix-thread/IO/Handle.pm
line 379.
This also occurs at the point in the test. All versions were compiled
with threads. Any suggestions on where the problem is would be greatly
appreciated.
Wynee
------------------------------
Date: 25 Mar 1999 12:48:02 -0800
From: Mahlon <reich@pants.internetcds.com>
Subject: Re: protecting perl scripts
Message-Id: <873e2tz471.fsf@martini.office.cdsnet.net>
>: Unfortunatly, it appears that all you need to do to defeat Greg's script is
>: change the last line of the encrypted script from
>: 'eval $prog' to 'print $prog'
>
>To ride this ride, you must be at least this tall. Better luck next
>year.
>
>Greg
Greg,
It seems that if you wanted to hide source from anyone
that was savvy enough to steal and modify it,
you'd assume that the copyright infringer would be savvy
enough to use the print function.
Just pointing out that anyone thinking that they can
reliably hide perl source is in big trouble.
Filter encrypt/decrypt or perlcc would be a small step up.
Threats of suing someone's ass off is better still.
:)
-Mahlon
------------------------------
Date: Thu, 25 Mar 1999 12:55:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regular expression
Message-Id: <MPG.116442a8d8d430f29897cc@nntp.hpl.hp.com>
In article <36FA945D.B14016AD@mail.cor.epa.gov> on Thu, 25 Mar 1999
11:54:05 -0800, David L. Cassell <cassell@mail.cor.epa.gov> says...
...
> You can just write this as:
> print HH "$value";
Let's not get people into the bad habit of double-quoting simple scalar
strings. It is unnecessary and misleading.
print HH $value;
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 24 Mar 1999 19:40:34 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Resizing File
Message-Id: <36fc3f7e.1222978259@news.ford.com>
On Wed, 24 Mar 1999 01:12:29 -0500, David J Whalen-Robinson
<davidrn@pobox.com> wrote:
>I want to resize a file, preferably while it is open.
>I know all about seek, tell, and eof and how
>to read and write into the file, but I don't know
>how to shrink the file size...
>
>The goal is to most efficiently as possible cut of the end of the file.
>The OS should support this...
Read up on truncate().
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Thu, 25 Mar 1999 21:10:41 GMT
From: vkoslak@my-dejanews.com
Subject: Re: Simple DOS/Win95 originated Perl script not working when loaded in the UNIX Server
Message-Id: <7de8o7$5jt$1@nnrp1.dejanews.com>
make sure when you ftp the file over that you are in ascii mode and not
binary. if it still doesnt work try checking your path the the perl
executable.
-Rob
In article <7d39am$lls@bgtnsc01.worldnet.att.net>,
"Suresh Visuvasakumar" <s.v.kumar@worldnet.att.net> wrote:
> I didn't see my original message so I am reposting
>
> Suresh
>
> Suresh Visuvasakumar wrote in message ...
> >Please help!!!!!!!!!!!!!!!!
> >
> >I am so much frustrated a very simple script is not working when loaded in
> >the Unix server.
> >
> >Originally the script (hello.pl) was created in DOS/Win95. The same script
> >works when my ISP loaded after creating it in his Unix machine.
> >I know that Unix ignores DOS carage return or newlines. Is this one
> >creating the problem. I am new to Perl and so far worked only in Dos Win32
> >machines.
> >
> >I wrote a Perl script (inout.pl) to remove white space and insert an
> newline
> >\n at the end of each line but it doesn't help either.
> >Any help is appreciated.
> >
> >-------- INOUT.PL Script -------------
> >#!/usr/local/bin/perl
> >#
> >###########################################
> ># A program to remove white space in DOS file
> ># and to insert newline.
> >############################################
> >#
> ># open input file
> >#
> >$input = <STDIN>;
> >chop($input);
> >unless (open(INFILE, "$input")) {
> >die ("Cannot open input file: \n" );
> >}
> >#
> ># open output file
> >#
> >$output = <STDIN>;
> >chop($output);
> >unless (open(OUTFILE, ">$output")) { # to append replace > with
> >>>
> >die ("Cannot open output file: \n" );
> >}
> >#
> ># do copy
> >#
> >$line = <INFILE>;
> >while ($line ne "") {
> >#next line is commented to test the other line , uncomment to remove white
> >space
> >#$line =~ s/^\s+|\s+$//g; # remove white space
> >$line =~ s/\n\r$/\n/; # convert \n\r to \n
> >$line = "$line\n"; # insert \n at end of each line
> >print OUTFILE ($line);
> >$line = <INFILE>;
> >}
> >
> >
> >-------- END of INOUT.PL Script -------------
> >
> >
> >
> >
> >
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 25 Mar 1999 20:32:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Values of 'true' and 'false'?
Message-Id: <36fb9b3f.546393@news.skynet.be>
Larry Rosler wrote:
>M.J.T. Guy says...
>
>> But you shouldn't do things like
>>
>> length($a==$b)
>
>Maybe one shouldn't. But it is well defined.
and
>The only thing missing is explicit documentation of this behavior.
It's not documented, so it is NOT well defined. I've said that before,
and I stick to it: some things NEED NOT BE well defined. Therefore, you
should not depend on any experimentally determined behaviour.
>As we have seen from the
>rest of this thread, in string context, the value is "" or '1', so the
>length is 0 or 1.
Experimentally determined, yes. Officially declared to be that way, no
(or, as you say; "not documented"). The only thing that IS documented,
hence the only thing you should depend on, is the behaviour in logical
tests: a "True" passes an "if" test, and a "False" does not.
So you should never use it. You don't need it anyway.
>> ($a>$b) * 17
What is wrong with:
$a>$b?17:0
or even
$a>$b && 17
Bart.
------------------------------
Date: Thu, 25 Mar 1999 13:11:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Values of 'true' and 'false'?
Message-Id: <MPG.11644661745f9aa69897d0@nntp.hpl.hp.com>
In article <7de0ut$75b$1@pegasus.csx.cam.ac.uk> on 25 Mar 1999 18:57:33
GMT, M.J.T. Guy <mjtg@cus.cam.ac.uk> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
...
> > ... But as I read the question, he wants to do further
> >manipulation on the value returned by a Boolean operator. In that case,
> >the values are well defined.
>
> Well, the values are only well defined to the extent of being true or
> false. So further manipulation using boolean operators is well
> defined. But you shouldn't do things like
>
> length($a==$b)
Maybe one shouldn't. But it is well defined. As we have seen from the
rest of this thread, in string context, the value is "" or '1', so the
length is 0 or 1.
> ($a>$b) * 17
Why not?
In numeric context, the situation is exactly the same as in C, where the
values of a Boolean are explicitly 0 or 1.
$number_of_matches = ($a eq $x) + ($a eq $x);
is 0 or 2, depending on whether $a in fact the same as $x. This is well
defined, hence valid Perl.
The only thing missing is explicit documentation of this behavior.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
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 5228
**************************************