[18308] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 476 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 13 03:10:50 2001

Date: Tue, 13 Mar 2001 00:10:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984471019-v10-i476@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 13 Mar 2001     Volume: 10 Number: 476

Today's topics:
        perlmagick md5 signature changes <aloisious@danarily.com>
    Re: preserve unix path when obtaining parameters from u <kstep@pepsdesign.com>
        RE Doubt <Chandramohan_member@newsranger.com>
    Re: RE Doubt (Bernard El-Hagin)
    Re: RE Doubt <galen.menzel@mail.utexas.edu>
    Re: RE Doubt <joe+usenet@sunstarsys.com>
    Re: reg exp question (Gwyn Judd)
    Re: reg exp question <wuerz@yahoo.com>
    Re: reg exp question <galen.menzel@mail.utexas.edu>
    Re: RFC: FAQ3 update -- Using less memory (Eric Bohlman)
    Re: Set Passwords on AIX <galen.menzel@mail.utexas.edu>
    Re: SSI Help... <godzilla@stomp.stomp.tokyo>
    Re: SSI Help... <rworth5@home.com>
        stat/-X for symlinks ??? <mds@helices.org>
    Re: stat/-X for symlinks ??? (David Efflandt)
    Re: Why glob doesn't take a list? (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Mar 2001 22:29:55 -0500
From: aloisious <aloisious@danarily.com>
Subject: perlmagick md5 signature changes
Message-Id: <3AAD9433.F56C48AD@danarily.com>

I'm using the perl Image::Magick module in a script on win32:

-- snip --
   $img=Image::Magick->new;
   $img->ReadImage('c:\pics\23m.png');
   $sig = $img->Get(signature);
   print "$sig\n";
   undef $img;
-- snip --

The snippet above is in a subroutine.  The first time it's called the
md5 signature I believe is correct but subsequent calls to the
subroutine
result in different signatures.  If I try the snippet as a script by
itself, I get consistent results. Can anyone shed some light on what's
going on?

Thank you.


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

Date: Mon, 12 Mar 2001 23:16:37 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: preserve unix path when obtaining parameters from upload field
Message-Id: <98k6v7$1n7$1@slb7.atl.mindspring.net>

"Hugo Bouckaert" <hugo@fractalgraphics.com.au> wrote in message
news:3AAD7D2C.1AD41710@fractalgraphics.com.au...
> Hi
>
> Thanks very much to all who responded to my previous question regarding
> translating a windows path with backslashes to forward slashes. That was
> a fantastic reponse and really helped me out.
>
> I have another minor question that nevertheless also seems rather
> intractable. When I upload a file under unix, I obtain a path with
> forward slashes of course. But when I try to obtain the parameter of
> that field, I do not get the full path, but only the filename at the
> end. For example, if, in my perl script, I create an upload field like
> this:
>
> print "<tr><td><INPUT TYPE=\"FILE\" NAME=\"document\"
> SIZE=\"60\"><br><br>";
>
> and I try to get the parameter:
>
> $filepath = $query->param('document');

From the code above, I assume that you are using CGI.pm to retrieve the form
data.  If not, then you probably should be.  Read the section 'CREATING A
FILE UPLOAD FIELD' in the CGI.pm pod.

"Different browsers will return slightly different things for the name. Some
browsers return the filename only. Others return the full path to the file,
using the path conventions of the user's machine. Regardless, the name
returned is always the name of the file on the user's machine, and is
unrelated to the name of the temporary file that CGI.pm creates during
upload spooling (see below)."

In other words, you can't rely on the name parameter to provide the full
path where you will eventually store the file on the server - That is up to
your script to decide.  The CGI.pm documentation includes a long list of
gotchas and enough sample code to get you well on your way to a robust
solution.

HTH,

Kurt Stephens





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

