[18932] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1127 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 13 14:06:33 2001

Date: Wed, 13 Jun 2001 11:05:13 -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: <992455513-v10-i1127@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 13 Jun 2001     Volume: 10 Number: 1127

Today's topics:
    Re: [OT] Re: Help with split?vvp <godzilla@stomp.stomp.tokyo>
    Re: [OT] Re: Help with split?vvp <godzilla@stomp.stomp.tokyo>
    Re: ActivePerl secure, robust? <nospam@hotmail.com>
        assigning a directory as a variable in opendir <lev@circadence.ca>
    Re: assigning a directory as a variable in opendir (Rasputin)
    Re: assigning a directory as a variable in opendir <arbman@dhmail.net>
        cgi browser recognition <bed@cic-mail.lanl.gov>
    Re: cgi browser recognition <andras@mortgagestats.com>
    Re: cgi browser recognition <pne-news-20010613@newton.digitalspace.net>
        Compatibility of forms on all Browser (aol error) <hugonv@home.com>
        date problem <jddp@tid.es>
    Re: date problem (Anno Siegel)
    Re: date problem <jddp@tid.es>
    Re: Foreach Not Behaving Properly (Steve)
        How do I get the current directory from Windows Explore (Garry)
    Re: how do I sort the output of this? <ren@tivoli.com>
    Re: how do I sort the output of this? <Patrick_member@newsguy.com>
    Re: is there a windows installer for perl ? (Helgi Briem)
    Re: Limiting special characters <davsoming@lineone.net>
    Re: Limiting special characters (E.Chang)
    Re: New word <pne-news-20010613@newton.digitalspace.net>
    Re: New word <gamtci@mpinet.net>
    Re: perl script runs twice <lmoran@wtsg.com>
        Perl switch -w (DJ)
    Re: Perl switch -w <andras@mortgagestats.com>
    Re: REGEX <ren@tivoli.com>
        Reval, Regular Expression, and Searching for Emails (DJ)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 13 Jun 2001 08:11:06 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: [OT] Re: Help with split?vvp
Message-Id: <3B27828A.DE91227@stomp.stomp.tokyo>

Ron Hill wrote:
 
> Godzilla! wrote:
 
(snipped)

(topic is problem with newline treatment upon opening / saving a file)


> I also use PFE, Have you tried the save as option and check the unix
> format box?

Naturally I just spent a good amount of time searching for
this feature under preferences, with no luck. Finally dawned
upon me to look in the "save" function under File. I found
this unix feature and will run tests on this.

Thank you for this information. This just might resolve this
problem with automatic addition of a terminating newline upon
file save and automatic truncation of double terminating newlines
upon opening a file. This might also prevent any future embarrassment
for me by claiming certain code doesn't work when it does! Well,
at least prevent this specific causation of embarrassment.

Heh!

I will test this feature today and post my results.


Godzilla!


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

Date: Wed, 13 Jun 2001 09:39:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: [OT] Re: Help with split?vvp
Message-Id: <3B27975A.88BDA802@stomp.stomp.tokyo>

Ron Hill wrote:
 
> Godzilla! wrote:
 
(snipped, reference my parallel article on testing unix format)

> I also use PFE, Have you tried the save as option and check the unix
> format box?


I have run tests on this "save in unix format" feature
of Program File Editor. My test results are not quite
for what I hoped.

In keeping with my stern position about presenting good
documentation, my article is a bit verbose to be sure
all parameters are at least mentioned to ensure a degree
of good understanding.

All tests of PFE are performed with PFE's Windows
version rather than DOS version. I have not yet
tested the DOS version.

Initially, I started by deleting all test.txt files
to ensure no outside externalities. I created two
new files, test1.txt and test2.txt both saved with
the "unix" option under File .. save as.. 

To display my Enter key use, I have intentionally
typed in \n to show my addition of newlines. There
are no blank lines following my terminating newlines.

My test1.txt is created by hitting my Enter key after
the first two lines but not the third line:

line one\n
line two\n
line three


My test2.txt is created the same but with a Enter key
created newline after the third and final line:

line one\n
line two\n
line three\n

Next, I opened both unix style saved files and
performed a search and replace PFE function,
replacing all \n with a capital X. Both files
display these results:

line oneXline twoXline threeX

Well darn it, PFE is still adding a newline
to test1.txt and truncating terminating double
newlines in test2.txt to a single newline, which
led to my initial mistake within this thread.

