[11564] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5164 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 18 07:07:28 1999

Date: Thu, 18 Mar 99 04:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 18 Mar 1999     Volume: 8 Number: 5164

Today's topics:
    Re: Another woeful flock post (Larry Rosler)
    Re: argument parsing w/ getopts (Johan Vromans)
    Re: chdir : how do I pass parameters to this function?? <Philip.Newton@datenrevision.de>
    Re: chdir : how do I pass parameters to this function?? <Philip.Newton@datenrevision.de>
    Re: deleting an array of words from a string (Larry Rosler)
    Re: Deleting the rest of the line... (Larry Rosler)
    Re: Filehandle Q... <rick@rixsoft.com>
        Get an image from a URL using LWP alam@netscape.net
    Re: How to #! in Win95? c4jgurney@my-dejanews.com
        How to 'die' gracefully? <Marcel.vdLaan@ehv.sc.philips.com>
        How to copy a file ?? <cdelvil@ribera.tel.uva.es>
    Re: How to copy a file ?? (Lack Mr G M)
        How to redirect Output? <pep_mico@hp.com>
        Mac Newbie: droplet question (Rory Campbell Lange)
    Re: Mac Newbie: droplet question (Arved Sandstrom)
    Re: MSIE Does Not Undestand "IMGSIZE" <Philip.Newton@datenrevision.de>
        MySQL + libncurses.so.3.0 schypre@yahoo.fr
    Re: Net::POP3;login method returns 0 with messages on s (Arved Sandstrom)
        Not stictly a PERL question <c-denman@dircon.co.uk>
    Re: Ouput to textbox w/o rewriting page <alex@kawo2.rwth-aachen.de>
    Re: perlcc error vishalb@my-dejanews.com
    Re: Regex $1 behavior (Larry Rosler)
    Re: Regular Expression Help <Philip.Newton@datenrevision.de>
        sendmail won't run on www ? <mlc@glink.net.hk>
    Re: sendmail won't run on www ? <zenin@bawdycaste.org>
    Re: Variable splitting <rick@rixsoft.com>
    Re: Win32 Network problems with ActiveState PERL? c4jgurney@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 14 Mar 1999 07:27:27 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Another woeful flock post
Message-Id: <MPG.11557531aa4d6ebd98973f@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7cg8rd$fd8$1@nnrp1.dejanews.com> on Sun, 14 Mar 1999 
12:08:17 GMT, shanx24@my-dejanews.com <shanx24@my-dejanews.com >says...
 ... 
> #!/usr/local/bin/perl5.00502 -w

The '-w' is a good start.  It would point out that you are better off to 
use all upper-case letters for a file handle, such as DB.

> use fcntl ':flock';

Fcntl  (capital F)

> open(db, ">>data.txt") or die "Please call the experimenter: $!\n";
>         flock(db, LOCK_EX);

Check the result of this system call too (and the others, if you have 
the patience).

>         seek(db, 0, 2);
>         print db "Hi there\n";
> close db;
> 
> print "record written";
 ...
> syntax error in file last2.cgi at line 2, next 2 tokens "use fcntl"

Then that's where to look, or earlier.

> syntax error in file last2.cgi at line 4, next 2 tokens ") or"

This is a rebound from the previous error.

> The use of Fcntl is something I picked up from Perl.com site in their FAQ 5,
> as recommended by various posts in this group. And that is not working!

Then you do know how it is spelled!

> Could you please tell me whats wrong with the above code?

Done.

> Would be grateful if you could also post a CC message to winframe@iname.com.

I would have if that's what you had set your Reply-To header to.

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


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

Date: 18 Mar 1999 11:06:21 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: argument parsing w/ getopts
Message-Id: <wl390cv159e.fsf@plume.nl.compuware.com>

christianarandaOUT@OUTyahoo.com (Christian M. Aranda) writes:

> I plan on writing a seperate sub for the parsing of the args, but
> don't know exactly how to handle missing arguments, creating mandatory
> arguments, help text, usage text, etc.
> 
> If anyone has good examples of parsing command line arguments, please
> post them here so I can get some ideas.