Date: Tue, 13 Mar 2001 06:33:51 GMT
From: Chandramohan Neelakantan <Chandramohan_member@newsranger.com>
Subject: RE Doubt
Message-Id: <jbjr6.2776$54.2754@www.newsranger.com>

Hi.


What is the diffrence between using '+' inside  square brackets and using it
outside the same?

Method1
=======
$str = "Is this trivial!!!??";
$str =~ /(\w+)[!\?\. ]+$/;print $1;


Method2
=======

$str = "Is this trivial!!!??";
$str =~ /(\w+)[!+\?+\.+ +]$/;print $1;


I was trying to get the last word of the string , no matter how the string is
terminated and managed to arrive at the operation in Method1.But I do not know
why Method2 works!.

Thanx in advance!!

regards
CM





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

Date: Tue, 13 Mar 2001 07:38:55 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: RE Doubt
Message-Id: <slrn9arjgj.j9b.bernard.el-hagin@gdndev32.lido-tech>

On Tue, 13 Mar 2001 06:33:51 GMT, Chandramohan Neelakantan
<Chandramohan_member@newsranger.com> wrote:
>Hi.
>
>
>What is the diffrence between using '+' inside  square brackets and using it
>outside the same?

A '+' inside square brackets is just a '+'. It has no special meaning.

perldoc perlre

Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'


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

Date: Tue, 13 Mar 2001 01:46:09 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: RE Doubt
Message-Id: <3AADD041.AFD5B0E7@mail.utexas.edu>

Chandramohan Neelakantan wrote:
> 
> Hi.
> 
> What is the diffrence between using '+' inside  square brackets and using it
> outside the same?
> 
> Method1
> =======
> $str = "Is this trivial!!!??";
> $str =~ /(\w+)[!\?\. ]+$/;print $1;
> 
> Method2
> =======
> 
> $str = "Is this trivial!!!??";
> $str =~ /(\w+)[!+\?+\.+ +]$/;print $1;
> 
> I was trying to get the last word of the string , no matter how the string is
> terminated and managed to arrive at the operation in Method1.But I do not know
> why Method2 works!.

Method2 doesn't work.  If you used these serially, ie Method1 then Method2 in
the same perl script, then the $1 that you print in Method2 still refers to the
match made in Method1, since the match fails in Method2.  That's why you get
"trivial" printed twice.  + is just another character inside of a character
class.

galen


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

Date: 13 Mar 2001 02:47:33 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: RE Doubt
Message-Id: <m3y9ua9kkq.fsf@mumonkan.sunstarsys.com>

Chandramohan Neelakantan <Chandramohan_member@newsranger.com> writes:

> What is the diffrence between using '+' inside  square brackets and 
> using it outside the same?

+ is just another character within square brackets.
 
> Method1
> =======
> $str = "Is this trivial!!!??";
> $str =~ /(\w+)[!\?\. ]+$/;print $1;
> 
> 
> Method2
> =======
> 
> $str = "Is this trivial!!!??";
> $str =~ /(\w+)[!+\?+\.+ +]$/;print $1;
                  ^^ ^^ ^
                unnecessary
> 
> 
> I was trying to get the last word of the string , no matter how the 
> string is terminated and managed to arrive at the operation in
> Method1. But I do not know why Method2 works!.

It doesn't work. Try placing them in separate programs, reordering 
them, or better yet, test the match:

  $str = "Is this trivial!!!??";
  if ( $str =~ /(\w+)[!+\?+\.+ +]$/ ) { print $1 };

HTH
-- 
Joe Schaefer     "A little inaccuracy sometimes saves a ton of explanation."
                                               -- H. H. Munro (Saki)


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

Date: Tue, 13 Mar 2001 02:29:11 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: reg exp question
Message-Id: <slrn9ar1fl.o00.tjla@thislove.dyndns.org>

I was shocked! How could Mona Wuerz <wuerz@yahoo.com>
say such a terrible thing:

>(I do recall dimly that there was a reason not to use $a and $b, but
>specifics escape me at the moment. Don't know if that has to do with
>your dilemma.)

