[23740] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5946 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 16 21:05:39 2003

Date: Tue, 16 Dec 2003 18:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Dec 2003     Volume: 10 Number: 5946

Today's topics:
    Re: [HELP] code modification <paul.sellis@alussinan.org>
    Re: [HELP] code modification <asu1@c-o-r-n-e-l-l.edu>
    Re: [HELP] code modification <jgibson@mail.arc.nasa.gov>
        Communicating with Windows <anders.floderus@swipnet.se>
        error in Compress-Zlib-1.32 <linh@chello.no>
    Re: error in Compress-Zlib-1.32 <tony_curtis32@_SPAMTRAP_yahoo.com>
    Re: FILE parsing problems (G)
    Re: FILE parsing problems <asu1@c-o-r-n-e-l-l.edu>
    Re: FILE parsing problems <mahesha@mahesha.net>
    Re: Login to site with random image code? <l.v.g@moskuetiez.de>
    Re: Login to site with random image code? <dmcbride@naboo.to.org.no.spam.for.me>
    Re: Login to site with random image code? <tcurrey@no.no.i.said.no>
    Re: Perl equivalent of "On error resume" <ThomasKrarz@REMOVEwebCAPS.de>
        perl info file for emacs carney@NOscubadooSPAM.com
    Re: Problem with  Win32::Console and END block. <brian_helterline@hp.com>
    Re: recursive closures? <uri@stemsystems.com>
    Re: ticks and FreeBSD <mhunter@uclink.berkeley.edu>
        Upload directory from browser <gary@abertron.co.uk>
    Re: Upload directory from browser <matthew.garrish@sympatico.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Dec 2003 01:17:52 +0100
From: Paul Sellis <paul.sellis@alussinan.org>
Subject: Re: [HELP] code modification
Message-Id: <paul.sellis-F0F7DE.01175217122003@news2-2.free.fr>

In article (Dans l'article) 
<Xns94538351D90AAasu1cornelledu@132.236.56.8>,
 "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote (écrivait) :
> Why don't you ask the author of the script?

Can't find him !
Wrote in 1997, no nore support I thinkŠ


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

Date: 17 Dec 2003 00:52:10 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: [HELP] code modification
Message-Id: <Xns9453CA1F4EF5Fasu1cornelledu@132.236.56.8>

Paul Sellis <paul.sellis@alussinan.org> wrote in news:paul.sellis-
F0F7DE.01175217122003@news2-2.free.fr:

> In article (Dans l'article) 
> <Xns94538351D90AAasu1cornelledu@132.236.56.8>,
>  "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote (écrivait) :
>> Why don't you ask the author of the script?
> 
> Can't find him !
> Wrote in 1997, no nore support I thinkŠ

Well, since your domain name include my name, here is some advice :) (What 
does alussinan mean anyway?

You might want to dump this script and use nms formmail:

http://nms-cgi.sourceforge.net/

On the other hand, it looks like the script relies on the default behavior 
of Perl's sort function:

    If SUBNAME or BLOCK is omitted, "sort"s in standard string
    comparison order.

Hence, you ought to be able to use the scheme you suggested without 
modifying the code.

Also, I suspect this is not the full script. Where, for exampe, is %input 
initialized? And where is PrintHeader defined?

Please realize that these are rhetorical questions. Frankly, I am not 
interested in fixing this script, and I doubt anyone else is either.

Good luck.

Sinan.



-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Tue, 16 Dec 2003 18:02:40 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: [HELP] code modification
Message-Id: <161220031802409273%jgibson@mail.arc.nasa.gov>

In article <paul.sellis-6E998F.18505316122003@news1-2.free.fr>, Paul
Sellis <paul.sellis@alussinan.org> wrote:

> I need your help :
> 
> I am newbie in coding. I use a free scrit "form_processor.pl 1.0"  to 
> make forms from my html pages. I am satisfied with it. 

Congratulations! Getting a program to run under CGI can be difficult,
even for experienced programmers. However, you should realize that
installing a CGI script on a web server and linking a form on a
publicly-accesible web page can open up your server to serious security
attacks. The risk is magnified if you don't know what the program is
doing. There is also more risk if the script involves sending e-mail or
writing to files on the server, as yours does.

> 
> BUT, I have always a problem with syntax in Javascripts (and now in 
> FlashŠ) because it begins with a digit and a right parenthesis.
> i.e. 
> <input type="TEXT" name="01)name" value="1">
> The digit serves to order the fields in the results received.

What is the relevance of Javascript to your problem?

> 
> 
> Is it possible to use  alphabetical order of letters instead ?
> Like this for example :
> <input type="TEXT" name="A-name" value="10">
> <input type="TEXT" name="B-name" value="20">
> <input type="TEXT" name="BB-name" value="25">
> <input type="TEXT" name="C-name" value="30">
> <input type="TEXT" name="D-name" value="40">
> 
> Thanks for your help !
> 
> I think that : 
> d*\)
> must say something like "any digit and a right parenthesis". Et I should 
> modify (at least) this part of code. But folks I need your help !

The line

$user_email =~ s/^\d*\)\s*//;