The Perl distribution provides two standard Getopt modules,
Getopt::Std for easy cases and Getopt::Long for sophisticated
purposes. So I would suggest to first take a look at Getopt::Long.
If you feel vital things are missing in Getopt::Long, contact its
author. Also, consult http://www.squirrel.nl/people/jvromans/software.html 
for a peek at the next version.

On CPAN you can find a plethora of other Getopt modules, some of them
extremely powerful (and complex). 
URL: http://www.perl.com/CPAN/modules/by-category/12_Opt_Arg_Param_Proc

In any case, please try to avoid duplicating all the good work others
have already done.

-- Johan


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

Date: Thu, 18 Mar 1999 10:24:13 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: chdir : how do I pass parameters to this function???
Message-Id: <36F0C63D.3318C5FD@datenrevision.de>

Tad McClellan wrote:
> 
> knataraj (knataraj@worldnet.att.net) wrote:
> 
> :          Here's is the pbm.
> 
>    What is a pbm?

"Problem", probably. It would be easier to understand if knataraj had
just said "problem" in the first place.

Cheers,
Philip


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

Date: Thu, 18 Mar 1999 10:25:27 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: chdir : how do I pass parameters to this function???
Message-Id: <36F0C687.FE2B7CCD@datenrevision.de>

Martien Verbruggen wrote:
> 
> Why don't you just do:
> 
> while (defined($dir = <STDIN))

Because then there would be a > missing after STDIN and the code
probably wouldn't compile :)

Cheers,
Philip


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

Date: Sun, 14 Mar 1999 08:53:52 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: deleting an array of words from a string
Message-Id: <MPG.115589791f9af786989742@nntp.hpl.hp.com>

In article <36ebde67.7410602@news.cyberway.com.sg> on Sun, 14 Mar 1999 
16:21:32 GMT, Jason Q. <pigs_can_fly@mindless.com >says...
> There are certain words that I would like to be taken out of a string
> as below:
> 
> @ignore = (i, am, a);

Barewords -- for shame!

  @ignore = qw(i am a);

> $string = "a boy am i";
 ...
> Would I be able to achieve this is in just one line, perhaps in the
> following format:
> 
> $string =~ s/(all the words of be stripped)//g;

  $string =~ s/\b(?:i|am|a)\b//g;

You should read about this in perlre.

It leaves any spaces behind.  If more than one space in a row troubles 
you, try this (read perlop):

  $string =~ tr/ //s;

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


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

Date: Sun, 14 Mar 1999 08:20:47 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Deleting the rest of the line...
Message-Id: <MPG.115581b5da23bab3989740@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <36ebd042.8366911@news.cybernex.net> on Sun, 14 Mar 1999 
15:09:47 GMT, gertyk@mail.cybernex.net <gertyk@mail.cybernex.net 
>says...
> Try this:
> @lines=("Something TRUCK something else\n",
> 	    "TRUCK nothing before\n", 
> 		"Nothing after TRUCK\n",
> 		"This has TRUCK two TRUCK times!\n");
> 		
> foreach $line(@lines){
> 	$line=~/(.*\bTRUCK)\b.*/;  #<---- Here is the Regex
> 	print $1."\n";
> 	}

> >David Falconer (webmaster@guestcities.com) wrote:
> >
> >: In a text file I have, I want to delete all characters after a
> >: certain occurance of a word.
> >
> >: So each time it comes across the word TRUCK it deletes all
> >: characters after that for the rest of the line.

Your regex doesn't meet this requirement.  For the last test case, it 
produces:

  This has TRUCK two TRUCK

But it should produce:

  This has TRUCK

It's just too greedy!  Try this instead:

  	/(.*?\bTRUCK)\b.*/
          ^

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


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

Date: Wed, 17 Mar 1999 22:16:31 -0500
From: Rick Osborne <rick@rixsoft.com>
Subject: Re: Filehandle Q...
Message-Id: <36F0700F.602C6C5C@rixsoft.com>

Quoth Morris:

>I want a script to call an external program (whois), write the output
>that would normally be echoed to the screen to a file, and then return
>to normal behavior.

Well, there are of course a million ways to do this, but ...

  my $whois = `$whois`;
  #-- and if you really still want to output it to a file ...
  if(open(F,">$out_file")) {
    print F "$whois\n";
    close(F);
  } #if