It's considered bad because they are special variables relating to the
sort function. That means, theoretically if you were using $a or $b
somewhere and intermingling that use with sort, then bad things could
result. I've never seen it actually happen though. Additionally they
don't need to be declared with use vars or my() or our() so you lose
some strict'ness.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
You may be recognized soon.  Hide.


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

Date: Tue, 13 Mar 2001 03:35:59 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: reg exp question
Message-Id: <130320010335592071%wuerz@yahoo.com>

In article <slrn9ar1fl.o00.tjla@thislove.dyndns.org>,
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:

> [about $a and $b]

Thanks for the refresher. So I guess that couldn't have to do with the
OP's problem, then.

-mona


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

Date: Mon, 12 Mar 2001 20:59:41 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: reg exp question
Message-Id: <3AAD8D1D.F6945E00@mail.utexas.edu>

zawy wrote:
> The following returns FALSE
> $a=~/$b/

I don't know what you mean.  The following prints "Yeah!\n":

perl -e '$a=12; $b=12; print "Yeah!\n" if $a=~/$b/;'

galen


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

Date: 13 Mar 2001 04:54:05 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: RFC: FAQ3 update -- Using less memory
Message-Id: <98k95d$stf$1@bob.news.rcn.net>

In comp.lang.perl.misc Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> The third approach is indefensible because it reads the file into an
> anonymous array and then goes over it sequentially.  There's no way
> the array can be put to any use, it's just wasted space.

And furthermore, it does it in an IMHO stealthy way; it's easier to 
mentally skip over the code without it setting off a "this is reading the 
whole file into memory" alarm than it is when the reading and looping are 
distinct.



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

Date: Mon, 12 Mar 2001 20:55:24 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: Set Passwords on AIX
Message-Id: <3AAD8C1C.8347F88E@mail.utexas.edu>