means see if the scalar string variable $user_email begins (^) with
zero or more digits (\d*) followed by a literal close-parenthesis (\))
and zero or more whitespace characters (\s*). If it does, replace
everything that matched with nothing, i.e., delete the matching
characters.

If you would like to use letters followed by a dash instead as shown in
your examples above, you could change this line to something like
(untested):

$user_email =~ s/^[A-Z]*-//;

> 
> Thanks
> Paul.

Further advice:

1. If you are asking for help with a Perl script, it is best to post a
the shortest, complete program that demonstrates the problem. As Sinan
pointed out, you haven't shown us how %input is set, so we don't know
what is in it or how it should be parsed. You show extra characters in
the key strings, but you are deleting them from the hash values in the
%input hash. It also helps to tell us what platform you are on and what
version of perl you are using (type "perl -v" to find out).

2. Investigate the CGI module for acquiring HTML form data. Try typing
"perldoc CGI" at a command-line prompt.

3. Indenting conditional statements and loops makes your program more
readable. You can do this even if the original author didn't bother (he
or she probably thought they didn't need any help :).

4. Your script uses some features of older versions of perl. It should 
be updated to the latest version. Most Perl installations have some
very good on-line documentation, accessible through the perldoc
program. Try "perldoc perl" to get started. There are tutorials
included in the available pages.


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

Date: Tue, 16 Dec 2003 20:16:24 +0100
From: "ANDERS FLODERUS" <anders.floderus@swipnet.se>
Subject: Communicating with Windows
Message-Id: <iUIDb.10530$uv1.7509@nntpserver.swip.net>

I have a command line driven application. Now I want to
let Perl make the commands. The problem is, how do I
write from Perl to Windows? On the Windows side, I
think the best thing is to use a shared memory file, how
do I handle this on the Perl side? Is there some better
method?


Thanks for any answer
Anders




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

Date: Tue, 16 Dec 2003 21:51:12 +0100
From: ngoc <linh@chello.no>
Subject: error in Compress-Zlib-1.32
Message-Id: <zoKDb.6111$n31.104191@news2.e.nsc.no>

Hi
I got error below when running 'make' command in installing 
Compress-Zlib-1.32. I do not know how to solve it.
Ngoc
Thank for help.

make[1]: Entering directory `/home/ngoc/compile/Compress-Zlib-1.32/zlib-src'
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  adler32.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  compress.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  crc32.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  gzio.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  uncompr.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  deflate.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  trees.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  zutil.c
/program/gcc/bin/SUNSV/gcc -static-libgcc -c  -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"0.1" 
-DXS_VERSION=\"0.10\" -fPIC -I/program/perl/lib/5.6.1/sun4-solaris/CORE 
  inflate.c
/usr/ccs/bin/as: "/var/tmp/ccviQ61O.s", line 597: error: unknown opcode 
".subsection"
/usr/ccs/bin/as: "/var/tmp/ccviQ61O.s", line 597: error: statement syntax
/usr/ccs/bin/as: "/var/tmp/ccviQ61O.s", line 614: error: unknown opcode 
".previous"
/usr/ccs/bin/as: "/var/tmp/ccviQ61O.s", line 614: error: statement syntax
make[1]: *** [inflate.o] Error 1
make[1]: Leaving directory `/home/ngoc/compile/Compress-Zlib-1.32/zlib-src'
make: *** [zlib-src/libz.a] Error 2



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

Date: Tue, 16 Dec 2003 16:54:39 -0600
From: Tony Curtis <tony_curtis32@_SPAMTRAP_yahoo.com>
Subject: Re: error in Compress-Zlib-1.32
Message-Id: <871xr4tlu8.fsf@limey.hpcc.uh.edu>

