[16053] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3465 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 14:10:37 2000

Date: Fri, 23 Jun 2000 11:10: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: <961783821-v9-i3465@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 23 Jun 2000     Volume: 9 Number: 3465

Today's topics:
    Re: How could I set Session ID for Browser without cook <rootbeer@redcat.com>
    Re: More error checking with Getopt (M.J.T. Guy)
    Re: padding a string with leading zeros (M.J.T. Guy)
    Re: PPM Hotfix Fails (David Wall)
    Re: PPM Hotfix Fails <abe@ztreet.demon.nl>
    Re: QUESTION -> From perl to C(++) ? <billy@arnis-bsl.com>
    Re: Reg Expression Question <jllawhead@sunherald.com>
    Re: return by value <lilleyb001@hawaii.rr.com>
    Re: return by value <lilleyb001@hawaii.rr.com>
    Re: Script to test whether the GIF is animated <randy@theoryx5.uwinnipeg.ca>
        sending emails from perl script stolkd@my-deja.com
    Re: sending emails from perl script <care227@attglobal.net>
    Re: strict and @ISA (M.J.T. Guy)
    Re: string::approx for windows <jllawhead@sunherald.com>
    Re: system date/time <billy@arnis-bsl.com>
    Re: system date/time (Cameron Kennedy)
    Re: use of eval and strict does not correctly set  $@ (M.J.T. Guy)
    Re: use of eval and strict does not correctly set  $@ (M.J.T. Guy)
        Virtual Server Module call idbugm@idbugm.com
    Re: Virtual Server Module call <rootbeer@redcat.com>
    Re: Why I can't use -d:DProf? <rootbeer@redcat.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Jun 2000 09:58:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How could I set Session ID for Browser without cookie?
Message-Id: <Pine.GSO.4.10.10006230957130.4312-100000@user2.teleport.com>

On Fri, 23 Jun 2000, news wrote:

> Could any nice people tell me how could I set Session ID for different
> user like using ASP without cookie?

Sure. The nice people who like to answer questions about how to program
for the web can often be found reading comp.infosystems.www.authoring.cgi.
Cheers!

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



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

Date: 23 Jun 2000 17:13:22 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: More error checking with Getopt
Message-Id: <8j05ri$mdc$1@pegasus.csx.cam.ac.uk>

In article <8ivcc9$mn3$1@nnrp1.deja.com>,  <undergronk@yahoo.com> wrote:
>
>I want to provide sensible defaults if no args are supplied.  My
>attempt is shown below.
>
>#!/usr/bin/perl -w
>use Getopt::Std;
>
>my $host;
>our $opt_f;
>
>getopt('f:');
>
>This works, but I was wondering if there was an easier way to provide a
>default for $opt_f.

Does this do what you want?

  our $opt_f = './hosts.out';
  getopt('f:');


Mike Guy


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

Date: 23 Jun 2000 16:20:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: padding a string with leading zeros
Message-Id: <8j02ou$j8q$1@pegasus.csx.cam.ac.uk>

In article <278f3540.692c6456@usw-ex0101-005.remarq.com>,
ez4gl  <ez4glNOezSPAM@hotmail.com.invalid> wrote:
>In trying to pad IP address octets with leading zeros for a
>report I tried something like:
>
>$octet = ((3 - length($octet)) x '0') . $octet;
>
>But this did not change the value of octet whatsoever....my
>thinking is that this may have something to do with zero being
>evaluated as akin to false?!  So I tried the same but
>substituted chr(48) for '0', with no effect....$octet remained
>unchanged.

You've got the arguments to the 'x' operator reversed.


Mike Guy


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

Date: 23 Jun 2000 11:23:27 -0400
From: darkon@one.net (David Wall)
Subject: Re: PPM Hotfix Fails
Message-Id: <8F5C7EA23darkononenet@206.112.192.118>

gellyfish@gellyfish.com (Jonathan Stowe) wrote in 
<8iv3jj$3fs$1@orpheus.gellyfish.com>:

>On Thu, 22 Jun 2000 15:26:00 GMT bayers@my-deja.com wrote:
>> I've encluded the output of the hotfix below.  The hotfix fails to
>> repair PPM.
>> 
>> Any ideas?  I might have to go back to an older version.
>> 
>> ====================================
>> 
>> C:\Perl\bin>perl -x -S "ppm"  verify --upgrade --location=. PPM
>> Cannot forceunlink C:\Perl\bin\ppm.bat: Permission denied at
>
>So why dont you change attributes of the file and run it again ?

