[13726] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1136 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 20:05:31 1999

Date: Wed, 20 Oct 1999 17:05:16 -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: <940464315-v9-i1136@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 20 Oct 1999     Volume: 9 Number: 1136

Today's topics:
    Re: Card shuffling <mmeader@ah.ddi.com>
        Compiling Perl Programs <richd@nospam.net>
        Date Addition bagpus@my-deja.com
    Re: Date Addition <vincent.murphy@cybertrust.gte.com>
    Re: Date Addition <jeffp@crusoe.net>
    Re: Help - Can't figure this out <gellyfish@gellyfish.com>
    Re: Help - Can't figure this out <elaine@chaos.wustl.edu>
    Re: Help - Can't figure this out <partner@casinofantasy.com>
    Re: Help - Can't figure this out <partner@casinofantasy.com>
        How to do dynamic headers with libwww (Don Littlefield II)
    Re: I pass by reference, but my array is unchanged. (Tad McClellan)
    Re: Ignore the idiots (including Tad) (Tad McClellan)
    Re: Ignore the idiots (including Tad) (Tad McClellan)
    Re: in need of example... <ltl@rgsun5.viasystems.com>
    Re: IP address <link@nowhere.org>
    Re: IP address <link@nowhere.org>
    Re: IP address <lr@hpl.hp.com>
    Re: IP address <lr@hpl.hp.com>
    Re: Making a hash of subroutines <aqumsieh@matrox.com>
    Re: Making a hash of subroutines <lr@hpl.hp.com>
    Re: Matching an asterisk (Peter J. Kernan)
    Re: mod_prl binaries <gellyfish@gellyfish.com>
    Re: Perl for Epoc ? <laurensmith@sprynet.com>
    Re: Perl for Epoc ? <jeff@vpservices.com>
        Stripping ^M's from files under NT: Foolish Waste of Ti (Josh Geller)
    Re: Substitution (Randal L. Schwartz)
    Re: Substitution (brian d foy)
    Re: Substitution (Tad McClellan)
    Re: Substitution (Tad McClellan)
    Re: Substitution (Peter J. Kernan)
    Re: Substitution (Craig Berry)
    Re: Substitution <lr@hpl.hp.com>
    Re: this darn error <gellyfish@gellyfish.com>
    Re: upload file help <gellyfish@gellyfish.com>
    Re: url not responding (brian d foy)
        WIN .EXE files from PERL <brad_a_wallace@hotmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Oct 1999 15:50:31 -0700
From: "Morgan Meader" <mmeader@ah.ddi.com>
Subject: Re: Card shuffling
Message-Id: <uj1eq30G$GA.111@cpmsnbbsa03>

How do you play 52 pickup?!?  ;)

Morgan
ps -- apology for off topic post.


Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote in message
news:380DD120.D8D8388B@ife.ee.ethz.ch...
-- cut --
> A standard deck with 36 cards (as used in Switzerland)
> has 36!
-- cut --
> - Alex




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

Date: Thu, 21 Oct 1999 06:19:46 -0400
From: "Rich Dedeyan" <richd@nospam.net>
Subject: Compiling Perl Programs
Message-Id: <7ulenl$69d$1@news2.tor.accglobal.net>

Hello All,

  I downloaded and installed perl on Solaris 2.6/Sparc.  My perl scripts run
fine.  However, I tried to compile a perl program using perlcc and I get the
following error messages:

"/usr/local/lib/perl5/5.00503/sun4-solaris/CORE/iperlsys.h", line 319:
formal
parameter lacks name: param #1
"/usr/local/lib/perl5/5.00503/sun4-solaris/CORE/iperlsys.h", line 319:
formal
parameter lacks name: param #2
"/usr/local/lib/perl5/5.00503/sun4-solaris/CORE/iperlsys.h", line 319:
formal
parameter lacks name: param #3
"/usr/local/lib/perl5/5.00503/sun4-solaris/CORE/iperlsys.h", line 319:
syntax
error before or at: __attribute__
"/usr/local/lib/perl5/5.00503/sun4-solaris/CORE/iperlsys.h", line 319:
warning:
syntax error:  empty declaration
"/usr/include/ctype.h", line 43: cannot recover from previous errors
cc: acomp failed for test3.pl.c


  As well, when I downloaded and tried to compile the DBI & Oracle DB
