[15526] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2936 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 3 18:05:42 2000

Date: Wed, 3 May 2000 15:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957391522-v9-i2936@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 3 May 2000     Volume: 9 Number: 2936

Today's topics:
        "it's" versus "its" (was: Re: if file already exists th <rootbeer@redcat.com>
    Re: "it's" versus "its" (was: Re: if file already exist <htp@mac.com>
        $form{'email'} =~ s/([\0-\37\177])/ /g; <todd@mrnoitall.com>
    Re: $form{'email'} =~ s/([\0-\37\177])/ /g; (Peter J. Acklam)
        (no subject) (LMC)
        [RegExp] Matching UPPERCASE words ... <charles.henry@engineer2k.com>
    Re: [RegExp] Matching UPPERCASE words ... <charles.henry@engineer2k.com>
    Re: [RegExp] Matching UPPERCASE words ... (Ilya Zakharevich)
    Re: [RegExp] Matching UPPERCASE words ... <lr@hpl.hp.com>
    Re: A debugging question <rootbeer@redcat.com>
        CHOOSE PROFILE Keeps Popping Up, MAPI bayers@my-deja.com
    Re: CHOOSE PROFILE Keeps Popping Up, MAPI <kpalagin@nomail.nomailphxint.glasnetnomail.ru>
    Re: Cleaning Up Strings <rootbeer@redcat.com>
    Re: Cleaning Up Strings <sariq@texas.net>
    Re: Clear and then Reuse a package name space richard_chen@my-deja.com
    Re: comparison operator help <lr@hpl.hp.com>
    Re: comparison operator help (Tad McClellan)
    Re: comparison operator help <rootbeer@redcat.com>
        DOS-ify / Mac-ify output files <nospam@devnull.com>
    Re: Error: Next 2 tokens. (Clinton A. Pierce)
    Re: Error: Next 2 tokens. <aperrin@davis.DEMOG.Berkeley.EDU>
    Re: Error: Next 2 tokens. <rootbeer@redcat.com>
    Re: FYI : Compiling Perl to EXE (Windows or UNIX) <rootbeer@redcat.com>
    Re: HELP : Script works on Command Line but not as CGI  (Craig Berry)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 3 May 2000 11:40:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: "it's" versus "its" (was: Re: if file already exists then remove...)
Message-Id: <Pine.GSO.4.10.10005031133270.13677-100000@user2.teleport.com>

On Thu, 4 May 2000, Henry wrote:

> In article <MPG.1379fe42616eb94b98a9d4@nntp.hpl.hp.com>, Larry Rosler 
> <lr@hpl.hp.com> wrote:
> 
> >> Err...  Why bother testing for it's existence at all?  Why not simply:
> >                                  ^^^^
> >                                  its
> 
> Not on a possessive, Larry.  Its fine to drop the apostrophe when the 
> long form reads 'it is' - but not in the case of ownership.  (Or, at 
> least, so I've been told by academics with lots of letters after their 
> names.)

Are the letters "G", "o", "o", and "f"? :-)

You and your academics have it backwards. Every dictionary of English
lists "it's" as a contraction for "it is" or "it has", and lists "its" as
an adjective meaning something like "of or belonging to it". If you can
find a dictionary from a reputable publisher which has this backwards, I'd
pay good money to see it.

Follow-ups set. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 04 May 2000 06:18:03 +0930
From: Henry <htp@mac.com>
Subject: Re: "it's" versus "its" (was: Re: if file already exists then remove...)
Message-Id: <htp-08EF74.06180304052000@news.metropolis.net.au>

In article 
<Pine.GSO.4.10.10005031133270.13677-100000@user2.teleport.com>, Tom 
Phoenix <rootbeer@redcat.com> wrote:

>> Not on a possessive, Larry.  Its fine to drop the apostrophe when the 
>> long form reads 'it is' - but not in the case of ownership.  (Or, at 
>> least, so I've been told by academics with lots of letters after
>> their names.)
> 
> Are the letters "G", "o", "o", and "f"? :-)