>> On Tue, 16 Dec 2003 21:51:12 +0100,
>> ngoc <linh@chello.no> said:

> Hi I got error below when running 'make' command in
> installing Compress-Zlib-1.32. I do not know how to solve
> it.  Ngoc Thank for help.

> -I/program/perl/lib/5.6.1/sun4-solaris/CORE inflate.c
> /usr/ccs/bin/as: "/var/tmp/ccviQ61O.s", line 597: error:
> unknown opcode ".subsection" /usr/ccs/bin/as:

A Google search on

    unknown opcode ".subsection"

will provide the answer.


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

Date: 16 Dec 2003 12:12:29 -0800
From: bay_dar@yahoo.com (G)
Subject: Re: FILE parsing problems
Message-Id: <cad04083.0312161212.36da24a3@posting.google.com>

On 16 Dec 2003 17:26:16 +0000, Brian McCauley <nobull@mail.com> wrote:

>bay_dar@yahoo.com (G) writes:
>
>> Hi, I'm a newbie to Perl and find regular expressions a mystery.
>> Anyway, I need to parse a file and display information in an HTML
>> file. My problem is that I don't know how to parse this stuff.
>
>> Below is the sample file showing 2 entries. After that I list my
>> problem code snip.
>
>> "Title1"	"Title2
>> 
>> "	"Page:1"	"Date: 12/15/2003               "	"Time: 11:28:05AM 
>> "	"Sale
>> Number
>> "	"
>> Sale Type
>> "	"
>> Date Assigned
>> "	"
>> Company  Name
>> "	"S034521"	"Software Agreement"	11/08/2003	"Joes Garage"	"2 Years
>> support"
>> "Title1"	"Title2
>> 
>> "	"Page:1"	"Date: 12/15/2003               "	"Time: 11:28:05AM 
>> "	"Sale
>> Number
>> "	"
>> Sale Type
>> "	"
>> Date Assigned
>> "	"
>> Company  Name
>> "	"S034522"	"Hardware"	12/11/2003	"JK & J INC."	"Backup Tape"
>> 
>> 
>>    while (<FILE>) {
>> 
>> #HERE IS WHERE I AM HAVING MY PROBLEM - I can't get a match
>> 	if ( ($snum, $type, $date, $comp_name) =
>> /\"+\"\t+\"+\"\t+\"+\"\t+\"+\"\t+\"+\"\t+\"(.+)\"\t+\"(.+)\"(.+?)\"(.+)\"\s*$/ix
>
>Is suspect this is FAQ: "How can I split a [character] delimited
>string except when inside [character]?"
>
>-- 
>     \\   ( )
>  .  _\\__[oo
> .__/  \\ /\@
> .  l___\\
>  # ll  l\\
> ###LL  LL\\

I'm not so sure about that (of course I'm a newbie and couldn't
understand the answer anyway:

undef @field;
push(@fields, defined($1) ? $1:$3) 
while m/"([^"\\]*(\\.[^"\\]*)*)"|([^,]+)/g;),

There are no quotes within quotes in my example. These are simply a
number of strings within quotes. Maybe the sample file I'm showing is
to complicated. Say I have a file which contains the entries:
" hello1"  "hello2 "  "bye3 "  " bye4 " 

and I want to read the contents of the 2nd and 4rth string, how can I
do it?

Thanks,

G


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

Date: 16 Dec 2003 21:08:34 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: FILE parsing problems
Message-Id: <Xns9453A435BABD7asu1cornelledu@132.236.56.8>

bay_dar@yahoo.com (G) wrote in
news:cad04083.0312161212.36da24a3@posting.google.com: 

> Say I have a file which contains the entries:
> " hello1"  "hello2 "  "bye3 "  " bye4 " 
> 
> and I want to read the contents of the 2nd and 4rth string, how can I
> do it?

use strict;
use warnings;

my $input = '" hello1"  "hello2 "  "bye3 "  " bye4 "';
my @fields = $input =~ /"\s*(\w+)\s*"/g;
print $fields[1], "\n", $fields[3];

__END__

C:\Home> perl t.pl
hello2
bye4

How about perldoc perlre?

-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Tue, 16 Dec 2003 15:06:28 -0800
From: Mahesha <mahesha@mahesha.net>
Subject: Re: FILE parsing problems
Message-Id: <vtv3vkpdh5lvc5@corp.supernews.com>

G wrote:

> Hi, I'm a newbie to Perl and find regular expressions a mystery.
> Anyway, I need to parse a file and display information in an HTML
> file. My problem is that I don't know how to parse this stuff.  Below
> is the sample file showing 2 entries. After that I list my problem
> code snip.
<snip>
>    while (<FILE>) {

I am not sure if lile-by-line processing is the right way in your case, 
because some fields span across multiple lines. Unless you have undef'd 
$/ earlier. But then there is no 's' modifier in your RE. Or may be the 
news client wrapped the lines.

> 
> #HERE IS WHERE I AM HAVING MY PROBLEM - I can't get a match
> 	if ( ($snum, $type, $date, $comp_name) =
> /\"+\"\t+\"+\"\t+\"+\"\t+\"+\"\t+\"+\"\t+\"(.+)\"\t+\"(.+)\"(.+?)\"(.+)\"\s*$/ix
> ) {
> 

Please consider the RE in while-condition of the following script. Rest 
of the script is just the HTML output processing.

If this is a CGI script I'd prefer using CGI module.

HTH,
Mahesh.
---------------------------
#!/usr/local/bin/perl -w
use strict;

undef $/;

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

my $string = <DATA>;
my @fields;
while ($string =~ /\"\s*([^"]*?)\s*\" # " anything-non-quote "
                    |                  # Or
                    ([\d\/]+)          # that date outside of quotes
                    /xs) {
   $string = $';
   push (@fields, (defined $1) ? $1 : $2); # correct me if I am wrong,
                                           # one of $1/$2 will be
                                           # defined if this line is
                                           # reached, no?
}

print qq {<html>
<head><title>Sample table</title>
<style>
body {font-family: verdana;}
table {font-size:10px;border:solid 1px #eeeeee;}
th {background-color:#eeeeee;text-align:left;}
</style>
</head>
<body>};
# Offsets and Indices are a total guesswork
for my $sale (0..1) {
   $fields[$sale*14+3] =~ s/.*?://;
   $fields[$sale*14+4] =~ s/.*?://;
   print qq {<p><table width="350" cellspacing=0 cellpadding=2>
<tr>
<th width="50%">
  $fields[$sale*14+5]
</th>
<th width="50%">
  $fields[$sale*14+9]
</th>
</tr>
<tr>
<td width="50%">
  When
</td>
<td width="50%">
  $fields[$sale*14+3],
  $fields[$sale*14+4]
</td>
</tr>
<tr>
<td width="50%">
  $fields[$sale*14+6]
</td>
<td width="50%">
  $fields[$sale*14+10]
</td>
</tr>
<tr>
<td width="50%">
  $fields[$sale*14+7]
</td>
<td width="50%">
  $fields[$sale*14+11]
</td>
</tr>
<tr>
<td width="50%">
  $fields[$sale*14+8]
</td>
<td width="50%">
  $fields[$sale*14+12]
</td>
</tr>
<tr>
<td width="50%">
  Notes
</td>
<td width="50%">
  $fields[$sale*14+13]
</td>
</tr>
</table>
};
}
print qq {</body></html>};

__DATA__
"Title1"	"Title2

"	"Page:1"	"Date: 12/15/2003               "	"Time: 11:28:05AM
"	"Sale
Number
"	"
Sale Type
"	"
Date Assigned
"	"
Company  Name
"	"S034521"	"Software Agreement"	11/08/2003	"Joe's Garage"	"2 Years
support"
"Title1"	"Title2

"	"Page:1"	"Date: 12/15/2003               "	"Time: 11:28:05AM
"	"Sale
Number
"	"
Sale Type
"	"
Date Assigned
"	"
Company  Name
"	"S034522"	"Hardware"	12/11/2003	"JK & J INC."	"Backup Tape"


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

Date: Tue, 16 Dec 2003 22:07:52 GMT
From: "Lucas Van Hieng" <l.v.g@moskuetiez.de>
Subject: Re: Login to site with random image code?
Message-Id: <YmLDb.72125$IZ4.69452@newssvr25.news.prodigy.com>

"Juha Laiho" <Juha.Laiho@iki.fi> wrote in message
news:brniem$nm7$2@ichaos.ichaos-int...
> "Lucas Van Hieng" <l.v.g@moskuetiez.de> said:
> >What I am trying to do is write a Perl script that process a certain
> >webpage that requires me to be logged in:
> >
> >(http://www.starlance.us/MW4/)
> >
> >They recently redid the site, so now it requires that you enter the
> >random 5 digit number shown on a png image. (Before there was no such
> >extra security and I was able to POST with LWP:UserAgent.)
> >
> >Is there way at all around these things?
>
> Have you considered the social approach -- that is, describe your use
> and need to the site admins, and ask whether they can provide another
> method for authentication?

Yes I have, and they were nice about it but said that their policy would
not permit it. My goal as I was doing previously was merely make a login
request and obtain the roster for the unit I'm involved with (though not
actually a part of this unit, I am their faitful webmaster/tech :) so
that it cna be displayed on their webpage as if it's on their server (it
was something they really liked, even more so sicne it made out site
sompletely unique next to the tripod/geocities pages most over units
use.)




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

Date: Tue, 16 Dec 2003 23:00:00 GMT
From: Darin McBride <dmcbride@naboo.to.org.no.spam.for.me>
Subject: Re: Login to site with random image code?
Message-Id: <Q7MDb.725661$6C4.652084@pd7tw1no>

Lucas Van Hieng wrote:

> "Juha Laiho" <Juha.Laiho@iki.fi> wrote in message
> news:brniem$nm7$2@ichaos.ichaos-int...
>> "Lucas Van Hieng" <l.v.g@moskuetiez.de> said:
>> >What I am trying to do is write a Perl script that process a certain
>> >webpage that requires me to be logged in:
>> >
>> >(http://www.starlance.us/MW4/)
>> >
>> >They recently redid the site, so now it requires that you enter the
>> >random 5 digit number shown on a png image. (Before there was no such
>> >extra security and I was able to POST with LWP:UserAgent.)
>> >
>> >Is there way at all around these things?
>>
>> Have you considered the social approach -- that is, describe your use
>> and need to the site admins, and ask whether they can provide another
>> method for authentication?
> 
> Yes I have, and they were nice about it but said that their policy would
> not permit it. My goal as I was doing previously was merely make a login
> request and obtain the roster for the unit I'm involved with (though not
> actually a part of this unit, I am their faitful webmaster/tech :) so
> that it cna be displayed on their webpage as if it's on their server (it
> was something they really liked, even more so sicne it made out site
> sompletely unique next to the tripod/geocities pages most over units
> use.)

I suppose the point is that if they're attempting to block scripts for
a reason, then anything your script can do, the scripts they're
attempting to block can do as well.  Thus, if you find a way to OCR the
image, they'll simply change to an image type that you can't OCR.

That's not to say it's no fun trying... :->


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

Date: Tue, 16 Dec 2003 16:50:22 -0800
From: "Trent Curry" <tcurrey@no.no.i.said.no>
Subject: Re: Login to site with random image code?
Message-Id: <bro9dn$9aj$1@news.astound.net>

Darin McBride wrote:
> Lucas Van Hieng wrote:
>
>> "Juha Laiho" <Juha.Laiho@iki.fi> wrote in message
>> news:brniem$nm7$2@ichaos.ichaos-int...
>>> "Lucas Van Hieng" <l.v.g@moskuetiez.de> said:
>>>> What I am trying to do is write a Perl script that process a
>>>> certain webpage that requires me to be logged in:
>>>>
>>>> (http://www.starlance.us/MW4/)
>>>>
>>>> They recently redid the site, so now it requires that you enter the
>>>> random 5 digit number shown on a png image. (Before there was no
>>>> such extra security and I was able to POST with LWP:UserAgent.)
>>>>
>>>> Is there way at all around these things?
>>>
>>> Have you considered the social approach -- that is, describe your
>>> use and need to the site admins, and ask whether they can provide
>>> another method for authentication?
>>
>> Yes I have, and they were nice about it but said that their policy
>> would not permit it. My goal as I was doing previously was merely
>> make a login request and obtain the roster for the unit I'm involved
>> with (though not actually a part of this unit, I am their faitful
>> webmaster/tech :) so that it cna be displayed on their webpage as if
>> it's on their server (it was something they really liked, even more
>> so sicne it made out site sompletely unique next to the
>> tripod/geocities pages most over units use.)
>
> I suppose the point is that if they're attempting to block scripts for
> a reason, then anything your script can do, the scripts they're
> attempting to block can do as well.  Thus, if you find a way to OCR
> the image, they'll simply change to an image type that you can't OCR.

Well keep in mind that the image format needs to be displayable by any
(visual) web browser, so that really limits the types (png, jpg, and gif
mainly.) My point is thers only so manay ways they go in that respect.

> That's not to say it's no fun trying... :->

True :)

-- 
Trent Curry

perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1
)!eg;print(reverse("$s")."\n");'




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

Date: Tue, 16 Dec 2003 11:22:07 +0100
From: Thomas Kratz <ThomasKrarz@REMOVEwebCAPS.de>
Subject: Re: Perl equivalent of "On error resume"
Message-Id: <3fdedd86.0@juno.wiesbaden.netsurf.de>

Rajesh wrote:

> 
> Ok...now, I am a newbie to perl. Actually i was working on a script to
> export the details of a registry to a file. It was working well but it
> stops sometimes with the error,
> Can't call method "GetValues" on an undefined value at CompReg.pm line
> 239.

Perhaps you could check with

   $val = $thingy->GetValues if defined($thingy); # not real code

before you try to call a method on it?

> 
> I figured out the reason for the error which is that i dont have
> enough permissions to read a particular registry key. So, the program
> stops when it reaches the key. I want it to continue and ignore if it
> encounters any key which i dont have any permissions. How to implement
> that?
> 
> In Visual Basic, there is "On error resume" which will continue the
> program if it encounters any error. I wanted to know if there is any
> equivalent

perldoc -f eval

Thomas

-- 
open STDIN,"<&DATA";$=+=14;$%=50;while($_=(seek( #J~.> a>n~>>e~.......>r.
STDIN,$:*$=+$,+$%,0),getc)){/\./&&last;/\w| /&&( #.u.t.^..oP..r.>h>a~.e..
print,$_=$~);/~/&&++$:;/\^/&&--$:;/>/&&++$,;/</  #.>s^~h<t< ..~. ...c.^..
&&--$,;$:%=4;$,%=23;$~=$_;++$i==1?++$,:_;}__END__#....>>e>r^..>l^...>k^..


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

Date: Tue, 16 Dec 2003 23:34:56 GMT
From: carney@NOscubadooSPAM.com
Subject: perl info file for emacs
Message-Id: <jbqhe00tjz3.fsf@scubadoo.com>

I like using info files within emacs.  I have some vintage info files
from perl-5.04 but can't find any for 5.6 or 5.8.   Are newer info
files available anywhere?

I found pod2texi, but it produces many warnings then fails.  This
pod2texi code is old, and probably suffers massive bit-rot.  Are there
other ways to convert pods to info files?

Thanks,

Steve


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

Date: Tue, 16 Dec 2003 11:50:40 -0800
From: "Brian Helterline" <brian_helterline@hp.com>
Subject: Re: Problem with  Win32::Console and END block.
Message-Id: <3fdf6257$1@usenet01.boi.hp.com>


"Richard S Beckett" <spikeywan@bigfoot.com.delete.this.bit> wrote in message
news:brnhku$k0i$1@newshost.mot.com...
> I want to set my dos window up with 80 cols and 100 lines, but when I do I
> break my END block. Here's an example...
>
> use strict;
> use warnings;
> $| =1;
>
> # use Win32::Console;
> # my $BUFFER = new Win32::Console(STD_OUTPUT_HANDLE);
> # $BUFFER->Size(80,100);
>
> for (1..5) {print "."; sleep 1}
> exit;
> END {print "\n\nPress Enter\n"; <STDIN>;}
>
> In the above form it works. BUT remove the comments from the first 2 or 3
> (commented) lines, and the PRINT statement in the END block stops working.
> The <STDIN> still works, though.
>
> What am I doing wrong _this_ time? ;-)
>