Backticks are useful, especially when you want to capture the output.
You can then go ahead and do whatever you want with it, including
writing it to a file.  I think you were trying to redirect STDOUT, which
you don't have to do (Perl does it for you).

--
Rick Osborne <rick at rixsoft dot com> -- Founder, Orlando Perl Mongers
Email me if you are in Central Florida and are interested in Perl
(or just like hanging out with people who are)


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

Date: Thu, 18 Mar 1999 08:16:20 GMT
From: alam@netscape.net
Subject: Get an image from a URL using LWP
Message-Id: <7cqcof$3nh$1@nnrp1.dejanews.com>

Hi:

I have wrote a small program to get an secure image from the url using LWP:

use LWP::Simple;
use LWP::UserAgent;
use HTTP::Response;

open(dest, ">abc.jpg");

$ua = new LWP::UserAgent;
$req = new HTTP::Request GET =>
'http://www.easyfinder.com.hk/easyclub/bitload/pix/19990318a02.jpg';
$req->authorization_basic('id', 'passwd');
$resp = $ua->request($req);
print dest $resp->content;


After I run the program, I can't see the image. I am wondering is there are
something wrong with my last statement:

print dest $resp->content;

which write the content to the file.....

any help or ideas will be appreciate!

ps.  I tried the simplest way using LWP::simple getstore method but It seems
that it does not support for the authentication login.... =(

Antonio.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 18 Mar 1999 09:46:34 GMT
From: c4jgurney@my-dejanews.com
Subject: Re: How to #! in Win95?
Message-Id: <7cqi1p$8ju$1@nnrp1.dejanews.com>

In article <36f03235.9102999@news.telepac.pt>,
  np49fn@mail.telepac.pt (Valter Cunha) wrote:
> First of all, i want to say im a university student trying to learn
> scripting Perl by myself, with the help of several books. Right now i
> have one problem: all the books i read about Perl focus the scripting
> of Perl under Unix, but what about under Win95?

In that case I heartily recomend  Learning Perl on Win32 Systems
http://www.oreilly.com/catalog/lperlwin/desc.html


> Well, let us say i
> have a script called "test.pl" in the directory cgi-bin, and my perl
> interpreter file "perl.exe" is in the same directory... My problem is,
> im my html file, i have the following instruction:

You really don't want to do that - NEVER put the perl executable in the
cgi-bin directory.

>
> <IMG SRC="cgi-bin\test.pl">
>
> and on my Perl script i start with the instruction "#!\cgi-bin\perl"
> the thing is... I cant get the script to get started... I even read
> the FAQ at www.perl.com, and they say "The Win95/NT installation, when
> using the Activeware port of Perl, will modify the Registry to
> associate the .pl extension with the perl interpreter. If you install
> another port, or (eventually) build
> your own Win95/NT Perl using WinGCC, then you'll have to modify the
> Registry yourself." Im novice at registry... Can someone help me?
> Thanxs
>
> Valter Cunha

I may be mistaken but you might not have to do this - if you're using the
ActiveState build of perl with a sensible web server then all you have to do
is set up the file associations correctly using explorer. Then put your
perl.exe in a sensible place and use the full path to perl e.g.
#!c:\perl\bin\perl.exe.

If this doesn't work then read this
http://dynamicnet.net/support/fp/perlwithPWS.htm which I shamlessly plundered
from a post by Ekkis <ekkis@arix.com> (thanks Ekkis).

HTH,

Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 18 Mar 1999 11:23:32 +0100
From: Marcel van der Laan <Marcel.vdLaan@ehv.sc.philips.com>
Subject: How to 'die' gracefully?
Message-Id: <36F0D424.AEF8BF55@ehv.sc.philips.com>

Hi there,

  I have a question about catching the die signal when using modules. I want a
module to catch a 'die', do something with it (i.e. look up the error message
that goes with it) and retrow the 'die' to the root script. I've tried this in a
number of ways, but I find that not both these handler can be active
simultaneously. 

When I run the script (root.pl) as shown I get:

Error number ='101'
Error        = Goodbye, cruel world
Goodbye, cruel world

When I remove the 'local' in 'root.pl', I get:

<HTML><BODY><H1>Error</H1><HR>
Error = 101 at Mod.pm line 38.
</BODY></HTML>
Died at root.pl line 15.

What I'm kind of looking for is:

<HTML><BODY><H1>Error</H1><HR>
Error number ='101'
Error        = Goodbye, cruel world
</BODY></HTML>

  Another question which is related is: How do I do the assigning to !$ in a
similar manner to the %Error? I read in perlvar that assigning to $! is
possible, but experiments have not succeeded with this.

  I include the code I have so far so you can seen what I mean: 

#########################
## FILE: root.pl       ##
#########################
use Mod;

BEGIN 
{
  local $SIG{__DIE__} = \&handler;
}

sub handler
{
  $msg = shift;
  chomp $msg;
  print STDOUT "<HTML><BODY><H1>Error</H1><HR>\n";
  print STDOUT "Error = $msg\n";
  print STDOUT "</BODY></HTML>\n";
  die;
}

my $m = Mod->new();

$m->killit;

#########################
## FILE: root.pl       ##
#########################

package Mod;

BEGIN {
  $SIG{__DIE__} = \&myhandler;
}

sub myhandler
{
  my $Error = {
    '101' => "Goodbye, cruel world\n",
    '102' => "what have I done to deserve this?\n"
  };

  my $num = shift;
  chomp $num;
  $num =~ s/\s.*$//;
  print STDERR "Error number ='$num'\n";
  print STDERR "Error        = $Error->{$num}";
  die $Error->{$num};
}

####################
# Start routines
####################

sub new
{
  my $class = shift;
  my $self = {};

  bless $self, $class;

  return $self;
}

sub killit
{
  die 101;
}

####################
# Compulsary 1;
####################

1;


Thanks in advance and any tips on die'-ing gracefully are welcome,

Marcel van der Laan


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

Date: Thu, 18 Mar 1999 10:43:24 +0100
From: Cesar Delgado <cdelvil@ribera.tel.uva.es>
Subject: How to copy a file ??
Message-Id: <Pine.GSO.3.96.990318103915.25780B-100000@ribera>


Maybe this is a stupid question for some of you but I have been looking
for a function in Perl to copy one file from a directory to another
different directory and I did't find it out.

Could somebody tell me how to do it ??

Please, email me to:

cdelvil@ribera.tel.uva.es 




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

Date: Thu, 18 Mar 1999 11:23:08 GMT
From: gml4410@ggr.co.uk (Lack Mr G M)
To: Cesar Delgado <cdelvil@ribera.tel.uva.es>
Subject: Re: How to copy a file ??
Message-Id: <1999Mar18.112308@ukwit01>

In article <Pine.GSO.3.96.990318103915.25780B-100000@ribera>, Cesar Delgado <cdelvil@ribera.tel.uva.es> writes:
|> 
|> Maybe this is a stupid question for some of you but I have been looking
|> for a function in Perl to copy one file from a directory to another
|> different directory and I did't find it out.
|> 
|> Could somebody tell me how to do it ??

   RTFM, specifically:

 perldoc File::Copy


-- 
----------- Gordon Lack ----------------- gml4410@ggr.co.uk  ------------
The contents of this message *may* reflect my personal opinion.  They are
*not* intended to reflect those of my employer, or anyone else.


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

Date: Thu, 18 Mar 1999 10:08:59 +0100
From: Pep Mico <pep_mico@hp.com>
Subject: How to redirect Output?
Message-Id: <36F0C2AB.D37B932A@hp.com>


Hello,

I'm Using Activestate perl (perl for win32). And I'm trying to redirect
the output of my scripts using the simply MS-DOS redirecting like this.

myscript.pl > output.txt

But output.txt doesn't receive anything it has the lengh of "0" zero
bytes.

My "sophisticated" script is only this line

print "hello\n";

Why It doesn't work? How can i redirect the output of my Script?


Regards
pep_mico@hp.com




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

Date: Thu, 18 Mar 1999 10:22:39 -0100
From: 'x'campbell-lange@easynet.co.uk (Rory Campbell Lange)
Subject: Mac Newbie: droplet question
Message-Id: <'x'campbell-lange-1803991022400001@campbell-lange.easynet.co.uk>


I have a script which I would like to be able to use when:
1) a file is passed on to it
2) or it is double clicked.