Apparently.  Or maybe just 'o', 'l', 'd'.


> You and your academics have it backwards. Every dictionary of English
> lists "it's" as a contraction for "it is" or "it has", and lists "its" as
> an adjective meaning something like "of or belonging to it". If you can
> find a dictionary from a reputable publisher which has this backwards, 
> I'd pay good money to see it.

The Macquarie (National) Dictionary, 2nd Edition, 1992:

"its"  adj., pron. possessive form of it. [poss. case of IT, formerly 
written it's]

It seems that, once apon a time, it was indeed acceptable (at least in 
this country) to have an apostrophe in the possessive form.  It would 
seem my teachers and academic friends were educated in such a time - 
hmmm?

Anyway, time to move on.  For those that are interested, here are a 
couple of links that cover the topic in more detail:

http://owl.english.purdue.edu/Files/19.html
http://www.wsu.edu/~brians/errors/its.html
http://www.stormloader.com/garyes/its.html

Apologies to Larry - you were indeed correct.  Thank you both, 
gentlemen, for the SIGHUP.  Time to flush the cache.


> Follow-ups set. Cheers!

Indeed.

Henry.


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

Date: Wed, 03 May 2000 12:09:49 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: $form{'email'} =~ s/([\0-\37\177])/ /g;
Message-Id: <39106A62.B1176587@mrnoitall.com>

Anyone know what this does?

$form{'email'} =~ s/([\0-\37\177])/ /g;

Thanks!



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

Date: 03 May 2000 20:47:06 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: $form{'email'} =~ s/([\0-\37\177])/ /g;
Message-Id: <cxcaei7cvyt.fsf@dioscuri.uio.no>

Todd Anderson <todd@mrnoitall.com> writes:

> Anyone know what this does?
> 
> $form{'email'} =~ s/([\0-\37\177])/ /g;

It replaces every occurrence of any character in the range \000-\037
including \177 with a blank character (space).

Unless $1 is used after this replacement, you could write it as

    $form{'email'} =~ s/[\0-\37\177]/ /g;

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: Wed, 03 May 2000 14:33:04 -0400
From: "Bereket Berhe (LMC)" <lmcbebe@lmc.ericsson.se>
Subject: (no subject)
Message-Id: <391070E0.AF16014A@lmc.ericsson.se>





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

Date: Wed, 3 May 2000 21:21:16 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: [RegExp] Matching UPPERCASE words ...
Message-Id: <8epui5$n23$1@news3.isdnet.net>

Which regexp shall I use to match UPPERCASE words?

Thanks in advance




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

Date: Wed, 3 May 2000 23:15:50 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: Re: [RegExp] Matching UPPERCASE words ...
Message-Id: <8eq590$8br$1@news2.isdnet.net>

> > Which regexp shall I use to match UPPERCASE words?
> >
> > Thanks in advance
>
> This one might work for you:
>
>   my $help = 'BEG-IN-NEWSGROUP';
>   $help =~ s/beg-in-newsgroup/read-documentation/i;
>   print $help;
>
> Notice that it matched the original even though the case in the regex
> was different.

Forget it I found the answer :

/\b([A-Z]+)\b/

It's cool to see how helpful people are on clpm :¨|








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

Date: 3 May 2000 20:48:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [RegExp] Matching UPPERCASE words ...
Message-Id: <8eq3b3$3v9$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Charles Henry
<charles.henry@engineer2k.com>],
who wrote in article <8epui5$n23$1@news3.isdnet.net>:
> Which regexp shall I use to match UPPERCASE words?

Not possible until 5.6.0 (unless using "C" locale is OK).

[Well, one could do

  my @a;
  for my $char (map chr, 0..255) {
    push @a, $char if $char =~ /\w/ and uc $char eq $char;
  }
  my $pat = join '', @a;
  /[$pat]+/;

and hope that "]" and "-" are not uppercase chars in the given locale. ;-]

Ilya


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

Date: Wed, 3 May 2000 13:47:04 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: [RegExp] Matching UPPERCASE words ...
Message-Id: <MPG.137a3020fb0b4cd698a9e2@nntp.hpl.hp.com>