My suggestion is that you fork off an open2 to the system's passwd command to
change the passwords, as this is the most portable method (a particular problem
if you're using AIX -- yikes!)  I think passwd needs a controlling tty though,
so check out the IO::Pty module.  Also look at the Expect module, which
basically implements expect using perl as a base language instead of tcl.  I
believe that this module takes care of all of the pty stuff for you. 
Alternately, you could just use an expect script.

Good luck.
galen

Dirk Wessner wrote:
> 
> Hello there.
> 
> I know there is a module Unix::ConfigFile,
> which provides Access to /etc/passwd,
> /etc/group etc.
> I modified it to work with /etc/shadow.
> 
> Does anyone know a module or  library
> to alter the passwords on Unix-Systems
> that doesn't use the File /etc/shadow,
> i.e. IBM-AIX and HP-UX?
> 
> Any Hints will be usefull!
> 
> Thanks a lot,
> 
> Dirk Wessner


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

Date: Mon, 12 Mar 2001 19:08:59 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: SSI Help...
Message-Id: <3AAD8F4B.F51926A3@stomp.stomp.tokyo>

Brian Racer wrote:
 
> I am having problems implementing my perl script with SSI.

(snipped)

Test your Server Side Include ability before
you do anything else. Use this:


<HTML>

IP ADRRESS: 
<!--#echo var="REMOTE_ADDR"-->
<P>
BROWSER: 
<!--#echo var="HTTP_USER_AGENT"-->

</HTML>


If you do not read your ip address and
browser type when you access this test
html page, you do not have SSI enabled.

If you do read this information, then
your server is not correctly configured
to execute cgi applications, perhaps
just for your test directory.


Godzilla!
-- 
Roberta The Remarkable Robot
  http://la.znet.com/~callgirl/roberta/roberta.cgi


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

Date: Tue, 13 Mar 2001 05:41:06 GMT
From: "Richard" <rworth5@home.com>
Subject: Re: SSI Help...
Message-Id: <Spir6.3774$rB2.347027@news1.rdc1.mb.home.com>

shouldnt this line <!--#exec cgi="/cgi-bin/weekinfo.pl" -->
be
<!--#exec cgi="/cgi-bin/weekinfo.cgi" -->
to execute cgi scripts


"Brian Racer" <brian@brianracer.com> wrote in message
news:3ffr6.222$dC6.10349@typhoon.mw.mediaone.net...
>
> Hello. I am having problems implementing my perl script with SSI. First of
> all I know the script works. I first tried using the Xitami server. My
> scripts would execute untill it tried to access a file, then I started
> having problems. I then decided to try IIS v.4. Now nothing displayes. I
> believe I have everything setup correctly because I have gotten some SSI
> things to work but anytime I try <!--#exec cgi="/cgi-bin/weekinfo.pl" -->
> nothing shows up(well, the page does, just not any info the script should
> generate). I would appreciate ANY suggestions. Once again I am runngin IIS
> v.4 and Windows 2000. The scripts IS in an .shtml format(well the webpage
> where the SSI insruction is). I am running the newest stable version of
> Active Perl, and it is setup correctly in IIS. Thanks again!
>
> Brian Racer
> brian@brianracer.com
>
>
>




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

Date: Tue, 13 Mar 2001 03:29:15 GMT
From: "Michael D. Schleif" <mds@helices.org>
Subject: stat/-X for symlinks ???
Message-Id: <3AAD940A.3638204F@helices.org>


How to get stat/-X type information about symbolic links ???

Yes, these functions return proper information; however, that
information is about the source/original file and *not* about the link
itself . . .

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: Tue, 13 Mar 2001 06:53:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: stat/-X for symlinks ???
Message-Id: <slrn9arguc.cdu.efflandt@efflandt.xnet.com>

On Tue, 13 Mar 2001 03:29:15 GMT, Michael D. Schleif <mds@helices.org> wrote:
>
>How to get stat/-X type information about symbolic links ???
>
>Yes, these functions return proper information; however, that
>information is about the source/original file and *not* about the link
>itself . . .

On any system I have been on, you cannot set or change permissions of a
symlink, so testing permissions of the symlink itself would be meaningless
and pointless.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Tue, 13 Mar 2001 02:24:14 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Why glob doesn't take a list?
Message-Id: <slrn9ar16e.nts.mgjv@verbruggen.comdyn.com.au>

On Tue, 13 Mar 2001 01:45:09 GMT,
	Bart Lateur <bart.lateur@skynet.be> wrote:
> Ilya Zakharevich wrote:
> 
>>> > As an aside: I have always wondered the same thing WRT undef().
>>
>>> Maybe it wasn't considered necessary?  There's
>>> 
>>>     ( $x, $y, @a) = ();
>>> 
>>> to undef multiple things.
>>
>>This is a multi-assignment of undef, not multi-undef'ing.
>>
>>undef $x has an additional side-effect of freeing the buffers,
>>comparing to $x = undef.
> 
> So, why doesn't undef work an a variable list? The only reason I can
> think of, is that undef returns a scalar, and it wouldn't be clear what
> it ought to return in case of a list of parameters. But that can be
> simple enough: it should always return undef.

One thing I can think of is that it maybe would be a bit ambiguous
what 

undef @array;

would mean if undef took a list. is it 'undefine all the elements of
@array', or is it 'undefine @array itself'. There are functions that
take array arguments, like push, pop, shift and unshift, but they all
insist on having an array as their first argument. undef needs to be
able to take almost anything there.

undef @array;
undef %hash;
undef $scalar;
undef *glob;
undef &sub;

Apart from taking into account how prototyping works in Perl right
now, I'd be a bit hard pressed to come up with parsing rules that
would always do the Right Thing(TM). And if you take prototyping into
account, then I wouldn't even know whether it would be possible
without making undef the great exception to the rule (unless it
already is :)).

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

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 V10 Issue 476
**************************************


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