Richard,
Win32::Console takes an "all or nothing" approach so when a console window
is closed or destroyed, STDIN/STDOUT get closed.
If your program wants to continue "outside" of the console, then you need
to dup it before calling new.  The code below works (AS 5.6.1)

use strict;
use warnings;

use Win32::Console;

BEGIN {
$| =1;
open(CPY, ">&STDOUT") or die "can't dup STDOUT $!";
select CPY;
$| = 1;
}
print "\nOutput to STDOUT before Console.\n";

my $BUFFER = new Win32::Console(STD_OUTPUT_HANDLE);
$BUFFER->Size(80,100);

for (1..5) {print "."; sleep 1}
open(STDOUT, ">&CPY") or die "can't reopen STDOUT $!";
select STDOUT;
$|=1;
print "\nOutput to STDOUT after Console.\n";
exit;
END {print CPY "\n\nPress Enter\n"; <STDIN>;}




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

Date: Tue, 16 Dec 2003 21:21:46 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: recursive closures?
Message-Id: <x7k74wmpat.fsf@mail.sysarch.com>

>>>>> "BM" == Brian McCauley <nobull@mail.com> writes:

  > Uri Guttman <uri@stemsystems.com> writes:
  >> >>>>> "BM" == Brian McCauley <nobull@mail.com> writes:
  >> 
  >> > Uri Guttman <uri@stemsystems.com> writes:
  >> >> my $sub ;
  >> >> $sub = sub{ blah; $sub->() }
  >> 
  >> > That leaks.
  >> 
  >> it isn't real code anyhow. i don't recall if damian's leaked or he
  >> weakened it. 
  >> 
  >> >         use Scalar::Util qw( weaken );
  >> >  	my $weak_sub; 
  >> >  	my $sub = sub{ blah; $weak_sub->() }
  >> >         weaken($weak_sub = $sub);
  >> 
  >> it would only leak if you let it fall out of scope without destroying it
  >> (but how?).

  > "You only need weak references if you don't want use some other way to
  > take care of tracking and breaking the circular dependancy on every
  > possible exit path" is true of anything that uses weak references.

 > but someone pointed out that it would leak without weakening one of