In article <8epui5$n23$1@news3.isdnet.net> on Wed, 3 May 2000 21:21:16 
+0200, Charles Henry <charles.henry@engineer2k.com> says...
> Which regexp shall I use to match UPPERCASE words?

If 'UPPERCASE words' means 'strings comprising only upper-case letters':


#!/usr/bin/perl -w
use strict;

$_ = 'ABC';

/^[[:upper:]]+$/ and print "All upper case!\n" if $] > 5.005;

/^[A-Z]+$/       and print "All upper case!\n" if $] < 5.006;

__END__


Note that the older test may fail if the string contains characters that 
are upper-class letters in non-standard locales, but are not in the set 
[A-Z].

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


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

Date: Wed, 3 May 2000 11:27:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: A debugging question
Message-Id: <Pine.GSO.4.10.10005031125550.13677-100000@user2.teleport.com>

On Wed, 3 May 2000, jkroger wrote:

> If your program requires input, for example, 
> 
> print "How much would you like to invest in Microsoft? \n"
> $invest = <STDIN>;

I assume that you know that there's a missing semicolon. The debugger
isn't needed to catch problems like that! :-)

> and I run perldebug, using s to step through the lines, when I get to the
> second line, I will need to input something. When running the debugger,
> though, it just steps through this line and $invest remains undefined. 

Not on my machine. What version of Perl are you using?

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 03 May 2000 17:59:33 GMT
From: bayers@my-deja.com
Subject: CHOOSE PROFILE Keeps Popping Up, MAPI
Message-Id: <8eppe0$geo$1@nnrp1.deja.com>

I'm conecting to Exchange 5.5, installed on NT4 sp6, with a MAPI client
and everything works.  The problem is, I get the CHOOSE PROFILE dialog
which makes using it from a script impossible.  The only profile on the
machine is MAIL and it is the default profile.

When the script is ran, the CHOOSE PROFILE box pops up, I click OK and
the mail is sent.

Anyway to disable, or get around the CHOOSE PROFILE dialog?

Here is my perl code:

================================================

# !perl -w

use Win32::MAPI qw(Yes No);

my($obj)=new Win32::MAPI(UseDefProfile=>Yes);

print "\n Using Win32::MAPI version ", $Win32::MAPI::VERSION, "\n";
print " By Amine Moulay Ramdane <aminer\@generation.net>\n";
if($obj->IsMAPI){print "\n MAPI is available...\n"}
else{die "\n MAPI is not available!\n"}

print "\n Please hit <Enter> to start the demo...: ";
<STDIN>;

$obj->Logon() || die "Can't logon!";

$data{Text}="Perl is great!";
$data{Subject}="Win32::MAPI";
$data{To}=['bayers@my-deja.com'];
$data{ShowDialog}=No;
$obj->Send(\%data);
$obj->LastError;

undef $obj;



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


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

Date: Wed, 03 May 2000 22:27:40 +0400
From: "Kirill S. Palagin" <kpalagin@nomail.nomailphxint.glasnetnomail.ru>
Subject: Re: CHOOSE PROFILE Keeps Popping Up, MAPI
Message-Id: <39106F9B.98159A4E@nomail.nomailphxint.glasnetnomail.ru>

Have you tried (in Outlook/Tools/Options/Mail services) set Startup
settings to Always use ...

P.S. For all your client-related questions you can refer to
microsoft.public.outlook.* NGs.

bayers@my-deja.com wrote:

> I'm conecting to Exchange 5.5, installed on NT4 sp6, with a MAPI client
> and everything works.  The problem is, I get the CHOOSE PROFILE dialog
> which makes using it from a script impossible.  The only profile on the
> machine is MAIL and it is the default profile.
>
> When the script is ran, the CHOOSE PROFILE box pops up, I click OK and
> the mail is sent.
>
> Anyway to disable, or get around the CHOOSE PROFILE dialog?
>
> Here is my perl code:
>
> ================================================
>
> # !perl -w
>
> use Win32::MAPI qw(Yes No);
>
> my($obj)=new Win32::MAPI(UseDefProfile=>Yes);
>
> print "\n Using Win32::MAPI version ", $Win32::MAPI::VERSION, "\n";
> print " By Amine Moulay Ramdane <aminer\@generation.net>\n";
> if($obj->IsMAPI){print "\n MAPI is available...\n"}
> else{die "\n MAPI is not available!\n"}
>
> print "\n Please hit <Enter> to start the demo...: ";
> <STDIN>;
>
> $obj->Logon() || die "Can't logon!";
>
> $data{Text}="Perl is great!";
> $data{Subject}="Win32::MAPI";
> $data{To}=['bayers@my-deja.com'];
> $data{ShowDialog}=No;
> $obj->Send(\%data);
> $obj->LastError;
>
> undef $obj;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
If you feel that anything in my post needs correction - feel free to do so
(in group).
And please, keep all discussions in NG, so that everybody can participate.

Kirill




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

Date: Wed, 3 May 2000 11:30:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Cleaning Up Strings
Message-Id: <Pine.GSO.4.10.10005031129240.13677-100000@user2.teleport.com>

On Wed, 3 May 2000, spurcell wrote:

>         for ($filename) {
>             s/^\s+//; s/\s+$//;
>         }
>         for ($id) {
>             s/^\s+//; s/\s+$//;
>         }

Maybe you didn't understand what the for loop is doing.

    for ($filename, $id) { ... }

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 03 May 2000 13:36:04 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Cleaning Up Strings
Message-Id: <39107194.89CD2427@texas.net>