package from the perl.com web site, I got the same messages as above.  I
can't seem to figure out why.  Anyone can help me out?

Thanks,
Rich Dedeyan
Montreal, Canada

P.S. - If replying via e-mail please e-mail at richd@globalserve.net


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

Date: Wed, 20 Oct 1999 23:06:57 GMT
From: bagpus@my-deja.com
Subject: Date Addition
Message-Id: <7ulhu8$ts1$1@nnrp1.deja.com>

Hello,

I need to be able to add an offset to the current date and store the
result in a string with the format YYYYMMDDHHMMSS. I can get the
current date into the required format but I don't know how to add the
offset which will be in seconds to the date and be sure that the date
is incremented correctly taking care of leap years etc.

I'm sure there is a simple way of doing this! Does anybody know how to
do this? Will you tell me?

Later


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


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

Date: Wed, 20 Oct 1999 23:31:04 GMT
From: Vincent Murphy <vincent.murphy@cybertrust.gte.com>
Subject: Re: Date Addition
Message-Id: <xjg7lkh8v9j.fsf@gamora.ndhm.gtegsc.com>

>>>>> "bagpus" == bagpus  <bagpus@my-deja.com> writes:

    bagpus> Hello,
    bagpus> I need to be able to add an offset to the current date and store the
    bagpus> result in a string with the format YYYYMMDDHHMMSS. I can get the
    bagpus> current date into the required format but I don't know how to add the
    bagpus> offset which will be in seconds to the date and be sure that the date
    bagpus> is incremented correctly taking care of leap years etc.

    bagpus> I'm sure there is a simple way of doing this! Does anybody know how to
    bagpus> do this? Will you tell me?

use Date::Manip;  # need to get it from CPAN

an example:

$date=&DateCalc("today","+ 3hours 12minutes 6 seconds",\$err);



-Vinny


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

Date: Wed, 20 Oct 1999 19:54:54 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Date Addition
Message-Id: <Pine.GSO.4.10.9910201950580.21020-100000@crusoe.crusoe.net>

=cut

=begin FOR HUMANS

This message can be sent through pod2text (or any other converter).  It is
readable in this format, though.  You can check

  perldoc perlpod

for more information on this handy documentation markup.

=end FOR HUMANS

=head1 SYNOPSIS

How can I do date manipulation in Perl?

=head1 DESCRIPTION

  > I need to be able to add an offset to the current date and store the
  > result in a string with the format YYYYMMDDHHMMSS. I can get the
  > current date into the required format but I don't know how to add the
  > offset which will be in seconds to the date and be sure that the date
  > is incremented correctly taking care of leap years etc.

You probably want to use the Date::Calc module, available from CPAN (see
URL below).  You might be interested in Date::Manip, but as purl (an
infobot) from #perl on EFnet says, that module "is everything and the
kitchen sink."  It takes a great deal of time to load.  I'd suggest
Date::Calc for a simple addition/subtraction of days.  It can also do
offsets for days, hours, minutes, and seconds.

=head1 EXAMPLES

  use Date::Calc qw( Add_Delta_Days );
  ($y2,$m2,$d2) = Add_Delta_Days($y,$m,$d,$number_of_days);

  use Date::Calc qw( Add_Delta_DHMS );
  ($y2,$m2,$d2,$hr2,$min2,$sec2) = Add_Delta_DHMS(
    $y,$m,$d,$hr,$min,$sec,$day_offset,$hr_offset,$sec_offset
  );

Note that these are fully qualified years (meaning '99' is the year 99,
not 1999) and months start at 1 (not 0).

After you get the 6 values back from Add_Delta_DHMS, all you need to do is
format it as you like.

=head1 SEE ALSO