I'm not having any problems with the second part, but 1) doesn't work

   some code, (no subroutines)
   then:
   
   $file = shift(@ARG);                                       
#problem                                
   if ($file != /(.)+/i) {                                     #problem
   $file = MacPerl::DoAppleScript(<<END_SCRIPT);
   choose file with prompt "Please select a coordinate file"
   END_SCRIPT
   $file =~ s/^alias "//;
   $file =~ s/"$//;
   }
   open(IN, $file) or die ("Can't open file"); 

I realise my pattern matching isn't too good, so that is where the problem
might be. However the error message when I get this is "Can't open file".
I'd be grateful for any help
Rory

-- 
Rory Campbell-Lange
The Campbell-Lange Workshop
Remove the 'x' to reply


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

Date: Thu, 18 Mar 1999 07:05:28 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Mac Newbie: droplet question
Message-Id: <Arved_37-1803990705280001@dyip-100.chebucto.ns.ca>

In article
<'x'campbell-lange-1803991022400001@campbell-lange.easynet.co.uk>,
'x'campbell-lange@easynet.co.uk (Rory Campbell Lange) wrote:

> I have a script which I would like to be able to use when:
> 1) a file is passed on to it
> 2) or it is double clicked.
> 
>    
>    $file = shift(@ARG);                                       