spurcell wrote:
> 
> ### code below that I would like to simplify
> my @hstring = @_;
>     foreach (@hstring) {
>         my ($filename, $id, $dbname) = split /SSPPLLIITT/, $_, 4;

Do you know what that '4' is doing?

>         for ($filename) {
>             s/^\s+//; s/\s+$//;
>         }
>         for ($id) {
>             s/^\s+//; s/\s+$//;
>         }
>         # do some more stuff here


Glad to see that you're stripping the white space correctly.

Perhaps you're looking for:

for ($filename, $id) {
   s/^\s+//; s/\s+$//;
}

Or (for Perl versions >= 5.005):

s/^\s+//,s/\s+$// for $filename, $id;

See the perlsyn manpage for additional info.

- Tom


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

Date: Wed, 03 May 2000 19:16:46 GMT
From: richard_chen@my-deja.com
Subject: Re: Clear and then Reuse a package name space
Message-Id: <8eptub$llt$1@nnrp1.deja.com>

How the problem arise is not important.
Debating about what should be done in modifying the legacy
cgi scripts to make them work under modperl is beside the point.
Keep in mind that the major reason to use Apache::Registry
is to minimize modifications of the cgi scripts. Otherwise,
I would start from scratch and write my own perl handlers,
bypassing Apache::Registry altogether.

I have tried very hard to distill the essence of the problem
before I posted it to this discussion group. Let me
state it again here:

=======================================================
Is it possible to clear and then reuse the same package
name space in one perl process?
=======================================================

This is a very simply stated and legitimate question.

I am very surprised that there is an easy way to make alias
in perl but apparently there is no way to clear/remove the alias
and then bind the alias to another variable/reference.

This may very well be a problem which cannot be resolved in the
current design/implementation of perl. I had tried modperl
mailing list first with the Apache::Registry context
fully exposed. No one responded. That is why I tried
to reach more perl gurus in this group in hope
to find someone to give affirmative yes/no answer.

Making the problem too specialized will not reach as
many perl gurus who may not use modperl at all.

Thanks for your attention.

In article
<Pine.GSO.4.10.10005030911050.13677-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Wed, 3 May 2000 richard_chen@my-deja.com wrote:
>
> > One example is making legacy cgi scripts to work under modperl.
There
> > you can use Apache::Registry to wrap you cgi script as another
package
> > and this gets cached by apache server and used many times.
> >
> > Since each invocation of the script will involve completely
different
> > variables in a given specified package name space, it is absolutely
> > essential to clear and then reuse the name space. Otherwise, one
> > request's data will get used by the next request.
>
> Well, the CGI program shouldn't be using globals except if it's
intending
> to leave data in memory for a future request. The manpage for
> Apache::Registry should make this clear, but it doesn't.
>
> > Sorry I did not give enough motivation for this. But I think this
> > should be feasible in perl, given that it is such a mature language.
> > The question is not how to do it another way, but if there is a way
to
> > do it head on.
>
> Well, clearing the symbol table _is_ possible. But a part of the
problem
> in your situation is that, for efficiency reasons, clearing the symbol
> table isn't enough to destroy a variable - the compiled code itself
> can "remember" the variable.
>
>     #!/usr/bin/perl -wl
>
>     $fred::flintstone = "I'm still here";
>
>     undef %{fred::};    # Delete the fred:: symbol table
>
>     # This gets bound at compile time
>     print $fred::flintstone;
>
>     # But this won't be seen until runtime
>     eval 'print $fred::flintstone';
>
> So, deleting a symbol table may not do you any good.
>
> "Wait!" I can hear someone saying. "That eval complained that the
variable
> was undefined - so clearing the symbol table worked! Can't we just
wrap
> the code in an eval string?" Sure - but then you'd be re-compiling
your
> program every time it's called, throwing away the gains you could get
by
> using Apache::Registry.
>
> If (instead of the simple undef above) I had used
> Symbol::delete_package('fred'), I would have gotten the same result.
>
> Despite the FAQ's implication to the contrary, the scrub_package()
code
> from perlfaq7 does something different - it hunts down the original
value
> and kills it. As you found, that wasn't what you wanted either. In
this
> example code, it deletes $barney::rubble, a variable imported from
another
> package.
>
>     #!/usr/bin/perl -wl
>
>     $barney::rubble = "I'm in another package";
>
>     # This aliases one variable to another, as done
>     # in the importer
>     *fred::buddy = \$barney::rubble;
>
>     print "Fred's buddy is $fred::buddy";
>     print "The original variable was $barney::rubble";
>
>     scrub_package('fred');
>
>     print "Fred's buddy is $fred::buddy";
>     print "The original variable was $barney::rubble";
>
>     sub scrub_package {
> 	no strict 'refs';
> 	my $pack = shift;
> 	die "Shouldn't delete main package"
> 	    if $pack eq '' || $pack eq 'main';
> 	my $stash = *{$pack . '::'}{HASH};
> 	for my $name (keys %$stash) {
> 	    my $fullname = $pack . '::' . $name;
> 	    # Get rid of everything with that name
> 	    undef $$fullname;
> 	    undef @$fullname;
> 	    undef %$fullname;
> 	    undef &$fullname;
> 	    undef *$fullname;
> 	}
>     }
>
> Having said all that, I should make it clear that I don't know
everything
> about such topics. In fact, I think no one knows the whole picture,
> although many are much better informed than I. If I've overlooked
> something serious here, I hope that someone will say so.
>
> But it looks to me as if programs written to work in Apache::Registry
(or
> similar environments) should use globals only when they intend to pass
> those values along to be used in future requests.
>
> Cheers!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>
>


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


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

Date: Wed, 3 May 2000 14:04:35 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: comparison operator help
Message-Id: <MPG.137a343ddd820b1f98a9e3@nntp.hpl.hp.com>

In article <8epupr$muh$1@nnrp1.deja.com> on Wed, 03 May 2000 19:31:07 
GMT, Coby West <cobyw@yahoo.com> says...
> Is there a perl comparison operator(s) that work for both
> numeric/char?  I am trying to compare users in a database..some users
> have numbers in the name and others do not.  I know that != is for
> comparing numbers and ne is for chars.  Can someone help me with
> comparing both...

I sense a confusion in your question between 'chars' and 'letters'.

Lexicographic comparison compares strings (sequences of characters), no 
matter what type of characters they are.  Numerical comparison compares 
numbers (or sequences of characters converted into numbers).  Thus:

    '00' ne '0'

but

    '00' == '0'

The quoting in the second expression is optional.  Perl will do the 
Right Thing.

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


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

Date: Wed, 3 May 2000 16:29:04 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: comparison operator help
Message-Id: <slrn8h130g.8j0.tadmc@magna.metronet.com>

On Wed, 03 May 2000 19:31:07 GMT, Coby West <cobyw@yahoo.com> wrote:

>Is there a perl comparison operator(s) that work for both
>numeric/char?  


I dunno, but that's OK, because you do not need what
you have asked for  :-)