Christiansen, Tom and Nathan Torkington.  "Dates and Times."  In  I<Perl
Cookbook>. Sebastopol: O'Reilly & Associates, Inc., 1998, 76-78.
Documentation for Date::Calc.  Documentation for Date::Manip.  CPAN
(F<http://www.perl.com/CPAN>).

=head1 AUTHOR

-- 

  MIDN 4/C PINYAN, USNR, NROTCURPI
  jeff pinyan      japhy@pobox.com
  perl stuff       japhy+perl@pobox.com
  CPAN ID: PINYAN  http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/



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

Date: 20 Oct 1999 21:09:19 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help - Can't figure this out
Message-Id: <7ulb1v$ai3$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Anonymous <partner@casinofantasy.com> wrote:
> Abigail wrote:
>> Anonymous (partner@casinofantasy.com) wrote on MMCCXLI September MCMXCIII
>> in <URL:news:380D4E2F.B1ABC968@casinofantasy.com>:
>> `` your actually a female who is a perl hacker? way too cool marry me please please
>> `` please.
>>
>> Leave your teenage attitude at home.
>>
> 
> somebody in here is a bitch and a half...
> 

I think Abigail might have overestimated on the 'teenage' attitude ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 20 Oct 1999 17:19:27 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Help - Can't figure this out
Message-Id: <380E31BC.9202D5C1@chaos.wustl.edu>

Jonathan Stowe wrote:
> > somebody in here is a bitch and a half...
> 
> I think Abigail might have overestimated on the 'teenage' attitude ...

Often, too often, when a female of the species threatens the male of the
species, she is deemed 'bitch' regardless of age or maturity level. It
is a word used too casually I think.

e.


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

Date: Thu, 21 Oct 1999 07:54:39 +1000
From: Anonymous <partner@casinofantasy.com>
Subject: Re: Help - Can't figure this out
Message-Id: <380E3A1F.D8BE638@casinofantasy.com>

HAHAHAHA LOL... hehe lol.
you cracked me up ;).


Elaine -HFB- Ashton wrote:

> Anonymous wrote:
> >
> > your actually a female who is a perl hacker? way too cool marry me please please
> > please.
> > ;).
>
> Sorry dude, us chicks stick together :) She's mine!
>
> *smoochies*
>
> e.



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

Date: Thu, 21 Oct 1999 07:58:08 +1000
From: Anonymous <partner@casinofantasy.com>
Subject: Re: Help - Can't figure this out
Message-Id: <380E3AF0.FEE198E5@casinofantasy.com>

haha your so funny man hehe, you guys rock ;).


Tad McClellan wrote:

> Elaine -HFB- Ashton (elaine@chaos.wustl.edu) wrote:
> : Anonymous wrote:
> : >
> : > your actually a female who is a perl hacker? way too cool marry me please please
> : > please.
> : > ;).
>
> : Sorry dude, us chicks stick together :) She's mine!
>
>     I hate it when that happens.
>
> : *smoochies*
>
>     I love it when that happens.
>
>     :-)
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas



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

Date: 20 Oct 1999 15:53:05 -0700
From: don@value.net (Don Littlefield II)
Subject: How to do dynamic headers with libwww
Message-Id: <7ulh4h$g1@value.net>


Here is a current section of code I am using to
build a POST request.  It's basically all
hardcoded: (Using HTTP::Request::Common)

$request = POST $Applogicloc,
         Content_Type => 'form-data',
         Content => [
               xmlfile => [$XMLfile,$XMLfile],
               thefile => [$TXTfile,$TXTfile],
            returntype => 'xml',
                  var0 => $vardata,
         ];


This request works ok, but in the future I need
to be able to support var0 -> varN.  I looked
at trying to build this custom with the HTTP::Headers
push_header, but have had no luck.

Basically I need the request to stay the same, but
need the following line 1 - N times.. 

                  varN => $vardata,

In the new format $vardata will be coming from
a 'for $vardata(@varray)' so I thought I could
use push_header within the loop.

Don


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

Date: Wed, 20 Oct 1999 12:54:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: I pass by reference, but my array is unchanged.
Message-Id: <v3sku7.nhe.ln@magna.metronet.com>

Arne Jamtgaard (arnej@fc.hp.com) wrote:
: Tad McClellan wrote:

: > Arne Jamtgaard (arnej@fc.hp.com) wrote:

: > : >     my $i;

: > : This is actually unnecessary, as the default for a for-index is
: > : to keep it local to the for-loop.
: > 
: > : >     for $i ( 0 .. $#arr ){
: > : >         print "$arr[$i]\n";
: > : >         $arr[$i] = $i;
: > : >     }

: >    But it _is_ necessary if you code under "use strict".

: >    And anybody with a lick of sense programs under "use strict".

: If that's so, why does this code run without comment?


   perldoc -f sort


: use strict;