From the README file included in ppmfix.zip: 

<quote>
    o When applying the hotfix, you may receive a message similar to:

          "Cannot forceunlink C:\Perl5.6\bin\ppm.bat:..."

      This error can be safely disregarded.
</quote>

-- 
David Wall
darkon@one.net


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

Date: Fri, 23 Jun 2000 17:33:24 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: PPM Hotfix Fails
Message-Id: <ad07lskpapngi3m8cdoqmlj0a70485738j@4ax.com>

[Please state your response _after_ the quoted/trimmed text you are
responding to]

On Fri, 23 Jun 2000 12:43:39 GMT, bayers@my-deja.com wrote:

> In article <8iv3jj$3fs$1@orpheus.gellyfish.com>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> > On Thu, 22 Jun 2000 15:26:00 GMT bayers@my-deja.com wrote:
[...]
> > > C:\Perl\bin>perl -x -S "ppm"  verify --upgrade --location=. PPM
> > > Cannot forceunlink C:\Perl\bin\ppm.bat: Permission denied at
> >
> > So why dont you change attributes of the file and run it again ?
> >
> Its permissions are set to 'everyone' and it has no attributes set.
> 
> Very strange.

The above statement will let perl run 'ppm.bat', there may be a problem
unlinking _itself_.

It looks as if the rest of the fix succeded, so you could remove ppm.bat
yourself and run:

	C:\Perl\bin\>pl2bat ppm.pl



-- 
Good luck,
Abe


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

Date: Fri, 23 Jun 2000 15:39:15 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: QUESTION -> From perl to C(++) ?
Message-Id: <8j00b0$561$1@nnrp1.deja.com>

In article <39535F47.E030B3C1@horizon.nl>,
  Thomas de Konink <tkonink@horizon.nl> wrote:
> Hello,
>
> If this big problem. I once made a internet-service with several Perl
> (Cgi) scripts.
> Now, this service is very popular in the Netherlands. This causes a
load
> much to high for my Linux-server. This, of course, is a known probling
> when using Perl.
>
> My QUESTION !
> - Is it possible to translate perl to C++ : Is there a tool/module
which
> I can use, to translate Perl-scripts into executable binairies or
> C-source code.


Maybe mod_perl will help ?

Ilja.



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


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

Date: Fri, 23 Jun 2000 16:30:02 GMT
From: Joel <jllawhead@sunherald.com>
Subject: Re: Reg Expression Question
Message-Id: <sl744arae7f100@corp.supernews.com>

Of course there are lots of ways to do that. Here's one way (and I'm not an 
expert so this may not be the best/shortest way):

$MyString='<img src="http://www.myhouse.com.au/house.gif">'; #your variable
$MyString =~ m/<img src="http:\/\/www.myhouse.com.au\/(.*)">/i; #do a match
$image = $1; #assign what we found in () to variable "$image"
## $image variable is now house.gif



tony_123 wrote:
> 
> 
> Hi Folks
> 
> I have the string
> 
> $MyString='<img src="http://www.myhouse.com.au/house.gif">';
> 
> Can someone please tell me how I can extract the house.gif part of this
> string.
> 
> Cheers
> 
> Tony
> 
> 
> 
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Fri, 23 Jun 2000 16:44:01 GMT
From: "Benji Lilley" <lilleyb001@hawaii.rr.com>
Subject: Re: return by value
Message-Id: <ltM45.8167$aB6.36388@typhoon.hawaii.rr.com>

It does work on my machine ...