[ Some snippage ]

@ARGV, not @ARG.

In any case, it might be more elegant to just see if scalar(@ARGV) is
non-zero, rather than pattern-match on '.' (which you get if you
double-click a droplet). This would make it more portable.

Arved


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

Date: Thu, 18 Mar 1999 10:03:36 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: MSIE Does Not Undestand "IMGSIZE"
Message-Id: <36F0C168.A88B7F88@datenrevision.de>

Richard H wrote:
> 
> quick q,
> where does the imgsize method come from,
> is it in any distributed module??

OTTOMH: Probably from the module Image::Size (I think that's what it's
called) on CPAN.

Cheers,
Philip


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

Date: Thu, 18 Mar 1999 09:50:31 GMT
From: schypre@yahoo.fr
Subject: MySQL + libncurses.so.3.0
Message-Id: <7cqi96$8mv$1@nnrp1.dejanews.com>

Hie

have a Mysql RPM packages. but need sthg call libncurses.so.3.0 to set it up
any ideas where i can find it? went to rpmfind.net, lip6.fr...

have no ideas where can find it.

it is quite urgent. cant do anythg without it !!!

Thank you

sandrine

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 18 Mar 1999 06:55:38 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Net::POP3;login method returns 0 with messages on server
Message-Id: <Arved_37-1803990655380001@dyip-100.chebucto.ns.ca>

In article <eMB##GNc#GA.247@upnetnews02.moswest.msn.net>, "Scott"
<snetvil@email.msn.com> wrote:

> ...As I stated above, I have no problems logging into my pop3 server
> and downloading messages but, I always get a '0' from login. Am I
> misunderstanding something or is my implementation wrong?
> 
> use Net::POP3;
> $pop=Net::POP3->new('pop.someserver.com',timeout=>30);
> $l=$pop->login("userid","password");
> print "$l\n"
> 
> Any help is appreciated. I'm using the ActiveState build 509 of Perl
> 5.005_02 on Windows 95. (I haven't checked to see if the same thing occurs
> under Unix).

[ Some snippage ]

Last time I ran something like this using the same AS build, and under
Win98, which was about 2 days ago, login() _did_ return the number of
messages on the server. :-)

So, no, I don't think there is anything wrong with your code snippet.

I seem to recall that Net::POP3 worked OK, too, under Win95.

Arved


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

Date: Thu, 18 Mar 1999 09:54:10 -0800
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Not stictly a PERL question
Message-Id: <36f0d1e6.0@glitch.nildram.co.uk>

I know this is not strictly a PERL question, but I have a query I think many
of you out there could helpme with.