: foreach $a (@args) {


   try it with any variable not named $a or $b (like the $i we were
   using when I said that).

   They are package global variables used by sort()

   heh, heh.


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


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

Date: Wed, 20 Oct 1999 12:42:11 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Ignore the idiots (including Tad)
Message-Id: <3drku7.nhe.ln@magna.metronet.com>

Benjamin Vargas (bvargas@cmh.edu) wrote:

: Tad McClellan <tadmc@metronet.com> wrote in message
: news:le5ku7.h2e.ln@magna.metronet.com...
: > emlyn_a@my-deja.com wrote:
: >
: > : Just because Abigail is posting questions that engage YOU, it does not
: > : exclude anyone else from posting for legitimate questions they have.
: >                                        ^^^^^^^^^^
: >
: >    FAQs are not legitimate questions in *any* Usenet newsgroup.


: I would never consider hiring a consultant with an attitude such as yours.


   Eh?

   You prefer to hire consultants that *don't* adhere to 'netiquette?


   That is a very strange approach to business.



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


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

Date: Wed, 20 Oct 1999 12:50:16 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Ignore the idiots (including Tad)
Message-Id: <8srku7.nhe.ln@magna.metronet.com>

Benjamin Vargas (bvargas@cmh.edu) wrote:

: Tad McClellan <tadmc@metronet.com> wrote in message
: news:le5ku7.h2e.ln@magna.metronet.com...
: > emlyn_a@my-deja.com wrote:
: >
: > : Just because Abigail is posting questions that engage YOU, it does not
: > : exclude anyone else from posting for legitimate questions they have.
: >                                        ^^^^^^^^^^
: >
: >    FAQs are not legitimate questions in *any* Usenet newsgroup.


: I would never consider hiring a consultant with an attitude such as yours.


   That's OK.

   I have plenty of work from clued clients.

   I leave folks with your attitude to be serviced by the script kiddies,
   they need work too.


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


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

Date: 20 Oct 1999 21:21:22 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: in need of example...
Message-Id: <7ulboi$1ip$1@rguxd.viasystems.com>

Jeremiah Stanley <miah@idcomm.com> wrote:

:>Can anyone send me in the direction of a good example of listing and sorting
:>directories under Linux? I need to have a way to sort out .gif's and .jpg's
:>into an array and then output the list into HTML. I have the HTML part done,
:>but how do I do an 'ls' into an array so that I can sort it? So far all I
:>have done is wear out my harddrive and gotten frustrated! :)

my @filenames ;
chomp (@filenames = sort `/bin/ls -1`);
my @giffiles = grep {/\.gif$/} @filenames;
my @jpgfiles = grep {/\.jpg$/} @filenames;

perldoc perlop # for the `` operator
man ls # To learn about ls on your system
perldoc -f chomp
perldoc -f grep
perldoc -f sort
perldoc -f my
perldoc perlre # To learn about regular expressions

You could also explore:
perldoc -f opendir
perldoc -f readdir

There might be something in a FAQ about this too, but I didn't look
very hard.

Since you are looking for examples, reading through all of the FAQ
entries may actually be a good way for you to learn.  

perldoc perlfaq1
 ...
perldoc perlfaq9

There are lots of good examples in there of various ways to do
various things.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Wed, 20 Oct 1999 23:03:56 GMT
From: "ling" <link@nowhere.org>
Subject: Re: IP address
Message-Id: <wTrP3.18700$Jp4.29462@news20.bellglobal.com>


<hakanogren@my-deja.com> wrote in message
news:7ukoid$bgs$1@nnrp1.deja.com...
> Hello.
>the IP number from the machine where
> the script is running.
>
print host_name();

Kieu




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

Date: Wed, 20 Oct 1999 23:06:50 GMT
From: "ling" <link@nowhere.org>
Subject: Re: IP address
Message-Id: <eWrP3.18706$Jp4.29471@news20.bellglobal.com>

Sorry.
I meant :
print server_name();

Kieu




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

Date: Wed, 20 Oct 1999 16:36:42 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: IP address
Message-Id: <MPG.1277f1e69f017f4598a0d9@nntp.hpl.hp.com>

In article <380E2615.31DB57AC@chaos.wustl.edu> on Wed, 20 Oct 1999 
16:29:43 -0400, Elaine -HFB- Ashton <elaine@chaos.wustl.edu> says...
> hakanogren@my-deja.com wrote:
> > I would like to know how I can get the IP number from the machine where
> > the script is running.
> 
> 'perldoc -f gethostbyaddr'