To test how both test1.txt and test2.txt
are saved using the unix option, I used
this Perl test script below my signature.

My first test verifies PFE is automatically
adding a terminating newline even when not
added with my Enter key:

line oneXline twoXline threeX


My second Perl test verifies PFE is adding
my Enter key created terminating newline
and automatically adding a second newline,
although only one newline is displayed
upon PFE file open:

line oneXline twoXline threeXX


I am making a presumption PFE adds a terminating
newline character regardless if a terminating
newline is present or not present and regardless
of its "save in unix format" feature being used.
Another presumption is made PFE automatically
truncates terminating \n\n to a single newline
when a file is opened for viewing. Evidence does
support my presumptions as valid.

My hunch is the unix feature may write certain
end-of-line and terminating end-of-file characters
in a different format but still automatically adds
a terminating newline under all conditions.

Nevertheless, I really like PFE as a program editor 
and will continue using it, keeping in mind to be
careful about terminating newlines when testing
Perl scripts. Easy enough to address this via Perl
when I need to remove a final newline or need to
remove double final newlines.


Thanks again for your input. I am sure this information
and my tests will prove useful to many as a cautionary
note on program editor behavior.


Godzilla!
--

#!perl

print "Content-type: text/plain\n\n";

print "Test One:\n\n";

open (TEST1, "test1.txt");
while (<TEST1>)
 {
  $_ =~ s/\n/X/g;
  print $_;
 }
close (TEST1);


print "\n\nTest Two:\n\n";


open (TEST2, "test2.txt");
while (<TEST2>)
 {
  $_ =~ s/\n/X/g;
  print $_;
 }
close (TEST2);

exit;

PRINTED RESULTS:
________________

Test One:

line oneXline twoXline threeX

Test Two:

line oneXline twoXline threeXX


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

Date: Wed, 13 Jun 2001 11:29:43 -0500
From: Mr. SunRay <nospam@hotmail.com>
Subject: Re: ActivePerl secure, robust?
Message-Id: <XxMV6.222$wj7.117362@news.uswest.net>

I wrote:

> Hi,
> 
> Is ActivePerl secure and robust for production use? We're hosting numerous
> organization's web sites and I'm looking for information on what I need to
> do to set up ActivePerl in a way that prevents security problems.
> 
> Can anyone point me to any info about that?
> 
> Thanks a lot!
> 
> Young
> 
> 

There is nothing inherently "insecure" about ActiveState's distro of perl that 
I'm aware of, unless you're worried about someone getting access to ppm.

The only gripe I generally have with it is that it's not configurable (no 
Threads, no SOCKS, etc).

Regards,

Mr. Sunray



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

Date: Wed, 13 Jun 2001 11:24:05 -0400
From: "Lev Altshuler" <lev@circadence.ca>
Subject: assigning a directory as a variable in opendir
Message-Id: <vBLV6.248739$Z2.2876816@nnrp1.uunet.ca>

Good morning, colleagues!

I have an @array of directories names, generated on the fly.
Now I need to read the content of these directories. I try to do it
something like this:

opendir(FH, $array[0]) || die  "cannot open $array[0]: $!";
@files = readdir(FH);

I get a message: cannot open [correct name of the directory] : no such file
or directory.
So, the program reads correctly the directory's name, but complains as a
directory name
is assigned as a variable and not as a constant. If $array[0] is replaced
with the constant
like C:/Windows/Cookies, it , of course, works.
I encounter this problem both on Windows and Unix

The same  happens with chdir '$array[0]'.

If you have an idea why it happens and how to solve this problem, I will
very appreciate.

----------------------
Lev

lev@circadence.ca










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

Date: Wed, 13 Jun 2001 15:32:44 GMT
From: rasputin@shaft.techsupport.co.uk (Rasputin)
Subject: Re: assigning a directory as a variable in opendir
Message-Id: <slrn9if1se.440.rasputin@shaft.techsupport.co.uk>

In article <vBLV6.248739$Z2.2876816@nnrp1.uunet.ca>, Lev Altshuler wrote:
> Good morning, colleagues!
> 
> I have an @array of directories names, generated on the fly.

> Now I need to read the content of these directories. I try to do it
> something like this:
> 
> opendir(FH, $array[0]) || die  "cannot open $array[0]: $!";
> @files = readdir(FH);
> 
> I get a message: cannot open [correct name of the directory] : no such file
> or directory.

