[12718] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 128 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 13 19:51:02 1999

Date: Tue, 13 Jul 1999 16:47:43 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 13 Jul 1999     Volume: 9 Number: 128

Today's topics:
    Re: Matching and printf <coers@evsx.com>
    Re: Matching and printf (Larry Rosler)
    Re: Matching and printf (Tad McClellan)
    Re: MIME TYPE <mario.santana@autodesk.com>
        MiniVend Documentation birgitt@my-deja.com
    Re: Modules and Perl2exe <frederic.descamps@origin-it.com>
        moving files <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: moving files <gellyfish@gellyfish.com>
    Re: moving files <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: moving files (Mike Bristow)
    Re: moving files (Tad McClellan)
        Multiple Lines & How to stop <cayce@thurston.com>
    Re: Multiple Lines & How to stop (Tad McClellan)
    Re: Multiple Lines & How to stop (Abigail)
        Named pipe <vtrinh@octel.com>
    Re: Need Expert Help! <dhenders@cpsgroup.com>
        Negation in regular expressions nasenaffe@my-deja.com
        Net::SMTP problem? (J. Moreno)
        Newbie CGI query <picardk@runnymede.gov.uk>
    Re: Newbie CGI query (Saku Ytti)
    Re: Newbie CGI query (Saku Ytti)
    Re: Newbie CGI query <emschwar@rmi.net>
    Re: Newbie CGI query <emschwar@rmi.net>
    Re: Newbie CGI query (Saku Ytti)
    Re: newbie in PERL: Can you please suggest a solution? <Webdesigner@NewWebSite.com>
    Re: Newbie: Get all directories in a directory: (Rory C-L)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jul 1999 08:21:13 -0500
From: John Coers <coers@evsx.com>
Subject: Re: Matching and printf
Message-Id: <378B3D49.D7D71DCA@evsx.com>