How does gethostbyaddr() help with this problem?

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


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

Date: Wed, 20 Oct 1999 16:42:05 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: IP address
Message-Id: <MPG.1277f325b15da56798a0da@nntp.hpl.hp.com>

In article <7ul7pd$afd$1@gellyfish.btinternet.com> on 20 Oct 1999 
20:13:33 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> On Wed, 20 Oct 1999 10:09:08 -0700 Larry Rosler wrote:
> > In article <7ukoid$bgs$1@nnrp1.deja.com> on Wed, 20 Oct 1999 15:53:55 
> > GMT, hakanogren@my-deja.com <hakanogren@my-deja.com> says...
> >> I would like to know how I can get the IP number from the machine where
> >> the script is running.
> > 
> > I assume you mean that the program is being run by a server.
> > 
> > Dump the list of environment variables.  Some servers set 
> > $ENV{LOCAL_ADDR} as an IP address.  Most servers set $ENV{SERVER_NAME} 
> > as a domain name, which you can resolve using gethostbyname().
> > 
> > As a last resort, many systems have a `hostname` command, whose results 
> > you can resolve also.
> 
> Larry, Larry, Larry :
> 
> perlfaq9:
> 
>  =head2 How do I find out my hostname/domainname/IP address?
> 
> Back to the Old Grouch School for you matey ;-}

Hardly.  That FAQ (which admittedly didn't enter my Old Grouch head) 
doesn't suggest using the environment variables set by a server, because 
HTTP servers are personae non gratiae (off-limits) for the FAQs!

But it does deal better than I did with the hostname fallback.

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


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

Date: Wed, 20 Oct 1999 15:04:58 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Making a hash of subroutines
Message-Id: <x3yogdtj1k6.fsf@tigre.matrox.com>


schablone@my-deja.com writes:
> In article <s0790h64bhk81@corp.supernews.com>,
>   cberry@cinenet.net (Craig Berry) wrote:
> > schablone@my-deja.com wrote:

[snip]

> > : my %test;
> > : my @data;
> > :
> > : @data = ('244', 'Slightly Evil Bob', 'Chicken & Cucumber');
> > :
> > : %test = (
> > : 		id 		=> $data[0],
> > : 		name 		=> $data[1],
> > : 		sandwich	=> $data[2]
> > : 	);
> >
> > You could express this as
> >
> >   @test{'id', 'name', 'sandwich'} = @data;
> >
> > or even
> >
> >   @test{'id', 'name', 'sandwich'} = ( '244',
> >                                       'Slightly Evil Bob',
> >                                       'Chicken & Cucumber' );
> >
> > were you in the mood to ditch the @data variable.  Hash slices are
> your
> > slightly scary and often puzzling friends. :)
> 
> There was a reason, don't ask me what. Now, scary hash slices? Remind me
> to write a memo to my secret police.
> 
> Now, am I getting this right? If I declare an array which is
> structured like a hash, I can refer to it as a hash?

Not exactly. @test does not exist there. Only %test, which is a
hash. Craig was showing you how to create what is referred to as a
"hash slice". It's a very useful thing, and it's syntax is as so:

	my %hash;

	@hash{@array1} = @array2;

Which populates the %hash hash as you would expect. Basically, each
element in @array1 will become a key in %hash, and it will have the
corresponding element of @array2 as its value. This is identical to:

	my %hash;
	for my $i (0 .. $#array1) {
		$hash{$array1[$i]} = $array2[$i];
	}

But much faster. Note that @array1 and @array2 have to be of the same
size or else you'll get undefined (or missing) key/value pairs.

> Aha, enlightenment :-). Many thanks for your help, the post of Lord High
> Bennie Package is yours for the taking (once I've shaken this damn
> penguin off my foot that is).

WHAT? I posted a reply a few days ago. Where is my share?

;-)

--Ala



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

Date: Wed, 20 Oct 1999 16:27:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Making a hash of subroutines
Message-Id: <MPG.1277efc9bd9106d198a0d8@nntp.hpl.hp.com>

In article <x3yogdtj1k6.fsf@tigre.matrox.com> on Wed, 20 Oct 1999 
15:04:58 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...

 ...