I have been placed in a position where I need to build a server from
scratch.  I have been using a virtual server and was able to update space
and e-mail account and so-forth.

What I would like to do is replicate the system I have learned to love, but,
while I am at it, improve it and make it 'my baby'.

The old system comprised of the following....

Lynux, Perl, DNS, pop3 services.

I was able to telnet in and add domain names to the dns, and set up space
and pop3 accounts for that domain.

----

Now, I need a simular set-up - but I have no idea what software the 3rd
party were running.  Does anyone know of any software that will re-create
the latter.

I was planning on buying a pIII 450, 12Gig HD.  Then install NT4, and PERL
Win32, Apache (win32) - that I can do, and have done on my own machine which
works fine.

What DNS stuff do I need, and what pop3 server software is available out
there.

Cheers for any of your time, it's really appreciated.

Chris D




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

Date: Thu, 18 Mar 1999 09:50:55 -0500
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: "Graphics i.e." <graphxie@ix.netcom.com>
Subject: Re: Ouput to textbox w/o rewriting page
Message-Id: <36F112CF.CC07D81F@kawo2.rwth-aachen.de>

"Graphics i.e." wrote:
> Is it possible to return the results of a form submitted to a perl script
> back to a textbox without rewriting the entire page?  If it is possible can
> someone give me a clue on how to do this.

Maybe - if you combine JavaScript (to update that textfield)
with a nph perl script (to make web page stay) - but I'm not quite sure.

/Alex
--
http://www.simplex.ru/pref.html


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

Date: Thu, 18 Mar 1999 10:24:59 GMT
From: vishalb@my-dejanews.com
To: rolm@my-dejanews.com
Subject: Re: perlcc error
Message-Id: <7cqk9m$a7m$1@nnrp1.dejanews.com>


>
> the perplexing part here is the "Couldn't open !".  i don't have any idea what
> the compiler is unable to open.
>

perlcc on win32 is broken. What you are seeing is because it couldnot
construct a valid temporary filename. It is actually something like 
"Couldnot open $tempfilename!", The fixes required are quite minor,so someone
on win32 should be able to fix it easily.

cheers,
vishal

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sun, 14 Mar 1999 08:32:53 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regex $1 behavior
Message-Id: <MPG.11558486b435645c989741@nntp.hpl.hp.com>

In article <36ebdb60.11212870@news.cybernex.net> on Sun, 14 Mar 1999 
15:55:03 GMT, gertyk@mail.cybernex <gertyk@mail.cybernex >says...
> Try this:
> 
> $address = "127.0.0.1";
> $address =~ s/((\d+\.)+)\d+/\1/;
                         -->  $1  <--

(as has already been discussed several times in this thread)

In any case, the following is much shorter (hence, IMO, much clearer):

  $address =~ s/\d+$//;


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


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

Date: Thu, 18 Mar 1999 10:19:42 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Regular Expression Help
Message-Id: <36F0C52E.C2162F54@datenrevision.de>

Gala Grant wrote:
> 
> "c:\\web\\content\\tbuedit\\alpha\\tools\\pressroom\\releases\\"

Hmm, this has nothing to do with the question, but... did you know that
you can also use '/' as a path separator, even on Windows systems? That
way you avoid having to double your backslashes all the time. For
example, C:\\web\\content is the same as C:/web/content . Looks cleaner
IMHO.

Cheers,
Philip


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

Date: Thu, 18 Mar 1999 17:27:08 +0800
From: mlc <mlc@glink.net.hk>
Subject: sendmail won't run on www ?
Message-Id: <36F0C6EC.43B12D8C@glink.net.hk>

Hi !

I am testing a small script to send out email via sendmail.
The script runs fine under bash. But when I called the script
via www  <A href="/cgi-bin/m.pl">, the apache server returned
premature end of script headers.

Script Listing:

#!/usr/local/bin/perl

$mailprog = "/usr/sbin/sendmail";

    open(MAIL,"|$mailprog -t");
    print MAIL "To: <root\@abc.com>\n";
    print MAIL "From: <mlc>\n";
    print MAIL "Subject: Nothing\n\n";
    print MAIL "Reply-To: <mlc>\n";
    print MAIL "That's all folk!\n\n";
    close(MAIL);