( and I'm not too sure that I understand what it is that you
  are asking for due to your playing fast and loose with
  the terminology...
)


>I am trying to compare users in a database..some users
>have numbers in the name and others do not.  I know that != is for
      ^^^^^^^^^^^^^^^^^^^

I think perhaps you meant "digit characters in the name" ?


>comparing numbers and ne is for chars.  


No, ne is for comparing _strings_ (of characters).

strings are allowed to have digit characters in them.

so 'ne' will work just fine.


>Can someone help me


You are chasing a red herring.


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


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

Date: Wed, 3 May 2000 13:43:12 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: comparison operator help
Message-Id: <Pine.GSO.4.10.10005031337050.13677-100000@user2.teleport.com>

On Wed, 3 May 2000, Coby West wrote:

> Is there a perl comparison operator(s) that work for both
> numeric/char?  

They all do! Of course, some are a better choice than others for a given
situation. :-)

Seriously, this is like asking whether there's some article of clothing
you can wear that's good for both going swimming and going to the senior
prom. You should probably pick one.

> I am trying to compare users in a database..some users
> have numbers in the name and others do not.  

A sequence of digits doesn't make something a number. "HAL-9000" is a
string. -9000 is a number.

> 	open (PEOPLE, "$Users");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

Of course, the quote marks there are merely misleading.

> 	if ($form{'User'} ne $User[0])    <----this is it!

Well, that could be correct. But maybe you want something different. Can
you cut your code down to a small, stand-alone example which shows what
you mean? For example, to illustrate this line, it would be good to use
two variables which have known values. 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: 3 May 2000 19:13:52 GMT
From: The WebDragon <nospam@devnull.com>
Subject: DOS-ify / Mac-ify output files
Message-Id: <8eptpg$ttk$0@216.155.32.166>

Does anyone know of any module or routines that one could quickly and 
efficiently grab a file and either dosify or macify the CR vs CR/LF? 

CC's via e-mail are appreciated if you post code but mind the address in 
the sig

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 03 May 2000 21:12:08 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Error: Next 2 tokens.
Message-Id: <IC0Q4.57487$h01.421874@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <3910866F.C6A82839@eurekanet.com>,
	Sid Malhotra <sid@eurekanet.com> writes:
> 
> Could someone tell me what this error means:
> 
> Sid {28} std.pl
> syntax error in file std.pl at line 8, next 2 tokens "isLoggedIn("
> Execution of std.pl aborted due to compilation errors.
> Sid {29}

"next 2 tokens" is a dead giveaway: You're using Perl 4.


Stop it.  Get a new load of Perl from somewhere.  Upgrade.
Please stop beating that 6-year-old dead Camel to death.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 03 May 2000 13:46:55 -0700
From: Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU>
Subject: Re: Error: Next 2 tokens.
Message-Id: <u5kaei72wg0.fsf@davis.DEMOG.Berkeley.EDU>

Sid Malhotra <sid@eurekanet.com> writes:

> Could someone tell me what this error means:

Sure - your own computer can tell you that when you type:

perldoc perldiag
or
man perldiag

> 
> Sid {28} std.pl
> syntax error in file std.pl at line 8, next 2 tokens "isLoggedIn("
> Execution of std.pl aborted due to compilation errors.
> Sid {29}
> 
> 
> Here's my code:
> 
> #!/usr/bin/perl
> 

no -w.
no use strict;.