> its refs (it is circular of course).

well, damian posted this back to me. he refutes the need for the weak
ref or an explicit breaking of the circular refs. i haven't tried this
but i trust him to have.

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

They're not correct. At least, not under 5.8.0 or later (and probably
earlier too). And you can verify that by blessing the closure and
seeing it die:

     my $fib;
     $fib = bless sub {
                  my ($n) = @_;
                  return 1 if $n < 2;
                  return $fib->($n-1) + $fib->($n-2);
                }, 'Bang';

     # Test...

     print $fib->(7), "\n";

     $fib = 7;   # Should "Bang!" here

     print $fib, "\n";

     package Bang;

     sub DESTROY { print "Bang!\n" }

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

$fib inside the code is the same $fib outside of it, so the code ref
only has one ref which is in $fib.  when $fib goes out of scope, the
whole pad is freed and the ref count goes to 0 like it should and it
gets destroyed.

the key to this idea in general is that you have to declare the var
(with my or our) before you refer to it inside the closure code. that
was what i was telling the OP and damian just showed a running example
with normal destruction and non-leaking semantics.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Tue, 16 Dec 2003 19:34:14 +0000 (UTC)
From: Mike Hunter <mhunter@uclink.berkeley.edu>
Subject: Re: ticks and FreeBSD
Message-Id: <slrnbtune4.qm.mhunter@celeste.net.berkeley.edu>