Apparently, the script failed on the line open().
Any suggestion would be much appreciated.

Thanks,

John Chan
mlc@glink.net.hk





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

Date: 18 Mar 1999 10:23:31 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: sendmail won't run on www ?
Message-Id: <921752825.862997@thrush.omix.com>

[posted & mailed]

mlc <mlc@glink.net.hk> wrote:
: I am testing a small script to send out email via sendmail. The script
: runs fine under bash. But when I called the script via www <A
: href="/cgi-bin/m.pl">, the apache server returned premature end of script
: headers.

	Sendmail will cause you no end of problems in CGI scripts if called
	as you have. -It's not your fault, it's sendmail.  Sendmail isn't to
	smart in this area. :-/

: Script Listing:
: #!/usr/local/bin/perl
: $mailprog = "/usr/sbin/sendmail";
:     open(MAIL,"|$mailprog -t");
:     print MAIL "To: <root\@abc.com>\n";
:     print MAIL "From: <mlc>\n";
:     print MAIL "Subject: Nothing\n\n";
:     print MAIL "Reply-To: <mlc>\n";
:     print MAIL "That's all folk!\n\n";
:     close(MAIL);
: Apparently, the script failed on the line open(). Any suggestion would be
: much appreciated.

	The Apache error logs normally tell you a little more about what the
	first line or two of output was that it called an "premature end of
	script header" or such.  More then likely it's sendmail being stupid
	and sending error messages to standard out (not error) that Apache
	then thinks are meant to be headers...

	Two ways you can work this.  First way is to make sure you output
	your full headers before you call sendmail, and flush the buffer
	($|++).  The second is to use all around much more reliable handling
	methods for sendmail.  Take a look at the module below if you'd like
	to go this route.  It's designed to handle all of sendmail's
	funkiness cleanly.

 	ftp://thrush.omix.com/pub/perl/modules/Mail-Sendmail-1.10.tar.gz

	This is not the same Mail::Sendmail that CPAN has btw. -The CPAN
	version has nothing to do with sendmail for some reason... :-/

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 17 Mar 1999 22:30:38 -0500
From: Rick Osborne <rick@rixsoft.com>
Subject: Re: Variable splitting
Message-Id: <36F0735E.4A643E51@rixsoft.com>

Quoth Ruud Limbeck:

> The problemm $test contains : thisisatestandiwant
> All I want to have is test (actually 7 characters from
> the beginning and 4 caracters long .and drop it in a
> variable called $new .

Check perlfunc for substr():

  $new = substr($test,7,4);  #too logical, I know

Or, you could do it a couple dozen ways with with a regexp:

  $new = $1 if($test =~ /^......(....)/);
  $new = $1 if($test =~ /^.{7}(.{4})/);

Or, maybe an array slice:

  $new = join('',(split('',$test))[7..10]);

But that, of course, is *much* less efficient.

--
Rick Osborne <rick at rixsoft dot com> -- Founder, Orlando Perl Mongers
Email me if you are in Central Florida and are interested in Perl
(or just like hanging out with people who are)


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

Date: Thu, 18 Mar 1999 09:24:57 GMT
From: c4jgurney@my-dejanews.com
Subject: Re: Win32 Network problems with ActiveState PERL?
Message-Id: <7cqgp3$7lf$1@nnrp1.dejanews.com>

In article <36F0433A.B5BC1CDB@dial.pipex.com>,
  Peter Connolly <xni11@dial.pipex.com> wrote:
<snip>
> I'm trying to write a small program using ActiveState PERL 5.09 plus
> some BackWeb extensions (which are all working fine).  My problem is
> that my PERL script can't look on a mapped drive.  The code below works
> fine when the drive in question is a local drive.  If the drive is
> mapped through Windows NT as a share, it can't locate the files and
> halts.
</snip>

If you're sure that the process is logged in with an account with proper file
access permissions then it might be the good old win32 drive letter problem.

Try changing g: in you script to the full server/drive path e.g.
\\server\share\dir - then with a little luck all should be fine.

HTH,

Jeremy Gurney
SAS Programmer
Proteus Molecular Design Ltd.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5164
**************************************

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