Abe Timmerman <abe@ztreet.demon.nl> wrote in message
news:08u6ls43k5aq7bmfacnpn2jsffsjfle781@4ax.com...
> On Fri, 23 Jun 2000 06:59:38 GMT, "Benji Lilley"
> <lilleyb001@hawaii.rr.com> wrote:
>
> ...
> >
> > a simple working example:
>
> Nope, _not_ working! Please test your code before posting, especially if
> you say it's _working_.
>
> > #--------
> Just to let perl help you find mistakes start your programs with:
>
> #!/usr/bin/perl -w
> use strict;
>
> > %hash = ('name' => 'foo');
>
> my %hash = ( name => 'foo');
>
> > sub return_by_value{
> >     my %subroutine_hash = shift;
>
> That gives an error:
>
> "Odd number of elements in hash assignment at..."
>
> Passing the hash by value 'flattens' the hash to a list.
>
> my %subroutine_hash = @_;
>
> ...
> > would produce:
> >
> > foo
> > bar
>
> If you'd got it right :-)
>
> --
> Good luck,
> Abe




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

Date: Fri, 23 Jun 2000 16:48:44 GMT
From: "Benji Lilley" <lilleyb001@hawaii.rr.com>
Subject: Re: return by value
Message-Id: <MxM45.8168$aB6.36324@typhoon.hawaii.rr.com>



> >sub return_by_value{
> >    my %subroutine_hash = shift;
> >    $subroutine_hash{name} = 'bar';
>                       ^^^^
>
>
> But that requires that you know all of the hash keys.
>

Silly me ...

> You can replace the two lines above with just:
>
>    my(%subroutine_hash) = @_;
>
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas




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

Date: 23 Jun 2000 15:51:07 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Script to test whether the GIF is animated
Message-Id: <8j011b$5tl$1@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, marekwww@my-deja.com wrote:
>     I looked for such a script and for
> specification of GIFs but my research failed.
> Perhaps you know how to test it?

You might want to check out Image::ParseGIF, Image::DeAnim, 
and Image::Info - these may help, depending on what you need.
The docs are available, eg, at
http://theoryx5.uwinnipeg.ca/CPAN/data/Image-ParseGIF/ParseGIF.html
http://theoryx5.uwinnipeg.ca/CPAN/data/Image-DeAnim/DeAnim.html
http://theoryx5.uwinnipeg.ca/CPAN/data/Image-Info/Image/Info.html

best regards,
randy kobes




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

Date: Fri, 23 Jun 2000 16:59:01 GMT
From: stolkd@my-deja.com
Subject: sending emails from perl script
Message-Id: <8j050m$gip$1@nnrp2.deja.com>

Hi,

I'm trying to send an email from a perl script and
have been using Sendmail for this.  I use a
template file that I have Sendmail read, and one
of the headers is the 'From' header.  However, if
the email bounces, it doesn't bounce to the email
address in the 'From' header, but rather to the
user who is running the perl script at the time.
And I can't use the -f option since this is only
allowed by 'trusted' users like root, network,
etc.  So how do I get the bounced emails to return
to a specified address, rather than to the user
who is running the script.  Will I have to send
the email with something other than sendmail?

Thanks for any help, Daniel Stolk


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


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

Date: Fri, 23 Jun 2000 13:14:00 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: sending emails from perl script
Message-Id: <39539AD8.32BE73E3@attglobal.net>

stolkd@my-deja.com wrote:
> 
> Hi,
> 
> I'm trying to send an email from a perl script and
> have been using Sendmail for this.  I use a
> template file that I have Sendmail read, and one
> of the headers is the 'From' header.  However, if
> the email bounces, it doesn't bounce to the email
> address in the 'From' header, but rather to the
> user who is running the perl script at the time.
> And I can't use the -f option since this is only
> allowed by 'trusted' users like root, network,
> etc.  So how do I get the bounced emails to return
> to a specified address, rather than to the user
> who is running the script.  Will I have to send
> the email with something other than sendmail?
> 

Try this one out in comp.mail.sendmail

I'm certain someone there will be of better assistance.  But do be so
kind as to check and see if anyone else has had this problem and found
a solution before you post.  Searching a news archive like Deja.com
or its relatives will often get you the proper answer in alot less time.


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

Date: 23 Jun 2000 16:30:56 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: strict and @ISA
Message-Id: <8j03c0$jqr$1@pegasus.csx.cam.ac.uk>

Andrew Perrin - Demography  <aperrin@famine.DEMOG.Berkeley.EDU> wrote:
>
>However, the reason I *wrote* the message was basically along the
>lines of Bart Lateur's answer: @ISA behaves much like other built-in
>variables in perl, such as $_, $0, etc., etc., in that its value
>determines built-in behavior of the language.  But setting other
>built-in variables does not cause an error under use strict, even when
>they have not been initialized:
>
>aperrin@famine ~> perl -Mstrict -e'$_ = q[foo]; print qq[$_\n];'
>foo
>
>That seems an inconsistency.

The variables that are special are precisely those which are forced
into package 'main' if unqualified, such as $_, @ARGV, %ENV.    @ISA
isn't special in this sense.


Mike Guy


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

Date: Fri, 23 Jun 2000 16:30:03 GMT
From: Joel <jllawhead@sunherald.com>
Subject: Re: string::approx for windows
Message-Id: <sl744b4je7f146@corp.supernews.com>

you can get it at http://rto.dk/packages. If you're using ActiveState's PPM 
go ahead and switch your repository to the rto site. They have twice as many 
packages as ActiveState does. To do this in PPM just type:
"set repository RTO http://rto.dk/packages"


nnyglb wrote:
> 
> 
> Does anyone know where I can get the compiled version of the
> string::approx module?
> 
> I have already been to activestate and they don't have it listed.  I
> have left a message with them to find out if and when they will have it,
> but I need it sooner than they will get to the email.
> 
> Any help would be appreciated.
> 
> Barry
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Fri, 23 Jun 2000 15:09:34 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: system date/time
Message-Id: <8ivuiv$3ni$1@nnrp1.deja.com>

In article <IAK45.23672$ds.689079@newsread2.prod.itd.earthlink.net>,
  "PaulB" <braisp@earthlink.net> wrote:
> How can I get the system date and time using perl.
> I am using the Win32 version of perl,
> I thought I could use system or exec but on windowsNT it doesn't work.
>


You need time() and localtime() functions.

See your perldoc time and perldoc localtime,
or http://www.cpan.org/doc/manual/html/pod/perlfunc/time.html
and http://www.cpan.org/doc/manual/html/pod/perlfunc/localtime.html.

Also perldoc perlfaq4 covers some date/time related questions
(or http://www.cpan.org/doc/manual/html/pod/perlfaq4.html).

Hope this helps.
Ilja.


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


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

Date: Fri, 23 Jun 2000 09:12:11 -0800
From: kenned57@pilot.msu.edu (Cameron Kennedy)
Subject: Re: system date/time
Message-Id: <kenned57-2306000912110001@alexthinkpad.salk.edu>



> How can I get the system date and time using perl.

Perl% scalar localtime(time)
Fri Jun 23 09:10:54 2000
Perl%


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

Date: 23 Jun 2000 16:56:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: use of eval and strict does not correctly set  $@
Message-Id: <8j04rc$l4g$1@pegasus.csx.cam.ac.uk>

Sean McAfee <mcafee@waits.facilities.med.umich.edu> wrote:
>
>As previously mentioned, this is a bug.  I got around it in the code I'm
>currently developing like this:
     [snip]
>
>Not very pretty, but I couldn't find any better way.

The "better way" is to upgrade to 5.6.0.    :-)


Mike Guy


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

Date: 23 Jun 2000 17:00:48 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: use of eval and strict does not correctly set  $@
Message-Id: <8j0540$lgp$1@pegasus.csx.cam.ac.uk>

In article <3952CD5E.637B08AC@wsb.com>, Jeff Helman  <jhelman@wsb.com> wrote:
>
>If I recall correctly, using the strict pragma forces perl to check for
>violations at compile time (vs. at run-time).  Thus, the eval never runs
>because your script dies during compile.  Thus $@ is never set. 

Wrong.    "use strict" does checks at both compile time and run time.
And it's the compile time of the eval() that matters.    So $@ shoulds
be set.     This is a known bug, mended in perl5.6.0.


Mike Guy


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

Date: Fri, 23 Jun 2000 15:49:54 GMT
From: idbugm@idbugm.com
Subject: Virtual Server Module call
Message-Id: <8j00up$5mu$1@nnrp1.deja.com>

I'm having problems calling a module I installed on a virtual server.

use Net::XYZ

I get errors because it looks at the root's Perl directories rather than
looking at my Virtual Path (i.e.  ~/usr/local/perl)

Any ideas


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


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

Date: Fri, 23 Jun 2000 10:15:12 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Virtual Server Module call
Message-Id: <Pine.GSO.4.10.10006231013450.4312-100000@user2.teleport.com>

On Fri, 23 Jun 2000 idbugm@idbugm.com wrote:

> I'm having problems calling a module I installed on a virtual server.
> 
> use Net::XYZ
> 
> I get errors because it looks at the root's Perl directories rather than
> looking at my Virtual Path (i.e.  ~/usr/local/perl)

A CGI program, right? You should almost certainly use the 'lib' module to
inform perl of the path to your private module directory. Cheers!

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



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

Date: Fri, 23 Jun 2000 10:08:19 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Why I can't use -d:DProf?
Message-Id: <Pine.GSO.4.10.10006231007030.4312-100000@user2.teleport.com>

On Fri, 23 Jun 2000, k wrote:

> So, DProf only can be used through command line???

No, but I don't see any reason why you'd need to use it over the web like
you're trying. Simply profile your script from offline. Cheers!

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



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

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


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