> 	my %hash;
> 
> 	@hash{@array1} = @array2;
> 
> Which populates the %hash hash as you would expect. Basically, each
> element in @array1 will become a key in %hash, and it will have the
> corresponding element of @array2 as its value. This is identical to:
> 
> 	my %hash;
> 	for my $i (0 .. $#array1) {
> 		$hash{$array1[$i]} = $array2[$i];
> 	}
> 
> But much faster. Note that @array1 and @array2 have to be of the same
> size or else you'll get undefined (or missing) key/value pairs.

No harm, no foul, if @array2 is larger than @array1.  But not much 
sense, either.

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


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

Date: 20 Oct 1999 22:28:53 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Matching an asterisk
Message-Id: <slrn80sgh5.dgs.pete@theory2.phys.cwru.edu>

On 20 Oct 1999 19:54:21 GMT, Peter J. Kernan <pete@theory2.phys.cwru.edu> wrote:
 .=.=That's going to fail on "foo\nbar*" (false negative).
 .=.=
 .=.=It's also going to fail on "foo*\n" (false positive).
 .=.=
 .=
 .=i dont see either failure for 5.005_02 
 .=
 .=for ('foo\nbar*','foo*\n') {
 .=   print "$_: ",m/.*\*$/,"\n";
 .=};
oops. hoist by my own petard again. this should have been,

for ("foo\nbar*","foo*\n") {print "$_: ",m/.*\*$/,"\n";};

which prints

foo
bar*: 1
foo*
: 1

if someone has a false negative i would like to see it. since
 .* matches zero chars if need be this might be hard to do.
-- 
  Pete


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

Date: 20 Oct 1999 21:19:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mod_prl binaries
Message-Id: <7ulblt$ail$1@gellyfish.btinternet.com>

On Wed, 20 Oct 1999 15:45:11 GMT anant wrote:
> hi
> 
> Do you know where i will find mod_perl binaries?
> 

did you try <http://perl.apache.org>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 20 Oct 1999 14:48:14 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Perl for Epoc ?
Message-Id: <7uldb3$7kl$1@brokaw.wa.com>


Patrick Williamson wrote in message <7ul8gm$qdj$1@gxsn.com>...
>Is anyone aware of the existance of Perl for the Psion 5/Psion 5mx ? I
need
>to learn to Perl on the long journeys to and from work but, at this
rate,
>may have to lose a fantastic machine with a great op-system (although
not
>when compared to Unix), to a cack machine with an even worse op-system
Wince
>any/everyone ?


I'll try not to take that slam against Wince personally...

You are posting a FAQ, so that's what I'll point you to:
perlfaq2:"What machines support Perl?  Where do I get it?"

Lauren




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

Date: 20 Oct 1999 21:51:09 GMT
From: Jeff Zucker <jeff@vpservices.com>
To: Patrick Williamson <netsoft@freenetname.co.uk>
Subject: Re: Perl for Epoc ?
Message-Id: <380E3923.D83C098E@vpservices.com>

Patrick Williamson wrote:
> 
> Is anyone aware of the existance of Perl for the Psion 5/Psion 5mx ? 

I understand there is a project underway to port linux to that
platform.  If and when that gets done, Perl probably won't be too far
off, see http://www.calcaria.net/

> to a cack machine with an even worse op-system Wince

Are you implying that Perl is available on WinCE?  Details please.

-- 
Jeff

P.S. No Perl, but pudge has the Perl manuals in Newton format :-)


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

Date: 20 Oct 1999 22:48:10 GMT
From: dclxvi@best.com (Josh Geller)
Subject: Stripping ^M's from files under NT: Foolish Waste of Time?
Message-Id: <380e46aa$0$203@nntp1.ba.best.com>


OK. I'm stumped.

Here's the situation:

We compile a bunch of java code under NT: it runs Solaris.

The users on Solaris get a big tar file. They unload it, and all of
the text files (of course) have massive amounts of ^M's in them. OK,
this is not that big a deal, you can run dos2unix or a script that 
runs s/\012//g on each line, any number of things really.

But what I'd like to do is strip the ^M's before I make the tar
file. This would have to happen on NT.

So I wrote this little thing that looks like this:

foreach $file (@ARGV) {
    $pork = $file;
    open(FILE, "<$file");
    @file = <FILE>;
    close(FILE);
    $newfile = "$file" . ".new";
    open(NEWFILE, ">$newfile");
    foreach $line (@file) {
	chomp $line;
	print NEWFILE $line, "\015";
    }
}