> The same  happens with chdir '$array[0]'.

How did you get the directory names - 
maybe you've got trailing newlines or something?

And are they full paths to the directory?
(I'm wondering if the working directory has changed.)

-- 
"These are the propulsion systems used by NASA for the moonshots,"
		said Tom apologetically. 
Rasputin :: Jack of All Trades - Master of Nuns ::


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

Date: Wed, 13 Jun 2001 17:30:29 +0200
From: Scott Rutherford <arbman@dhmail.net>
Subject: Re: assigning a directory as a variable in opendir
Message-Id: <3B278715.6830BB1@dhmail.net>

Lev Altshuler wrote:

> Good morning, colleagues!
>
> I have an @array of directories names, generated on the fly.
> Now I need to read the content of these directories. I try to do it
> something like this:
>
> opendir(FH, $array[0]) || die  "cannot open $array[0]: $!";
> @files = readdir(FH);
>
> I get a message: cannot open [correct name of the directory] : no such file
> or directory.
> So, the program reads correctly the directory's name, but complains as a
> directory name
> is assigned as a variable and not as a constant. If $array[0] is replaced
> with the constant
> like C:/Windows/Cookies, it , of course, works.
> I encounter this problem both on Windows and Unix
>
> The same  happens with chdir '$array[0]'.
>

I think that this is because you are not forcing the variable to be
interpolated in open
open (FILE, $array[0]);

but you are in the error message. So try

open (FILE, "$array[0]") || die "I'm crap";

That should make the $array[0] variable be interpolated before it's use.
And again the last example the single quotes don;t interoplate the variable.

Hope that helps Scott

>
> If you have an idea why it happens and how to solve this problem, I will
> very appreciate.
>
> ----------------------
> Lev
>
> lev@circadence.ca



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

Date: Wed, 13 Jun 2001 11:10:17 -0600
From: "Brian E. Douglass" <bed@cic-mail.lanl.gov>
Subject: cgi browser recognition
Message-Id: <3B279E79.1BA95D76@cic-mail.lanl.gov>

In one of my programs I have a form. It works perfectly with Netscape,
but not with IE. I was wondering how I could set up the script to
recognize which browser was running it, so I can set up two different
forms. Thanks,
Brian



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

Date: Wed, 13 Jun 2001 13:27:01 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: cgi browser recognition
Message-Id: <3B27A265.22FC6D75@mortgagestats.com>



"Brian E. Douglass" wrote:

> In one of my programs I have a form. It works perfectly with Netscape,
> but not with IE. I was wondering how I could set up the script to
> recognize which browser was running it, so I can set up two different
> forms. Thanks,
> Brian

The HTTP_USER_AGENT environment variable tells you what the browser
identifies itself as. See the CGI.pm documentation for a way to read that
environment variable.



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

Date: Wed, 13 Jun 2001 19:34:17 +0200
From: Philip Newton <pne-news-20010613@newton.digitalspace.net>
Subject: Re: cgi browser recognition
Message-Id: <109fitgqm1svrdl7c24b5rbjvq9c8pg0b5@4ax.com>

On Wed, 13 Jun 2001 13:27:01 -0400, Andras Malatinszky
<andras@mortgagestats.com> wrote:

> The HTTP_USER_AGENT environment variable tells you what the browser
> identifies itself as.

Note that many browsers lie about themselves.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 13 Jun 2001 15:58:23 GMT
From: "Hugo Perez" <hugonv@home.com>
Subject: Compatibility of forms on all Browser (aol error)
Message-Id: <z4MV6.12613$036.3050819@news1.elcjn1.sdca.home.com>

Greetings,
    I created a basic form on dreamweaver and it works fine on my computer
( system: PC, browser: Explorer, email: Outlook express) but my client
noticed that when using AOL the information filled out on the form is not
sent. I recognized that I wasn't doing enough so I educated my self on
scripts and languages. I just ended up confused. I need to have a form
that's compatible with all browsers in order to satisfy my customers.

I appreciate all comments. Thank You.






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

Date: Wed, 13 Jun 2001 16:53:45 +0200
From: Juan Delgado =?iso-8859-1?Q?D=EDaz=2DPache?= <jddp@tid.es>
Subject: date problem
Message-Id: <3B277E79.E8C9FA54@tid.es>

Hi,

This is a difficult one. I have commercial product which has a perl
interpreter embedded, and i get this error:

date: bad conversion
dsrdate: illegal option -- 1
sh: syntax error at line 3: `newline or ;' unexpected
sh: syntax error at line 3: `newline or ;' unexpected
Executing: $CampaignStart=12/31/1899 00:00:00;$CampaignEnd=12/31/1899
23:59:59 a
gainst netCustomer:System/Contexts/Variables

I post the complete error to show that the resulting dates are
incorrect. I have perl 5.00503 on solaris. The thing is i can't see the
perl code, so i am asking you to gess what can be happening.

Lots of thanks
Juan



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

Date: 13 Jun 2001 16:17:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: date problem
Message-Id: <9g83mi$jov$1@mamenchi.zrz.TU-Berlin.DE>

According to Juan Delgado Díaz-Pache  <jddp@tid.es>:
> Hi,
> 
> This is a difficult one. I have commercial product which has a perl
                                  ^^^^^^^^^^
Then the vendor should support it.

> interpreter embedded, and i get this error:
 
These don't look like Perl errors.

> date: bad conversion
> dsrdate: illegal option -- 1

The first would be the date command complaining about an illegal
format string.  Dunno about dsrdate.

> sh: syntax error at line 3: `newline or ;' unexpected
> sh: syntax error at line 3: `newline or ;' unexpected

That's a Bourne-like shell complaining, probably about being
fed Perl code, but who knows.

> Executing: $CampaignStart=12/31/1899 00:00:00;$CampaignEnd=12/31/1899
> 23:59:59 a
> gainst netCustomer:System/Contexts/Variables

The program appears to call external functions that don't quite
meet its expectations.  Whether it's the Perl part that's
calling them, or another mechanism we have no way of telling.

> I post the complete error to show that the resulting dates are
> incorrect. I have perl 5.00503 on solaris. The thing is i can't see the
> perl code, so i am asking you to gess what can be happening.

This is no way to fix a commercial product (or indeed any program).
Ask the people who sell it, they should know how it works.

Anno


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

Date: Wed, 13 Jun 2001 19:22:03 +0200
From: Juan Delgado <jddp@tid.es>
Subject: Re: date problem
Message-Id: <3B27A13A.750027F@tid.es>

ok, just trying.
Thanks
Juan





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

Date: 13 Jun 2001 17:18:42 GMT
From: steve@zeropps.uklinux.net (Steve)
Subject: Re: Foreach Not Behaving Properly
Message-Id: <slrn9iepn1.h73.steve@zero-pps.localdomain>

On 12 Jun 2001 18:01:29 GMT, Barry Allwood wrote:
>Hey,
>
>I am making a news script not to similar to newspro and I was wondering why
>when I use 2 foreach loops to display news I get an extra box
>(http://www.sky-scraper.net/phoenix/bpnews2.cgi) at the bottom, here is the
>code if you need it
>
>#!/usr/bin/perl
>
>require "bpcs.pl";
>
>print "Content-type: text/html\n\n"; 

I havn't tested this script, but I'd suggest running with -w (gives you warnings
in the log file), and using CGI.pm, these two things will make life a bit easier
for you. 

--
Cheers
Steve              email mailto:steve@zeropps.uklinux.net

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  2:07pm  up 131 days, 14:57,  2 users,  load average: 1.00, 1.05, 1.07


--
Cheers
Steve              email mailto:steve@zeropps.uklinux.net

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  2:12pm  up 131 days, 15:02,  2 users,  load average: 1.00, 1.01, 1.04


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

Date: 13 Jun 2001 08:18:21 -0700
From: garry_short@hotmail.com (Garry)
Subject: How do I get the current directory from Windows Explorer?
Message-Id: <bdcefd33.0106130718.34d1e0f2@posting.google.com>

Hello.

First off, I'm running the latest version of ActiveState Perl on
Windows NT 4.0, SP5.

I'm writing a script that is triggered by actions within Windows
Explorer, and needs to know what the current working directory is.
Unfortunately, the Win32::GetCwd function is returning with C:\Program
Files\Common Files\ ...., and not the directory that's open in
Explorer.

Can anyone tell me how to get the information I actually want out of
this??

I've had a look through the perl man pages, and a couple of books I
have, and haven't found anything useful (though I may have missed it
if it's there).

--

For those who know what I'm talking about, this script is supposed to
work as a trigger within Rational ClearCase. The idea is that it
checks to see what View a person is in, and what VOBs he has loaded,
before working out whether to let him perform merges, rebases,
deliveries, etc. Assuming the criteria are met, it then determines
whether the user is in the correct NT group to be able to carry out
this action.

--

Many thanks,

Garry


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

Date: 13 Jun 2001 10:48:52 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: how do I sort the output of this?
Message-Id: <m3puc8js7v.fsf@dhcp9-173.support.tivoli.com>

On 12 Jun 2001, Patrick_member@newsguy.com wrote:

>   Have the following procedure that I just wrote:

You should really see about including:

use strict;
use warnings;

at the top of your scripts.  You will have to make some other changes
to go along with those.

> #
> # Usage: perl dtrees.pl PATH
> # if PATH not defined then PATH=.
> #
> use File::Find;
> my $this_subtree;
> 
> 
> @ARGV = ('.') unless @ARGV;
> my $dir = $ARGV[0];
> 
> # if there isn't a backslash at the end of ARGV[0] add one
> if ( substr($dir,-1) ne "\" ) { $dir = $dir . "\";}

That's a syntax error.

  if ( substr($dir,-1) ne "/" ) { $dir .= "/" }

> opendir DIR, $dir or die "can't opendir $dirname: $!";
> while (defined($file = readdir(DIR))) {
>     if (-d ($dir . $file) && $file ne "." && $file ne "..") {
> 	find sub { $this_subtree += -s }, ($dir . $file);

Change this:

> 	write();

To:

        push @output, [ $file, $this_subtree ]; 

> 	$this_subtree = 0;
>     }
> }
> closedir(DIR);

And add this here:

($file,$this_subtree)=@$_ and write for sort { $a->[1] <=> $b->[1] } @output;

> format STDOUT =
> @<<<<<<<<<<<<<<<<<<<<<          @###########
> $file                           $this_subtree
> .
> 
> This works well enough.  It takes all the directories within pwd and
> finds the subtree of each.
> 
> Next iteration.  I'd like to sort the output by the size field
> ($this_subtree).
> 
> I've tried saving each line produced by the write() statement via a
> push to an array.  But it's not clear to me how to use sort to sort
> on a certain column range within each string?  Or do I need to set
> up my elements as data structures (with, presumably, a name and a
> size)?

The solution above pushes the data for the write and delays the write
until the end when the data can be sorted.  There are, of course,
other ways to do this.

-- 
Ren Maddox
ren@tivoli.com


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

Date: 13 Jun 2001 09:49:40 -0700
From: Patrick Flaherty <Patrick_member@newsguy.com>
Subject: Re: how do I sort the output of this?
Message-Id: <9g85j40173u@drn.newsguy.com>

Thanx for your message John,


In article <3B274D66.84CD4A84@acm.org>, "John says...
>
>Patrick Flaherty wrote:
>> 
>> Hello,
>> 
>>   Have the following procedure that I just wrote:
>> 
>> #
>> # Usage: perl dtrees.pl PATH
>> # if PATH not defined then PATH=.
>> #
>> use File::Find;
>> my $this_subtree;
>> 
>> @ARGV = ('.') unless @ARGV;
>> my $dir = $ARGV[0];
>
>my $dir = $ARGV[0] || '.';
>

  Yes that's shorter.  I made this change.

>
>> # if there isn't a backslash at the end of ARGV[0] add one
>> if ( substr($dir,-1) ne "\" ) { $dir = $dir . "\";}
>                           ^^                    ^^
>This is a syntax error. You should use a slash instead of a backslash or
>escape the backslash.
>

Actually I did have double back-slashes.  Newsguy seems to strip them out when I
post the code.  I've noticed this sort of thing once before and I suppose I
should check into it.

>
>> opendir DIR, $dir or die "can't opendir $dirname: $!";
>                                          ^^^^^^^^
>Where did the variable $dirname come from?
>

  Corrected.

>
>> while (defined($file = readdir(DIR))) {
>>     if (-d ($dir . $file) && $file ne "." && $file ne "..") {
>>         find sub { $this_subtree += -s }, ($dir . $file);
>>         write();
>>         $this_subtree = 0;
>>     }
>> }
>> closedir(DIR);
>> 
>> format STDOUT =
>> @<<<<<<<<<<<<<<<<<<<<<          @###########
>> $file                           $this_subtree
>> .
>> 
>>This works well enough.  It takes all the directories within pwd and finds the
>> subtree of each.
>> 
>>Next iteration.  I'd like to sort the output by the size field ($this_subtree).
>> 
>>I've tried saving each line produced by the write() statement via a push to an
>> array.  But it's not clear to me how to use sort to sort on a certain column
>>range within each string?  Or do I need to set up my elements as data structures
>> (with, presumably, a name and a size)?
>
>
>
>John
>-- 
>use Perl;
>program
>fulfillment


Sorting then?  In the _Perl Cookbook_, I've found section 4.15, Sorting a List
by a Computabe Field, and am looking at this.

  pat



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

Date: Wed, 13 Jun 2001 15:21:54 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: is there a windows installer for perl ?
Message-Id: <3b27832a.1233226906@news.isholf.is>

On Wed, 13 Jun 2001 15:21:43 +0800, "ivan markose"
<ivanmarkose@hotmail.com> wrote:

>I'd like to know if there is a package to install perl
>on windows, not binaries that I don't know the head
>or tail of. I found this very good book - Mastering
>algorithms with Perl that I would like to learn from.
>Again what I have in mind is along the lines of
>the python installer for windows.

http://aspn.activestate.com/ASPN/Downloads/ActivePerl/

Get the MSI package if you have Microsoft Installer 
(Win2K, Me standard, available for NT4, 95 & 98),
or the zip file if not.

Or if you would like a bundle of perl and apache, you
could try www.indigostar.com/indigoperl.htm

Also, although MAwP is certainly an excellent book,
it is perhaps not the best to start you off
learning Perl, especially if you  "don't know the
head or tail of binaries".  Programming Perl
from O'Reilly is something every Perl 
programmer must have in any case.

Regards,
Helgi Briem


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

Date: Wed, 13 Jun 2001 18:14:17 +0100
From: "David Soming" <davsoming@lineone.net>
Subject: Re: Limiting special characters
Message-Id: <tif7ffirh2k4c0@corp.supernews.co.uk>


> >
> > char   *percent_x(...)  ######No idea what this line is/does!        {
> >                 {...}
> >             static char ok_chars[] = "1234567890!@%-_=+:,./\
> >         abcdefghijklmnopqrstuvwxyz\
> >         ABCDEFGHIJKLMNOPQRSTUVWXYZ";
> >
> >                 {...}
> >
> >         for (cp = expansion; *(cp += strspn(cp, ok_chars)); /* */ )
#####Nor
> > this!
> >                 *cp = '_';
> >
> >                 {...}
>
> This is a C (or C++) program example. The perl equivalent would be:
>
> $data =~ s#[^0-9a-zA-Z!@%_=+:,./-]#_#
>
>
> John
> --
According to: http://www.cert.org/tech_tips/cgi_metacharacters.html#4 it's a
perl program?

--
David Soming
'Just a head-banger- doing what I do best'
______________




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

Date: Wed, 13 Jun 2001 17:16:42 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Limiting special characters
Message-Id: <Xns90BF87987CD2Eechangnetstormnet@207.106.92.86>

"David Soming" <davsoming@lineone.net> wrote in
<tif7ffirh2k4c0@corp.supernews.co.uk>: 

[snip]

>According to:
>http://www.cert.org/tech_tips/cgi_metacharacters.html#4 it's a perl
>program? 
>

The first example there is a 10-line Perl program. It is followed by 
the brief statement

"Likewise, the same updated example in C:"

and the folowing code is a C program.

-- 
EBC


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

Date: Wed, 13 Jun 2001 17:46:10 +0200
From: Philip Newton <pne-news-20010613@newton.digitalspace.net>
Subject: Re: New word
Message-Id: <uh2fit83k2oit2l2ume8ih4uifcdtobns0@4ax.com>

On 13 Jun 2001 08:51:19 -0600, gls@byu.edu wrote:

> If that does not already do what you want, what would your 
> merge function do differently?

Presumably incorporate the second file into the same lexical scope as
the first, so that 'my' variables in the calling file are visible from
the merged file and can be set there, with their values propagating back
into the first -- as if Perl treats both as one source file.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 13 Jun 2001 17:16:44 GMT
From: Gary <gamtci@mpinet.net>
Subject: Re: New word
Message-Id: <3B27A04D.3036@mpinet.net>

Yes, exactly. After "merge filename.pl" the file merged file 
appears to Perl as though it were normal text encountered 
at the merge command's location in the original file. No exports
or other details to get at the variables.


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

Date: Wed, 13 Jun 2001 12:10:51 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: perl script runs twice
Message-Id: <q34fit8uher9k0d1cta28hk7v1ktl1i9ud@4ax.com>

On Wed, 13 Jun 2001 10:57:24 GMT, helgi@NOSPAMdecode.is (Helgi Briem)
wrote wonderful things about sparkplugs:

>On 12 Jun 2001 13:32:40 -0700, ccc2@lehigh.edu (chris)
>wrote:
>
>>I have a perl script acting as a CGI, and when I run it in IE 5.5, it
>>runs twice for no discernable reason.  It works fine in IE 5.0, does
>>anybody have any idea why 5.5 could be making it run twice, and how I
>>could make it stop?
>
>It looks to me as if you have a problem with your 
>FeebleDork.  Ugrade your Frimnitzer to version 6
>and reapply Service pack 1.3 to your GobbleDiGook.
>
Thanks that worked!


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

Date: 13 Jun 2001 08:46:16 -0700
From: firststarfighter@hotmail.com (DJ)
Subject: Perl switch -w
Message-Id: <46b4d4d2.0106130746.2c45479b@posting.google.com>

Hi.

I have been playing --- testing some perl scripts. In response to
receiving an Internal Server Error, I added the -w.  I expected to see
warning messages in the log file, but the script would still fail. I
did see a warning message in the log, but I was surprised because the
script worked.  If I removed the -w, it did not, if I added it, it
did.

Has anyone else seen this?  Is this suppose to happen?

Thank you.
DJ


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

Date: Wed, 13 Jun 2001 13:29:26 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Perl switch -w
Message-Id: <3B27A2F6.23034DDA@mortgagestats.com>



DJ wrote:

> Hi.
>
> I have been playing --- testing some perl scripts. In response to
> receiving an Internal Server Error, I added the -w.  I expected to see
> warning messages in the log file, but the script would still fail. I
> did see a warning message in the log, but I was surprised because the
> script worked.  If I removed the -w, it did not, if I added it, it
> did.
>
> Has anyone else seen this?  Is this suppose to happen?
>
> Thank you.
> DJ

Maybe you'd care to share the script with us. Also, it would help to know
what the warning was.



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

Date: 13 Jun 2001 10:22:17 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: REGEX
Message-Id: <m3u21kjtg6.fsf@dhcp9-173.support.tivoli.com>

On Wed, 13 Jun 2001, bart.lateur@skynet.be wrote:

> Ren Maddox wrote:
> 
>>Even that last one breaks down if the starting quote is preceded by
>>a backslash q/\"like this"/;
>>
>>The look-behind solution can handle that problem as well:
>>
>>/((?<!\\)".*?(?<!\\)")/sg
>>
>>works well as long as you don't anchor it. 
> 
> Not if there's an escaped backslash in front of it, i.e. two
> backslashes. But, even then, the backslash in front of *that* could
> be escaped, i.e. 3 backslashes. Or 4. etc.

Yeah, I alluded to that at the end of my post.  I fiddled with several
attempts to handle it, and decided it wasn't worth the effort.

> Since the OP was only interested in anchored matches, i.e. starting
> with \G, this is a useless route, as there is no real fully complete
> solution this way. Anchor it, that's all you can do to be safe.

-- 
Ren Maddox
ren@tivoli.com


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

Date: 13 Jun 2001 08:42:12 -0700
From: firststarfighter@hotmail.com (DJ)
Subject: Reval, Regular Expression, and Searching for Emails
Message-Id: <46b4d4d2.0106130742.31f673e0@posting.google.com>

Hi.

I am trying to use a feature to allow regular expression searches on
email addresses.  In the file there is an email id like
Colin.O'Patrick@aol.com
I use quotemeta and it becomes Colin\.O\'Patrick\@aol\.com.  

In my form if I enter "Col" it is found, but if I were to type
"Colin\.O\'Patrick\@aol\.com" in the input field it is not found.

For example,
 Loop through data in file
  $current_email = email id from current record
  $safe_email = quotemeta($current_email);
  $expression = "'$safe_email' =~ m/" . $form_input_email . "/i";
  $match = Safe->new->reval($expression); 

If my $from_input_email is, m/Colin\.O\'Patrick\@aol\.com/i, it
doesn't match.
Is there a better way to do this?  Any thoughts?

Thank you.
DJ


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


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


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