> if (/$sig/) {
You know you are matching against $_ here right?  Is that what you mean
to be doing?


>         course it shouldn't. Could the "/" in the string
>         be causing me this trouble? How do I get around it?

if (m#$sig#) {

You can use any nonalphanumeric, non-whitespace character for regexp
delimeters by preceding the first one with m.

-- 
John Coers            EVSX, Inc.        
coers@evsx.com        Austin, Texas


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

Date: Tue, 13 Jul 1999 07:44:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Matching and printf
Message-Id: <MPG.11f4f0a1b9a50227989cb4@nntp.hpl.hp.com>

In article <378B3D49.D7D71DCA@evsx.com> on Tue, 13 Jul 1999 08:21:13 -
0500, John Coers <coers@evsx.com> says...
> > if (/$sig/) {
 ...
> >         ... Could the "/" in the string
> >         be causing me this trouble? How do I get around it?
> 
> if (m#$sig#) {
> 
> You can use any nonalphanumeric, non-whitespace character for regexp
> delimeters by preceding the first one with m.

This is true, but not responsive to the question.  It is an issue which 
might confuse someone coming to Perl from a language which is fully 
interpreted in one pass, such as any shell language.  (I am speaking for 
myself as of a few years ago.)

In Perl, syntax is determined at 'compile time', before variables are 
interpolated at 'run time'.  So the presence of a regex delimiter in the 
variable is not known to the parser and is irrelevant.  Thus /$sig/ and 
m#$sig# behave identically regardless of the contents of $sig.

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


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

Date: Tue, 13 Jul 1999 07:58:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Matching and printf
Message-Id: <ak9fm7.9bh.ln@magna.metronet.com>

John Coers (coers@evsx.com) wrote:

: > if (/$sig/) {
: You know you are matching against $_ here right?  Is that what you mean
: to be doing?


: >         course it shouldn't. Could the "/" in the string
: >         be causing me this trouble? How do I get around it?

: if (m#$sig#) {

: You can use any nonalphanumeric, non-whitespace character for regexp
: delimeters by preceding the first one with m.


   Which will not fix the problem, since having a slash in the
   value of $sig is not a problem.

   The match delimiters are recognized before the variable's value
   is interpolated.

   Try it and see for yourself.


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


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

Date: Mon, 12 Jul 1999 16:48:28 -0700
From: "Mario D. Santana" <mario.santana@autodesk.com>
Subject: Re: MIME TYPE
Message-Id: <7mdush$9jc@autodesk.autodesk.com>

<pre></pre> is for preformatted text. the browser won't eat
spaces/newlines/etc of text in between these tags. Useful for preserving
indentation&etc in files which get interpreted as html, e.g.:

print("Content-Type: text/plain\n\n<pre>");
while (<REQUEST_FILE>) {print;}
print("</pre>");

hth,


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

Date: Tue, 13 Jul 1999 07:38:37 GMT
From: birgitt@my-deja.com
Subject: MiniVend Documentation
Message-Id: <7meqdt$ch5$1@nnrp1.deja.com>

I like to get the opinion about a GPL software package, called MiniVend
(www.minivend.com) written in Perl.

I am unable to read the source code and often lost in understanding the
documentation. Nevertheless, I believe the software is very good and
performs extremely well, if handled properly. (Having been a customer of
the author of the software, it was handled properly for my purposes and
impressed me by its performance). The software has been recognized and
gotten quite a bit of different evaluations, which are published on the
minivend home site´s rating section.

There is an attempt to establish a documentation team to help to edit
the documentation. (www.minivend.com/minivend/minivend-docs/1999/)

It is not clear to me, if the documentation is really lacking something
of importance to Perl experts too, or if it just seems to be unclear to
endusers with very limited knowledge like me. I personally would not
think that the documentation is suitable for unexperienced beginners
in unix system administration, Perl, databases and web-based e-commerce
services, but it might/should be appropriate enough for ISP/e-commerce
consultants. There obviously has been put an enourmous amount of work by
a single author into the code AND the documentation.

The package is also still in major development, a fact which makes
documentation not easier.

Considering that the package is a "hot" item for e-commerce consultants
and ISPs, it is even more respectable that the package has been released
with a GPL or artistic license, IMHO. As a good money-making/saving tool
to the ISP community, there seems to be not much interest to improve the
documentation towards clarity suitable to the enduser, i.e. potential
clients.

I personally do not care at all for the e-commerciality of the package,
but like to get an evaluation of the documentation from the view point
of a true Perl expert. Learning the package´s tag syntax by working on
the documentation and learning Perl competes for my time I have
available to dig into both. I like to decide for one or the other.

I sincerely would like to ask anyone who cares to answer publicly, not
to abuse this question for cheap shots.

Thank You.

--
birgitt


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 12:09:15 +0200
From: "Frederic Descamps" <frederic.descamps@origin-it.com>
Subject: Re: Modules and Perl2exe
Message-Id: <0E16861EE7BCD111BE9400805FE6841F0A47DD53@c1s5x001.cor.srvfarm.origin-it.com>

yes, of course, as written in the help file...
Ethan H. Poole <ehpoole@ingress.com> wrote in message
news:378A2EA1.62225287@ingress.com...
> Frederic Descamps wrote:
> >
> > Hi,
> >
> > When I want to use Perl2exe with a script (this script works fine with
perl
> > name_name_of_script) using a module, it gives me this following message
:
> >
> > Warning: module [name_of_module] not found
> > Make sure that the perl\bin directory is in your path
> >
> > Could somebody help me ?
>
> Have you tried specifying the modules (including their paths) on the
> command line for Perl2Exe in addition to your file containing the Perl
> code you wish 'compiled'?
>
> --
> Ethan H. Poole           ****   BUSINESS   ****
> ehpoole@ingress.com      ==Interact2Day, Inc.==
> (personal)               http://www.interact2day.com/




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

Date: Tue, 13 Jul 1999 11:35:28 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: moving files
Message-Id: <378B5CC0.D3C3A35@ccrs.nrcanDOTgc.ca>

Hi, 

Is there a perl alternative to moving files?  Using system commands is
my last resort.

Thanks in advance

 ..Tom

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
588 Booth Street , Room 241                   Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7                     
http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------


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

Date: 13 Jul 1999 16:51:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: moving files
Message-Id: <378b6076@newsread3.dircon.co.uk>

Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
> Hi, 
> 
> Is there a perl alternative to moving files?  Using system commands is
> my last resort.
> 

The module File::Copy will do this.

/J\ 
-- 
"Mark my words, sex is never enough. Sooner of later she'll want a
dishwasher" - Policeman, City Central


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

Date: Tue, 13 Jul 1999 12:02:14 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: Re: moving files
Message-Id: <378B6306.CB32260C@ccrs.nrcanDOTgc.ca>

Would you hapen to have an example?  I have used File::Copy to copy
files, but can't find an example for moving files.

 ..Tom
Jonathan Stowe wrote:
> 
> Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
> > Hi,
> >
> > Is there a perl alternative to moving files?  Using system commands is
> > my last resort.
> >
> 
> The module File::Copy will do this.
> 
> /J\
> --
> "Mark my words, sex is never enough. Sooner of later she'll want a
> dishwasher" - Policeman, City Central

-- 

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
588 Booth Street , Room 241                   Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7                    http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------


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

Date: Tue, 13 Jul 1999 18:14:50 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: moving files
Message-Id: <slrn7on0gq.ump.mike@lindt.fat.dotat.at>

On Tue, 13 Jul 1999 12:02:14 -0400, Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
>Would you hapen to have an example?  I have used File::Copy to copy
>files, but can't find an example for moving files.

perldoc File::Copy

-- 
Mike Bristow, Geek-At-Large.                GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!



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

Date: Tue, 13 Jul 1999 12:17:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: moving files
Message-Id: <irofm7.ikh.ln@magna.metronet.com>

Tom Kralidis (tom.kralidis@ccrs.nrcanDOTgc.ca) wrote:

: Is there a perl alternative to moving files?  Using system commands is
: my last resort.


      perldoc -f rename


   restrictions similar to 'mv'


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


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

Date: Mon, 12 Jul 1999 12:17:15 -0700
From: "Cayce Collins" <cayce@thurston.com>
Subject: Multiple Lines & How to stop
Message-Id: <7mdeve$f7t$1@quark.scn.rain.com>

Mostly to anybody who has the time to help me figure this out.

A guy made this perl script for me, and now I am trying to edit it to
customize it more.  I am needing to have a file ... such as the "$usertime"
specifies, and then read certain items from it.  In this case, I am trying
to read multiple lines, example:

Jerryb Problems:Had a modem failure.
            Problems:New System configureation.
            Problems:Sound Card conflict.
Carryd Problems:Blah blah blah
             Problems:Blah blah blah
             Problems:Blah blah blah

2 different users, but I need to be able to read all of their problems, the
code below only reads one line, and I have been looking up how to go down a
line and read again, but so far no good, please assist.

Cayce Collins

Here is the script:

#!/usr/bin/perl

$usertime="/usr1/temp/techprob.txt";

use POSIX qw(strftime);
        $localtime = strftime "%D", localtime;

&Parse();

open(FILE,"$usertime");
@usertime=<FILE>;
close(FILE);
$test=0;
foreach(@usertime){

if(
    /^
    ($input_for{'username'})
    (\s*)
    Problems:(.*)
    /x
)

                $test=1;
                $username=$input_for{'username'};
                $problems=$3;
        }
}
print "content-type: text/html\n\n";
print <<"EOF";
<html>
<head>
<title>Scatter Creek Information</title>
</head>
<body>
<body topmargin="0" leftmargin="0">
<br>
<br>
<P>
EOF

if($test){

print <<"EOF";
<P><br><br>
&nbsp;&nbsp;&nbsp;Online Stats:<br><br>
<Font color="#007480">Username:</font>&nbsp;&nbsp;$username<br>
<Font color="#007480">Problems:</font>&nbsp;&nbsp;$problems
EOF

}

else{

print <<"EOF";
<CENTER>
Either your username is invalid or you have not logged any time for this
month.
</CENTER>
EOF

}

print <<"EOF";
</HTML>
EOF
exit;
exit;


sub Parse {

        if ($ENV{'REQUEST_METHOD'} eq "GET"){
                $buffer = $ENV{'QUERY_STRING'};
        }
        if ($ENV{'REQUEST_METHOD'} eq "POST"){
                read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
        }

        @buffer = split(/&/,$buffer);

        foreach (@buffer){

                ($key,$value) = split(/=/,$_,2);

                $key =~ tr/+/ /;
                $key =~ s/%(..)/pack("c",hex($1))/ge;
                $key =~ s/<!--(.|\n)*-->//g;


                $value =~ tr/+/ /;
                $value =~ s/%(..)/pack("c",hex($1))/ge;
                $value =~ s/<!--(.|\n)*-->//g;

                $value =~ tr/\n/ /;
                $value =~ tr/\cM/ /;

                $input_for{$key} .= "\0" if (defined($input_for{$key}));
                $input_for{$key} .= $value;
        }

}
sub Test_Data{

if(!defined(%input_for)){return 0;}

foreach(keys(%input_for)){
        if(length($input_for{$_})==0){return 0;}
        }
return 1;
}


sub Reprint_form{

$error=@_[0];
$htmlfile = $ENV{'PATH_INFO'};

open(FILE,"$htmlfile");
@file=<FILE>;
close(FILE);

print "content-type: text/html\n\n";
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Form Correction</TITLE>
</HEAD>
<BODY>
<H2>$error</H2>
<HR>
EOF

$test=0;

foreach (@file){

        if(/^<FORM/){$test=1;}
        if($test){

                if(/<INPUT/){
                s/NAME="(.*)"/NAME="\1" VALUE="$input_for{\1}" /;
                }

                if(/<TEXTAREA/){

s/NAME="(.*)"(.*)><\/TEXTAREA>/NAME="\1"\2>$input_for{\1}<\/TEXTAREA>/;
                }

                if(/<TEXTAREA/){

s/NAME="(.*)"(.*)><\/TEXTAREA>/NAME="\1"\2>$input_for{\1}<\/TEXTAREA>/;
                }
        print $_;
        }
        if(/^<\/FORM/){$test=0;}

}

print <<"EOF";
</BODY>
</HTML>
EOF





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

Date: Mon, 12 Jul 1999 13:09:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Multiple Lines & How to stop
Message-Id: <5g7dm7.vue.ln@magna.metronet.com>

Cayce Collins (cayce@thurston.com) wrote:

: Mostly to anybody who has the time to help me figure this out.


   Is that an English sentence?

   If so, what does it mean?


: I am trying
: to read multiple lines


: Here is the script:

: #!/usr/bin/perl


   Your script has a bug in it!

   Read the BUGS section of the top level perl man page, then
   fix the line above.



   You can "build up" the multiline records yourself:

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

my $record;

while (<DATA>) {
   if ( /^\S/ ) {   # beginning of next record. process the previous one

      print "$record----------\n" if $record;   # replace with "real" processing

      $record = $_;
   }
   else
      { $record .= $_ }

}
print "$record----------\n";   # don't forget the last record

__DATA__
Jerryb Problems:Had a modem failure.
            Problems:New System configureation.
            Problems:Sound Card conflict.
Carryd Problems:Blah blah blah
             Problems:Blah blah blah
             Problems:Blah blah blah
-----------------------------


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


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

Date: 12 Jul 1999 23:27:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Multiple Lines & How to stop
Message-Id: <slrn7olg1k.h7.abigail@alexandra.delanet.com>

Cayce Collins (cayce@thurston.com) wrote on MMCXLI September MCMXCIII in
<URL:news:7mdeve$f7t$1@quark.scn.rain.com>:
%% Mostly to anybody who has the time to help me figure this out.
%% 
%% A guy made this perl script for me, and now I am trying to edit it to
%% customize it more.  I am needing to have a file ... such as the "$usertime"
%% specifies, and then read certain items from it.  In this case, I am trying
%% to read multiple lines, example:
%% 
%% Jerryb Problems:Had a modem failure.
%%             Problems:New System configureation.
%%             Problems:Sound Card conflict.
%% Carryd Problems:Blah blah blah
%%              Problems:Blah blah blah
%%              Problems:Blah blah blah
%% 
%% 2 different users, but I need to be able to read all of their problems, the
%% code below only reads one line, and I have been looking up how to go down a
%% line and read again, but so far no good, please assist.

So, what have you tried, and how did it work out? Obviously, you didn't
dive in the script that well, otherwise you wouldn't think it only read
one line. With one tiny little print command, you would found that out.
I get the feeling you want someone here write the script for you. 

%% Here is the script:
%% 
%% #!/usr/bin/perl

There is no '-w'.
There is no 'use strict;'.
There is no 'use CGI;'.

%% $usertime="/usr1/temp/techprob.txt";
%% 
%% use POSIX qw(strftime);
%%         $localtime = strftime "%D", localtime;
%% 
%% &Parse();
%% 
%% open(FILE,"$usertime");

There is no 'or die' part. There are needless quotes.




Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Jul 1999 06:10:01 -0700
From: Van Trinh <vtrinh@octel.com>
Subject: Named pipe
Message-Id: <wk673oae6u.fsf@octel.com>


I have to set up a communication path between 2 different machines
(say A and B). 

At machine A, process P1 is running as server waiting for
connect request. 

At machine B, process P2 is connecting to process P1 via
socket. Process P2 will serve all local connection requests to P1
(i.e. Any local process in machine B that wants connection to P1 in
machine A will go through its own P2 via fifo).

I mkfifo'ed the STDIN and STDOUT of P2 for the local processes to
share. For some reason, I can only write to the fifo and not receive
from it. Here's my crude perl code that does this (any help is
appreciated):


-------------------- Server P2 code --------------------

my ($host, $port, $kidpid, $handle, $line);
$host  = shift || 'localhost';
$port = shift || 2345;
$port = $1 if $port =~ /(\d+)/; # untaint port number

# create a tcp connection to the specified host and port
$handle = IO::Socket::INET->new(Proto     => "tcp",
				PeerAddr  => $host,
				PeerPort  => $port)
    or die "can't connect to port $port on $host: $!";

$handle->autoflush(1);		# so output gets there right away
print STDERR "[Connected to $host:$port]\n";

# split the program into two processes, identical twins
die "can't fork: $!" unless defined($kidpid = fork());

my $my_write_named_pipe_path = "./fifo1";
my $my_read_named_pipe_path = "./fifo2";

# the if{} block runs only in the parent process
if ($kidpid) {
    print STDERR "[parent]\n";
    # do the named pipe/fifo thing
    unless (-p  $my_read_named_pipe_path) {
	unlink $my_read_named_pipe_path;
	if ( system('mknod', $my_read_named_pipe_path, 'p') ) {
	    die "mknod $my_read_named_pipe_path failed";
	}
    }
    open (FIFO2 , "+< ./fifo2");
    select(READ);
    # copy the socket to FIFO2 so that client can receive it.
    while (defined ($line = <$handle>)) {
	print FIFO2 $line;
    }
   kill("TERM", $kidpid);	# send SIGTERM to child
}
# the else{} block runs only in the child process
else {
    # do the named pipe/fifo thing
    unless (-p  $my_read_named_pipe_path) {
	unlink $my_write_named_pipe_path;
	if ( system('mknod', $my_write_named_pipe_path, 'p')) {
	    die "mknod $my_write_named_pipe_path failed";
	}
    }
    open (FIFO1 , "+< ./fifo1");
    print STDERR "[child]\n";
    
    # copy FIFO1's input to the socket
    while (defined ($line = <FIFO1>)) {
	print $handle $line;
    }
}
-------------------- End Server p2 CODE --------------------


-------------------- Start P2's Client code -----------------
while (1) {
    open (MYWRITE , "+< ./fifo1") or die "Can't open fifo1: $!";
    print MYWRITE "Good afternoon, van. \n";
    open (MYREAD,"+<./fifo2") or die "Can't open fifo2: $!";
    read (MYREAD, $line, $buflen);
    print $line;
}
-------------------- End P2's client code --------------------



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

Date: 13 Jul 1999 17:19:25 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: Need Expert Help!
Message-Id: <87iu7ogple.fsf@camel.cpsgroup.com>

>>>>> "Tad" == Tad McClellan <tadmc@metronet.com> writes:


    Tad>    It is good form to give some clue as to what part of TFM
    Tad> contains their answer.

     umm the M part. :-)

     *duck*




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

Date: Tue, 13 Jul 1999 21:09:23 GMT
From: nasenaffe@my-deja.com
Subject: Negation in regular expressions
Message-Id: <7mg9to$un2$1@nnrp1.deja.com>

Hello,

I have a problem with regular expressions. I have
a string, with different fields all written in [].

[text][text][text]

To read out the fields I use the split function
and split at ][. -split("/\]\[/",...)-

 My problem is that in the fields
only the ] are written with a "\" Symbol.

So it is possible that you find

[text][text][text][te\][xt] in the text.

So it should not split at \][.
I tried something like -split("/\\{0}\]\[/",...)-,
but this does not work.
How can I reach that the regular expression does
not match, when a \ Symbol stands before it?

Thanks for any help.

Daniel Müller




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 12:59:23 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Net::SMTP problem?
Message-Id: <1duvqnz.na0j0d7201g2N@roxboro0-0016.dyn.interpath.net>

I was trying to forward some message from a news server to my mail box
and had a bit of a problem -- it kept crashing.

I think I've mainly /solved/ the problem, but I'm not sure what was
causing it.

I was using:

$smtp = Net::SMTP->new('mail.interpath.com');    # change this
$smtp->mail('phenix@interpath.com') or die "unable to open SMTP server";

for $count ($prevnum+1..$last) {
   $message = getarticle($count); # get the message from the NNTP server

   $smtp->recipient('phenix@interpath.com'); # change this

   $smtp->data();

   # break the message back into indv. lines and send them to the mail 
   # server 
   @message=split /\n/, $message;

   foreach $line (@message) {
      $smtp->datasend($line . "\n") or die "failed to send msg $count\n$line";
      print OTHER $line . "\n";
   }
 
   $smtp->dataend();  # tell the server were done with this message

   print "finished with $count\n";
} # end for loop

$smtp->quit;


After a couple of messages that crashed after showing a memory error, so
I've changed it to


for $count ($prevnum+1..$last) {

$smtp = Net::SMTP->new('mail.interpath.com');    # change this
$smtp->mail('phenix@interpath.com') or die "unable to open SMTP server";

$message = getarticle($count);



   $smtp->recipient('phenix@interpath.com'); # change this

   $smtp->data();

   # break the message back into indv. lines and send them to the mail server 
   @message=split /\n/, $message;

   foreach $line (@message) {
      $smtp->datasend($line . "\n") or die "failed to send msg $count\n$line";
      print OTHER $line . "\n";
   }
 
   $smtp->dataend();  # tell the server were done with this message

   print "finished with $count\n";
   $smtp->quit;
} # end for loop


Which seems to work a bit better, but still fails after about 15
messages.

-- 
John Moreno


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

Date: Tue, 13 Jul 1999 16:02:30 GMT
From: Keith P <picardk@runnymede.gov.uk>
Subject: Newbie CGI query
Message-Id: <7mfnuc$ml1$1@nnrp1.deja.com>

What is the best method to insert three fields (: delimited) from a one
record file into an HTML?  Should I use SSI?  I really want to keep it
simple.

PS, Is this the right forum in which to make this inquiry?

--
Keith Picard


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 13 Jul 1999 16:30:29 GMT
From: saku.news@ytti.net (Saku Ytti)
Subject: Re: Newbie CGI query
Message-Id: <slrn7omqdd.9ub.saku.news@ytti.net>

On Tue, 13 Jul 1999 16:02:30 GMT, Keith P <picardk@runnymede.gov.uk> wrote:
>What is the best method to insert three fields (: delimited) from a one
>record file into an HTML?  Should I use SSI?  I really want to keep it
>simple.

open(FOO,file);
$foo=<FOO>;
($foo[0], $foo[1], $foo[2])=split(/:/,$_,3);
print<<EOF;
Content-type: text/html

$foo[0], $foo[1], $foo[2]
EOF

That might not be correct, but I hope you got the idea.

-- 
	--ytti - ::3585:0512:1378


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

Date: 13 Jul 1999 16:34:59 GMT
From: saku.news@ytti.net (Saku Ytti)
Subject: Re: Newbie CGI query
Message-Id: <slrn7omqlr.9ub.saku.news@ytti.net>

On 13 Jul 1999 16:30:29 GMT, Saku Ytti <saku.news@ytti.net> wrote:
>On Tue, 13 Jul 1999 16:02:30 GMT, Keith P <picardk@runnymede.gov.uk> wrote:
>>What is the best method to insert three fields (: delimited) from a one
>>record file into an HTML?  Should I use SSI?  I really want to keep it
>>simple.
>
>open(FOO,file);
>$foo=<FOO>;
>($foo[0], $foo[1], $foo[2])=split(/:/,$foo,3);
>print<<EOF;                           ^^^^
>Content-type: text/html
>
>$foo[0], $foo[1], $foo[2]
>EOF
>
>That might not be correct, but I hope you got the idea.

-- 
	--ytti - ::3585:0512:1378


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

Date: 13 Jul 1999 12:01:14 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Newbie CGI query
Message-Id: <xkf1zecmnth.fsf@valdemar.col.hp.com>

Keith P <picardk@runnymede.gov.uk> writes:
> What is the best method to insert three fields (: delimited) from a one
> record file into an HTML?  Should I use SSI?  I really want to keep it
> simple.
> 
> PS, Is this the right forum in which to make this inquiry?

No.  You probably want comp.infosystems.www.{something}.

This newsgroup is for questions and discussion of Perl (the language) and 
perl (the interpreter).  A very naive test for whether or not a post is
appropriate for this newsgroup (it's not a forum) is this:

if(document_contains('perl')) {
  print "This *might* be appropriate for clpm.\n";
} else {
  print "This is almost certainly not appropriate for clpm.\n";
}

-=Eric, in an oddly helpful mood today.


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

Date: 13 Jul 1999 12:07:16 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Newbie CGI query
Message-Id: <xkfyagkl8yz.fsf@valdemar.col.hp.com>

saku.news@ytti.net (Saku Ytti) writes:
> On Tue, 13 Jul 1999 16:02:30 GMT, Keith P <picardk@runnymede.gov.uk> wrote:
> >What is the best method to insert three fields (: delimited) from a one
> >record file into an HTML?  Should I use SSI?  I really want to keep it
> >simple.

No shebang line.  Bad!
No -w or use strict.  Bad!

> open(FOO,file);

No error-checking.  Bad!

> $foo=<FOO>;

my $foo = <FOO>;

> ($foo[0], $foo[1], $foo[2])=split(/:/,$_,3);

Assuming the original poster meant colon-separated, instead of
colon-delimited:

my @foo = split /:/;  # you don't know how many are in a given line
                      # if there are four, then your code would have put
                      # the extra in $foo[2].

> print<<EOF;
> Content-type: text/html
> 
> $foo[0], $foo[1], $foo[2]
> EOF

He said he wanted the fields inserted into an HTML (by which I assume he
meant an HTML file).  This prints out data in a form appropriate for a
CGI program, but for all we know, he wanted to do this as a filter, in
which case he'd want to do some pattern matching to make sure the data
gets printed in the right place in the file.

> That might not be correct, but I hope you got the idea.

To quote Neils Bohr: "That's not only not right, it's not even wrong!"

-=Eric


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

Date: 13 Jul 1999 21:37:04 GMT
From: saku.news@ytti.net (Saku Ytti)
Subject: Re: Newbie CGI query
Message-Id: <slrn7oncc8.cd8.saku.news@ytti.net>

On 13 Jul 1999 12:07:16 -0600, Eric The Read <emschwar@rmi.net> wrote:

>> On Tue, 13 Jul 1999 16:02:30 GMT, Keith P <picardk@runnymede.gov.uk> wrote:
>> >What is the best method to insert three fields (: delimited) from a one

>> ($foo[0], $foo[1], $foo[2])=split(/:/,$_,3);
>
>Assuming the original poster meant colon-separated, instead of
>colon-delimited:
>
>my @foo = split /:/;  # you don't know how many are in a given line
>                      # if there are four, then your code would have put
>                      # the extra in $foo[2].

He said three, and he could easily format it the way he wants.
I assumed he is new to perl so wrote example to easier illustrade 
the function.

And he was familiar with SSI so with SSI include he could add the 
output to html.

'don\'t fuck the dot'

-- 
	--ytti - ::3585:0512:1378


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

Date: Tue, 13 Jul 1999 01:13:02 GMT
From: Floyd Morrissette <Webdesigner@NewWebSite.com>
Subject: Re: newbie in PERL: Can you please suggest a solution?
Message-Id: <7me3qm$4ie$1@nnrp1.deja.com>

I have done this before. Database is the best way to go.


In article <7lfvdn$fi2$1@nnrp1.deja.com>,
  info@sisblansko.cz wrote:
> I have several fields such as First name, Surname, Address and
> Age.(They can be separated by commas on one line like a text file). I
> need to allow users to add, save, browse, choose and possibly delete
> records(lines). I think the best solution would be to use a database
but
> it seem to be rather difficult in PERL. Is there a more simple way how
> to do it in PERL? Thanks for an advice.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>

--
Get your web site from http://www.NewWebSite.com
Consultation is always free.
Help with cgi scripts.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 13 Jul 1999 10:41:12 GMT
From: campbell-lange@easynet.co.uk (Rory C-L)
Subject: Re: Newbie: Get all directories in a directory:
Message-Id: <campbell-lange-1307991140560001@campbell-lange.easynet.co.uk>

On 12/7/99 at 1:54 PM, stephan.budach@knsk-bbdo.de (Stephan Budach) wrote:

> i am having the same problem with unix. Maybe you could tell mw two things:
> 
> 1st, how are you calling lokkin - just like this &lookin(Directory)?

I call the subroutine with
   @dirs = lookin($fold); 
where $fold = something like "My HD:Folder to parse:etc:"

> 2nd, i guess with unix i have to change the ":" to a "/", since the
> directory separator for unix is "/" (":" is Mac, isn't it?).

':' is the Mac directory separator.

Here is the code:
   1: sub lookin
   2: {
   3:    $dir = shift;
   4:    opendir DIR, $dir or die "Can't open $dir $^E \n";
   5:    my @inside = map { ($dir . $_ . ':') } readdir DIR;
   6:    @inside = grep { -d and !/format/i } @inside;
   7:    closedir DIR;
   8:    foreach my $f (@inside)
   9:    {
  10:       lookin($f);
  11:       push @directories, $f;  
  12:    }
  13:    return @directories;
  14: }

Line 5 gets all the contents of $dir and renames each to the full path
specification, as if all the contents were directories (although some are
in fact files, so adding the final ':' is bizarre)
Line 6 then checks to see if the now completely specified item within
$fold is a directory (fortunately the trailing ':' doesn't fool the -d
test, probably because Perl can't find the specified item (?)
   
(3rd)
> And what ist meant by !/format/i? It seems to be an regexp, but what
does it do?

I don't want to open any folder/directories that contain the word 'format'
in either uppper or lower case.

-- 
Rory Campbell-Lange
The Campbell-Lange Workshop


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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 V9 Issue 128
*************************************


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