I guess I was under the impression that \015 would be the normal ASCII
\n like is used under any normal, decent, operating system. Have I
lost my mind?

Anyway, this didn't work. It takes the newlines off, sure enough. But
When I look at the file on a unix host, the damned ^M's are still
there, except mixed up in in the middle of the lines.

So the question is, how can I convert these files to regular unixlike
newlines while they are still on the NT box, before I tar them up and
ship them off to the user?

Or should I give up and just write a script that works on the unix
side and give instructions to run that?

Thanks in advance for your kind and kindly help.

Best,

Josh




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

Date: 20 Oct 1999 14:13:15 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Substitution
Message-Id: <m1g0z5lor8.fsf@halfdome.holdit.com>

>>>>> "Craig" == Craig Berry <cberry@cinenet.net> writes:

Craig> With trepidation, I correct Randal: The @plan array in the
Craig> original post was populated via list-context <> with $/ set to
Craig> its default value.  Thus, each element of @plan can have at
Craig> most one \n, and that at the very end.  A global match is
Craig> superfluous in this case.

I apologize.  I didn't see context. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 20 Oct 1999 17:20:07 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Substitution
Message-Id: <brian-2010991720500001@rtp-cr45-dhcp-173.cisco.com>

In article <s0s8lirrr0154@corp.supernews.com>, cberry@cinenet.net (Craig Berry) wrote:

>Randal L. Schwartz (merlyn@stonehenge.com) wrote:

>:       s/\n/<p>/g for @plan;
>
>With trepidation, I correct Randal:  The @plan array in the original post
>was populated via list-context <> with $/ set to its default value.

in that case, 

   chomp(@plan);

-- 
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ 
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>



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

Date: Wed, 20 Oct 1999 13:21:01 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Substitution
Message-Id: <tltku7.nhe.ln@magna.metronet.com>

oliver.cookEWYBLB@ukonline.co.uk wrote:

: Thanks for those answers. I can't remove the YTTFIT by the way. It's
: imposed on me by my ISP.


   You mean that I can identify address mungers simply by
   looking for /.*\@ukonline.co.uk/

   ???


   Thanks. I can make use of that information.

   (change ISPs if you expect me to see your posts in the future :-)



: >: Please remove the YTTFIT before replying by email.
: >
: >   Please remove the YTTFIT if you desire replies by email.


: Please remove the EWYBLB before replying by email.

: ***** Posted via the UK Online online newsreader *****


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


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

Date: Wed, 20 Oct 1999 13:22:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Substitution
Message-Id: <ootku7.nhe.ln@magna.metronet.com>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <a45ku7.h2e.ln@magna.metronet.com> on Wed, 20 Oct 1999 
: 06:22:02 -0400, Tad McClellan <tadmc@metronet.com> says...


: >    foreach my $plan (@plan) {
: >       $plan =~ s/\n/<p>/;
: >    }

: Par, at best.


   I don't try and golf when I'm speaking to newbies.

   Got to keep the audience in mind ya know.


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


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

Date: 20 Oct 1999 22:54:16 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Substitution
Message-Id: <slrn80si0n.dgs.pete@theory2.phys.cwru.edu>

On Wed, 20 Oct 1999 17:20:07 -0400, brian d foy <brian@smithrenaud.com> wrote:
 .=In article <s0s8lirrr0154@corp.supernews.com>, cberry@cinenet.net (Craig Berry) wrote:
 .=
 .=>Randal L. Schwartz (merlyn@stonehenge.com) wrote:
 .=
 .=>:       s/\n/<p>/g for @plan;
 .=>
 .=>With trepidation, I correct Randal:  The @plan array in the original post
 .=>was populated via list-context <> with $/ set to its default value.
 .=
 .=in that case, 
 .=
 .=   chomp(@plan);
but then you have to get the <p>'s in.

$plan[$_] =~ s/$/<p>/ for (0 .. chomp(@plan)-1);

-- 
  Pete


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

Date: Wed, 20 Oct 1999 23:06:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Substitution
Message-Id: <s0sinll2r0149@corp.supernews.com>

brian d foy (brian@smithrenaud.com) wrote:
: in that case, 
: 
:    chomp(@plan);