> sub printtable {
>         print "<table border=5 rows=1 cols=2 align=right>\n";
>         print "<tr><td></td><td align=right>\n";
> 
>         print $ENV{'REMOTE_HOST'};
>         if (isLoggedIn($ENV{'REMOTE_HOST'})) {

Hint: does perl know what isLoggedIn means?

>                 print "<a href=user.cgi?ac=lo>Logout</a>\n";
>         } else {
>                 print "<a href=user.cgi?ac=li>User Login</a>\n";
>         }
>         print "</td></tr></table>\n";
> }
> 
> sub isLoggedIn {
>         print "Entered isLoggedIn";
>         local ($ip) = @_;

my() is Better than local().

>         return 0;
> }
> 
> 1;
> 
> 

-- 
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography    -    University of California at Berkeley
2232 Piedmont Avenue #2120  -    Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199


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

Date: Wed, 3 May 2000 14:04:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Error: Next 2 tokens.
Message-Id: <Pine.GSO.4.10.10005031344030.13677-100000@user2.teleport.com>

On Wed, 3 May 2000, Sid Malhotra wrote:

> Could someone tell me what this error means:

> syntax error in file std.pl at line 8, next 2 tokens "isLoggedIn("

It means you're using a version of perl known around these parts as a
dead, flea-bitten camel carcass. It's not pinin'. It's passed on. This
perl is no more. It has ceased to be. It's expired and gone to meet its
maker. It's a stiff. Bereft of life, it rests in peace. Its metabolic
processes are now 'istory. It's kicked the bucket, it's shuffled off its
mortal coil, run down the curtain and joined the bleedin' choir
invisibile. This is an ex-perl.

In short, it's perl four. Upgrade. 

Beautiful plumage, though.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 3 May 2000 11:12:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: FYI : Compiling Perl to EXE (Windows or UNIX)
Message-Id: <Pine.GSO.4.10.10005031048020.13677-100000@user2.teleport.com>

On Wed, 3 May 2000 exhacker@my-deja.com wrote:

> On one of my web-robot scripts that involved contacting http servers
> repeatedly, the Executable version ran 56-58% *faster* than the Perl
> version, and took up less memory (Perl takes up 4-8MB easily).

> Here's the link: http://www.dynamicstate.com/perl2exe.htm

I'm suspicious of your claim. It may be true, but I'm still suspicious.
That's a pretty amazing increase in speed. Do you have a program you can
make available (in both source and "compiled" form) which shows this kind
of speed increase?

Part of what makes me so suspicious is that much of the time used by a
program which contacts http servers repeatedly is likely to be netlag.
Compiling won't help that.

Another part of what makes me so suspicious is this statement from the
pxman.htm document which comes with perl2exe:

       3. Perl2Exe performance
       Programs created with Perl2Exe will run at about the same speed as
       perl scripts run with the standard interpreter. 

So the publisher of the software isn't claiming the kind of speed increase
you're claiming. 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 03 May 2000 21:18:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: HELP : Script works on Command Line but not as CGI when using
Message-Id: <sh15t6rua4n185@corp.supernews.com>

Carey bingham (carey_bingham@TransCanada.com) wrote:
: You are a god send :)  I actually had done that in previous scripts just out
: of habit, why I didn't this time I have no idea but it worked :)

Glad I could help.  By the way, for future reference, it's polite to mark
a response that is both emailed and posted; that way duplication of effort
is avoided.

: I added this line to the start of the script :
: 
: use lib("d:\\cgi\\surveys\\devt\\employee_survey\\");

It's a (too-)little-known quirk of the DOS-derived OSs that forward
slashes work as directory separators everywhere except in the command
shell itself.  So you can replace the \\s above with /s.

: I tried swapping the above with :
: 
: require("d:\\cgi\\surveys\\devt\\employee_survey\\FormWrite.pl");
: 
: and it still worked !

Cool.  Changing the working dir to the script's dir in a BEGIN block is
another option I've used frequently in this situation.

: Thank you for you suggestion, I thought I was going looney !!

Well, you still may be; just can't use this as evidence anymore. :)

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 2936
**************************************


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