On Mon, 15 Dec 2003 17:38:49 GMT, Erik Tank wrote:

>  I just migrated a program from RedHat 9 to FreeBSD 5.1.  Everything is
>  working well with the exception of the following:
>    my @jmail_return_lines = `ps -aux | grep 'jmaild' | grep -v grep`;

Freebsd likes ps -ef better.

Mike


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

Date: Tue, 16 Dec 2003 21:15:11 +0000
From: Gary Mayor <gary@abertron.co.uk>
Subject: Upload directory from browser
Message-Id: <brnsg0$u49$3@newsg3.svr.pol.co.uk>

Hi,
I was hopeing someone could tell me if there is a way to upload a 
directory to a perl script from the browser. I can do it fine with a 
file at a time but what about a directory.

Is this possible

Thanks

Gary



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

Date: Tue, 16 Dec 2003 19:44:50 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Upload directory from browser
Message-Id: <UFNDb.6355$CK3.497767@news20.bellglobal.com>


"Gary Mayor" <gary@abertron.co.uk> wrote in message
news:brnsg0$u49$3@newsg3.svr.pol.co.uk...
> Hi,
> I was hopeing someone could tell me if there is a way to upload a
> directory to a perl script from the browser. I can do it fine with a
> file at a time but what about a directory.
>
> Is this possible
>

No. Not unless you can run a script on the client side first to zip up the
directory. It's one file at a time or you go the ftp route...

Matt




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

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 5946
***************************************


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