But then you still need to iterate through appending '<P>', of course.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Wed, 20 Oct 1999 16:21:35 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Substitution
Message-Id: <MPG.1277ee5e71f1fbab98a0d7@nntp.hpl.hp.com>

In article <7ul8f9$afh$1@gellyfish.btinternet.com> on 20 Oct 1999 
20:25:13 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> On 20 Oct 1999 11:55:59 GMT oliver.cookYTTFIT@ukonline.co.uk wrote:
> > I'm having trouble with substitution. What I am trying to do, is write
> > a perl script that will prepare my .plan file for display on the web.
> > That means changing \n for <p> and changing *text* to <b>text</b>.
> > 
> > I wrote this script, but it bombs with the error "Can't modify array
> > deref in substitution at /usr/local/apache/cgi-bin/plan.pl line 6,
> > near "s/\n/\<p\>/;""
> > 
> > The script is:
> > 
> > #!/usr/bin/perl
> >  print "content-type:text/html\n\n";
> >  open (PLAN, "/home/ollie/.plan") || die "could not open plan file";  
> >  
> >  @plan = <PLAN>;    
> >  close(PLAN)||die "could not close plan file";  
> >  @plan =~ s/\n/\<p\>/;       
> >  print @plan; 
> > 
> > Any help on this one would be very gratefully received.
> 
> *I* would would get *really* lazy - after all golf is just a good walk
> spoiled ... :
> 
> print "<PRE>\n",<PLAN>,"</PRE>\n";

The two "\n"s are superfluous, because '<PRE>' and '</PRE>' force line 
breaks.

But the whole problem is being overkilled.  How about this:

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

     print "Content-Type: text/plain\n\n";
     open PLAN, '/home/ollie/.plan' or
         die "could not open plan file $!\n";  
     print <PLAN>;    
     close PLAN or die "could not close plan file $!\n";  

Not that I would bother with the last line, in any case.

So the golf winner is:

     print <PLAN>;

Ace!!!  Now *that's* lazy!

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


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

Date: 20 Oct 1999 21:14:05 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: this darn error
Message-Id: <7ulbat$ai6$1@gellyfish.btinternet.com>

On Wed, 20 Oct 1999 17:45:43 GMT Mikee wrote:
> every time i try to run a .pl file i get this error
> 
> <offline mode> : entername=value pairs on standard input
> 
> do you know why i get this?
> 

Er because you have:

use CGI;

at the top of program and CGI.pm does that if it isnt supplied with the
environment that it expects - if you dont need CGI.pm take it out.

please read the manpage for CGI.pm.

> i dont check the board alot so email me your suggestions thanx in advance
> 

This isnt a board this is a Usenet newsgroup. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Oct 1999 21:18:21 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: upload file help
Message-Id: <7ulbit$aii$1@gellyfish.btinternet.com>

On 20 Oct 1999 18:25:40 GMT F Timothy Martin wrote:
> I'm a beginner so be gentle...
> 

Thats for us to decide.

> Is it possible to upload a file from an html form using cgi?  I know what
> to do on the html side to get an upload form box, what do I need to write
> in the cgi?  Right now I can get the name of the file, but can't retrieve
> the actual file.
> 

Please see the manpage for CGI.pm - there is a section entitled :

       CREATING A FILE UPLOAD FIELD

Of course I have no way of determining that you actually meant that you
wanted to write this CGI program in Perl.

General CGI questions should be posted in the newsgroup

   comp.infosystems.www.authoring.cgi

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 20 Oct 1999 17:22:17 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: url not responding
Message-Id: <brian-2010991723020001@rtp-cr45-dhcp-173.cisco.com>

In article <7ul992$nhc$1@nnrp1.deja.com>, Howard <hxshxs@my-deja.com> wrote:

>Hi, I am using LWP::Simple; @page=get($url) to retrieve html. I wonder
>how to "try and catch" in Perl if the URL is not responding?

use LWP::UserAgent and the time_out() method.

-- 
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ 
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>



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

Date: Wed, 20 Oct 1999 17:01:28 -0700
From: "Brad Wallace" <brad_a_wallace@hotmail.com>
Subject: WIN .EXE files from PERL
Message-Id: <7ull2j$kov@news.or.intel.com>

Hello,

How do I take a PERL script and turn it in to a .exe file for windows?

Brad




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

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


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