[21726] in Perl-Users-Digest
Perl-Users Digest, Issue: 3930 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 7 18:05:55 2002
Date: Mon, 7 Oct 2002 15:05:12 -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 Mon, 7 Oct 2002 Volume: 10 Number: 3930
Today's topics:
-M not working when inside of a function. Why? (Perl Man)
Re: Anyone who uses Perl on VAX <jpagnew@vcu.edu>
Re: Anyone who uses Perl on VAX <pkent77tea@yahoo.com.tea>
Re: Convert Perl script to C program (and Why was this <mapSoN.S.S@oderF>
Re: Convert Perl script to C program (and Why was this <joe+usenet@sunstarsys.com>
Re: Dealing with database problems gracefully? <bkennedy@hmsonline.com>
Re: Dealing with database problems gracefully? <ReplyToGroup@thanks.com>
Re: File::Copy from NT to Unix using UNC <nigel@bannockfarm.freeserve.co.uk>
Help me understand *foo = \... <heather710101@yahoo.com>
Re: Help me understand *foo = \... <mjcarman@mchsi.com>
Re: need help with regular expressions and not matching (aka ? the Platypus)
needleman-wunsch alignment (Stanley Lee)
Re: net::pop3 problem <g-preston1@ti.com>
Perl shortcut question <bryan@akanta.com>
Re: Perl shortcut question ctcgag@hotmail.com
Re: Perl shortcut question <jurgenex@hotmail.com>
Re: Perl shortcut question <jeff@vpservices.com>
Problem with SIG handling on WinNT <nwang@panix.com>
Re: Problem with SIG handling on WinNT <flavell@mail.cern.ch>
Re: Problems using Http::Date <me@home.com>
Re: Sending HTML email in Perl <richard@zync.co.uk>
Re: Sending HTML email in Perl <pkent77tea@yahoo.com.tea>
Re: sendmail and perl <pkent77tea@yahoo.com.tea>
Simple Way to Refer to ARGV Values as a String (Kevin Simonson)
Re: Simple Way to Refer to ARGV Values as a String <jurgenex@hotmail.com>
Re: Simple Way to Refer to ARGV Values as a String <jeff@vpservices.com>
Re: What can I do if I have not got chmop <nigel@bannockfarm.freeserve.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Oct 2002 13:28:42 -0700
From: mcollette@switchboard.com (Perl Man)
Subject: -M not working when inside of a function. Why?
Message-Id: <f5a1c73e.0210071228.1e25ec90@posting.google.com>
# Find the latest JOINER PORTS file according to time stamp.
sub JPort ()
{
$newtime=999999999;
$newestfile = "";
foreach $file (@array)
{
chomp $file;
# skip over the . .. directories
next if ($file =~ /^\./ or $file =~ /\.log/i);
$stamp = -M $file; # file modified date -M
print "s: $stamp\n";
# If stamp is newer, then set newtime to be the most recent
if ($stamp < $newtime)
{
$newtime=$stamp;
$newestfile=$file; # set newest file to be the most recent.
}
}
}
-------------
The print statement should be returning the modified date of the file.
This works fine when its not inside the function. I'm running build
633. Any ideas?
Thanks
------------------------------
Date: Mon, 07 Oct 2002 15:11:13 -0400
From: Jim Agnew <jpagnew@vcu.edu>
To: jozefn <jozefn@newbolt.sonic.net>
Subject: Re: Anyone who uses Perl on VAX
Message-Id: <3DA1DC51.382DBAF7@vcu.edu>
ok,, I'm going to intersperse my comments thru this note... This was
included to the list
so people can do this again..
jim
jozefn wrote:
>
> Jim,
>
> Thanks for the reply.
>
> Here is where I am.
>
> I have been working with Perl for about 5 years ( total programming experience 17 years). I have written systems in Perl on Linux/Solaris/HP(Posix)/Win32 boxes - mainly CGI based systems with Mysql backend HTML/Javascript frontend.
>
Nice!!
> I now have a project on a VAX. Have not seen the box yet - don't know about the OS - as you can see - very green.
>
Welcome to one of the finest os's around. Definitely not a desktop
except for the very hard-core.. I think this is the only os that the
maker had to patch the uptime display b/c
it ran out of digits for the # of days from 3 to 5.
> From my first paragraph I need a way to relate my current experience to the new environment. PERL is perl which is why I love it - moves from box to box and does the same fantastic work.
>
Me too.
> Are the any gotch'yas working on VAX?
>
yup. instead of Man you use help. also, not all of the CPAN is active
on VMS.. see
http://www.crinoid.com/perl560.htmlx
see for tools
http://nchrem.tnw.tudelft.nl/openvms/software2.html
> What is it similar to - UNIX? MPEIX? Dos?
>
Hmm.. good question. more like Unix, with the shell spelled out like
cobol.. commands are english language. Help gets you started. see
http://www.openvms.compaq.com:8000/
for the *complete* docset on the web.
> Do all of the parts of Perl work the same way on VAX as they do on the above mentioned platforms?
>
pretty much... the flavor you use is the Unix flavor, not the win32
flavor.
> Can I use the system command to run alread resident programs and scripts in background?
>
you have subprocesses, detached processes (daemons), batch queues, all
able to do your bidding.
> Can I put a web based front-end on this box, so as to automate the current command-line entry setup that is used to run reports etc?
>
Yup.. look up the OSU webserver, (david jones), there is a WASD
webserver, and a few others,
plus apache is or has been ported. all are capable of running cgi perl.
> Thanks for any and all help, suggestions, sites etc.
>
yer welcome!!!
> #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
> print @c=map chr $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
> -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>
> On Mon, 7 Oct 2002, Jim Agnew wrote:
>
> > What do you need to know??
> >
> > jim
> >
> > jozefn wrote:
> > >
> > > Group,
> > >
> > > I have working with Perl/Apache/Mysql on Linux, HP, Win32 systems. Mostly
> > > on Linux systems. I have a project which involves a Vax box ( unkown
> > > territory for me ). Are there any Perl Hackers out there using Perl
> > > on Vax boxes? The project I have involves a menu system that runs
> > > simple reports on the VAX box. The reports are already in place - I
> > > just want to put a front-end html based system that allows the running
> > > of these reports using PERL/HTML/Javascript etc.
> > >
> > > I need sites and or suggestions from anyone. I am into Perl but green
> > > on VAX.
> > >
> > > Thanks to all.
> > >
> > > #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
> > > print @c=map chr $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
> > > -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
> >
------------------------------
Date: Mon, 07 Oct 2002 21:21:27 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Anyone who uses Perl on VAX
Message-Id: <pkent77tea-DAF012.22212107102002@news-text.blueyonder.co.uk>
In article
<Pine.LNX.4.40.0210071000310.27518-100000@newbolt.sonic.net>,
jozefn <jozefn@newbolt.sonic.net> wrote:
> territory for me ). Are there any Perl Hackers out there using Perl
> on Vax boxes? The project I have involves a menu system that runs
> simple reports on the VAX box. The reports are already in place - I
> just want to put a front-end html based system that allows the running
> of these reports using PERL/HTML/Javascript etc.
...and also replying to
<Pine.LNX.4.40.0210071039540.4141-100000@newbolt.sonic.net> ...
First, I used to work on a Vax at a previous orkplace, so this may all
be out of date or indeed wrong...
A Vax is the hardware platform, and it runs the operating system
OpenVMS. I don't think Vaxen run Digital UNIX.
Ask the sysadmin about the best way to transfer files to/from the Vax.
The VMS filesystem is case insensitive. Perl is case sensitive. VMS
doesn't like more than one '.' in filenames, but files have version
numbers for free.
The VMS way of specifying filenames might be strange to you, so use
File::Spec and its friends for filepath operations, and that's got the
added bonus of better portability too.
AFAIK VMS is an ASCII based system, but has the DOSish idea of 2-byte
line endings in text mode... sometimes :->
Vaxes are little-endian. This probably doesn't make any difference to
you, but you never know
> Are the any gotch'yas working on VAX?
> Do all of the parts of Perl work the same way on VAX as they do on the above
> mentioned platforms?
For more differences see the VMS section of perlport, the perlvms.pod
page in the source kit and online, or
http://www.sidhe.org/vmsperl/index.html
> What is it similar to - UNIX? MPEIX? Dos?
I'd say it's different from all of them, in various ways :-)
> Can I put a web based front-end on this box, so as to automate the current
> command-line entry setup that is used to run reports etc?
It sounds like thesecond thing you'll need to set up is a web server
that allows you to run programs via the CGI. Apparently Apache has been
ported after some fashion to OpenVMS and there are other webservers
available for VMS. Your sysadmin may already be running a webserver.
The _first_ thing is to get yourself an account on the box, get perl
installed and try your programs out on the command line. Take the
unknowns one at a time.
> Can I use the system command to run alread resident programs and scripts in
> background?
But yes, system() and pipes and all that work just fine. And definitely
read those docs I cited.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Mon, 07 Oct 2002 18:28:36 GMT
From: "MrFFrreeddoo" <mapSoN.S.S@oderF>
Subject: Re: Convert Perl script to C program (and Why was this group's name changed?)
Message-Id: <onko9.1303$Qi5.157433922@newssvr13.news.prodigy.com>
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.40.0210071851000.10879-100000@lxplus075.cern.ch...
> On Oct 7, -F-r-e-d-o- inscribed on the eternal scroll:
>
> > But sigh, I am obviously just wasting my time,
>
> The time you're wasting isn't only your own, while we struggle to find
> the common factor to put into the killfile recipe.
Thats not my problem. ^
LOL how predictable of you folk. Got no balls to ACTUALLY address the
issue, but like your fellow colleges you barely have enough brains to
snap a short smartass reply. This is exactly the smoldering rudeness
that IS THE ISSUE. If you would look past your incredibly shriveled
penis and attempt to accumulate some more brain cells, you would at
least acknowledge the problem, since it is a fact that there is, or just
be silent about it since you have ZERO to offer anyways. Your kill file
will not silence this overall truth, much less myself.
If you are too feeble minded to accept the truth then don't bother even
posting. I doubt anyone really even cares you figured out how to abuse
your killfile. It's something that runs ramped on Usenet anyways, so
nothing new.
and if you had aforementioned brain capacity, you'd even acknowledge
that the changing of the groups name way back (comp.lang.perl to
comp.lang.perl.misc as stated by the charter for the ladder) is largely
responsible for all the side Perl questions, such as CGI questions and
other things sometimes considered relating to Perl.
but you don't care right? No balls to even address the issue? In fact, I
have a neutered cat that has more balls then the likes of you.
------------------------------
Date: 07 Oct 2002 16:42:27 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Convert Perl script to C program (and Why was this group's name changed?)
Message-Id: <m3r8f2vv4c.fsf@mumonkan.sunstarsys.com>
"MrFFrreeddoo" <mapSoN.S.S@oderF> writes:
> > On Oct 7, -F-r-e-d-o- inscribed on the eternal scroll:
[...]
> > I will no longer drop to rock bottom level to deal with the few like
> > Tad who while being helpful every now and then soil that with
> > arrgance and sheer rudeness.
OK, start the clock!
> > "Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
> > news:Pine.LNX.4.40.0210071851000.10879-100000@lxplus075.cern.ch...
> > The time you're wasting isn't only your own, while we struggle to
> > find the common factor to put into the killfile recipe.
> Thats not my problem. ^
Hmm, a clue?
[... tick tick tick ... boom!]
> but you don't care right? No balls to even address the issue? In fact,
> I have a neutered cat that has more balls then the likes of you.
Aha- *now* I get it! You are not a hypocrite. No, actually
you are very clever- by successfully killfiling *yourself*,
you have succeeded where countless others have failed.
Congratulations! That's quite an accomplishment.
--
Joe Schaefer "This is the way the world ends
Not with a bang but a whimper"
-- T S Eliot
------------------------------
Date: Mon, 7 Oct 2002 14:10:23 -0400
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: Dealing with database problems gracefully?
Message-Id: <jVednV_FK6OqUzygXTWcoQ@News.GigaNews.Com>
"Simon Harvey" <ReplyToGroup@thanks.com> wrote in message
news:iaWn9.3609$Fv2.284616@wards...
> Anyway, sorry about the rant. I do actaully have a question. I know a
little
> bit about eval and was wondering if I should put my database related calls
> (such as making the initial connection and executing statements etc)
within
> eval blocks?
In general, you can do things: use eval { } blocks in conjunction with the
RaiseError flag, in which you have to do something like:
$dbh->{RaiseError} = 1;
eval {
$dbh->do("BLAH BLAH BLAH");
};
if ($@) {
# handle error based on contents of $@
}
Or you can use return values
if (not $dbh->do("BLAH BLAH")) {
# handle error based on DBI->errstr
}
If you are making many database calls in a row and have transaction
capability, the eval { } method makes sense. If you are using it for just
quick database operations without transactions, then checking return values
is probably adequate. It really just depends on what your design goals are.
The same thing is true for creating the the connection in the first place -
search for RaiseError and PrintError in the DBI docs.
--Ben Kennedy
------------------------------
Date: Mon, 7 Oct 2002 19:20:15 +0100
From: "Simon Harvey" <ReplyToGroup@thanks.com>
Subject: Re: Dealing with database problems gracefully?
Message-Id: <Ofko9.87$3U3.4033@wards>
Thanks kindly all
Simon
------------------------------
Date: Wed, 2 Oct 2002 09:26:03 +0100
From: "Nigel Goldsmith" <nigel@bannockfarm.freeserve.co.uk>
Subject: Re: File::Copy from NT to Unix using UNC
Message-Id: <ansus9$ocf$1@news8.svr.pol.co.uk>
NFS access from windows can be done by something like the Maestro suite from
Humming Bird, works pretty well.
Nigel
"Darin McBride" <darin@naboo.to.org.no.spam.for.me> wrote in message
news:ubsn9.453208$v53.20190727@news3.calgary.shaw.ca...
> David L. Adams wrote:
>
> > Can I use File::Copy with a UNC to copy files from the local NT server
> > (where the script is running) to a Unix server?
>
> Yes, if you've set up samba (or equivalent) on the unix server.
>
> > I have successfully written a Perl script (running on NT) using
> > File::Copy to distribute updated sets of files from the local NT
> > development server to multiple NT production servers. I am using UNC
> > naming for the destinations so that I am not dependant on drive letter
> > mappings. I would like to also copy the files to Unix servers with
> > this same script. In the script, I have one array that is a list of
> > the files to be distributed and another array that is a list of the
> > destination servers. I want to be able to mix NT and Unix servers in
> > the list. I have tried using destination UNC syntax for the Unix
> > systems like //servername/user/file or //servername/~user/file or
> > //ipaddress/user/file but the copy command always returns the error
> > "No such file or directory" even though they do exist. I am only
> > marginally familiar with Unix.
> >
> > If the final answer is NO, what is the best way for a Perl script to
> > copy a file from an NT system to a Unix system? I hope it's not rcp,
> > which I'm using now and have been told to stop using.
>
> rcp is marginally more secure than UNCs, so I'm not sure what your
> sysadmins (I'm assuming) are complaining about.
>
> Another way is to use Net::FTP (most unixes need little work, if any,
> to get their ftp daemon running). However, this requires embedding a
> password in your script, or somewhere that your script can get at it.
>
> Yet another way is to find some sort of NFS client for Windows. I'm
> assuming they exist - I've only used NFS clients on Unix and OS/2.
> File::Copy will work transparently here.
>
> Perhaps you could write a CGI script to run on the Unix machine that
> would receive files, and you could use one of the LWP modules to send
> your files with appropriate placement information. This assumes you
> have a web server running on the unix machine.
>
> Finally, if all else fails, you may be able to write your own "special"
> rcp server that you might be able to get away with. Write a perl
> daemon on the unix machine that listens to requests, and can receive
> files. Obviously the most work, and it isn't likely to be as good or
> secure as rcp, but because it won't be rcp, your sysadmins might not
> complain.
>
> As you can see, with tcp/ip, there are many, many ways of skinning this
> cat, depending on your skill, time, and requirements.
>
> --
> To reply, please remove the obvious spam filter
------------------------------
Date: Mon, 7 Oct 2002 18:23:25 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: Help me understand *foo = \...
Message-Id: <ansjet$o23$1@reader1.panix.com>
I've read all the relevant parts in the Camel book (I think), but I'm
still very confused by Perl expressions such as:
*xyz = [1, 2, 3];
Is *xyz a global variable? How does the effect of above line differ
from that of
our @xyz = (1, 2, 3);
? Why does
our *xyz;
produce an error? Is it because "our" is redundant in this case?
On p. 249, the Camel book says:
...typeglob references can't be passed back out of the scope of a
localized typeglob.
I can't quite understand this. I thought it meant that the following
code would result in an error:
use strict;
my $f = &foo();
sub foo {
local *f;
return \*f;
}
...but it doesn't. (Not that I would have any idea of what I could do
with a variable holding \*f).
Any light that you may shed on the above confusion would be much
appreciated.
Thanks,
h
------------------------------
Date: Mon, 07 Oct 2002 15:38:03 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Help me understand *foo = \...
Message-Id: <ansrag$t602@onews.collins.rockwell.com>
On 10/7/02 1:23 PM, Da Witch wrote:
>
> I've read all the relevant parts in the Camel book (I think), but I'm
> still very confused by Perl expressions such as:
>
> *xyz = [1, 2, 3];
>
> Is *xyz a global variable?
Sort of. It's a typeglob, which acts as a container for multiple
(global) variables. *xyz holds $xyz, @xyz, and %xyz (as well as some
other stuff we won't worry about right now). See the "Typeglobs and
Filehandles" section of the perldata manpage and the "Symbol Tables"
section of the perlmod manpage.
> How does the effect of above line differ from that of
>
> our @xyz = (1, 2, 3);
Subtly. The first assigns to the ARRAY slot of the *xyz glob in the
main:: package. our() has lexical scoping semantics, so the latter
assigns to the ARRAY slot of the *xyz glob in the current package, which
may or may not be main::.
> ? Why does
>
> our *xyz;
>
> produce an error? Is it because "our" is redundant in this case?
No, it's a syntax error. our() can't be used to declare a typeglob. You
don't declare typeglobs at all (well, sometimes via local(), but that's
a different creature altogether.)
> On p. 249, the Camel book says:
>
> ...typeglob references can't be passed back out of the scope of a
> localized typeglob.
>
> I can't quite understand this. I thought it meant that the following
> code would result in an error:
>
> use strict;
> my $f = &foo();
> sub foo {
> local *f;
> return \*f;
> }
>
> ...but it doesn't.
The error is one of logic one, not syntax:
#!/usr/bin/perl
use strict;
use warnings;
no warnings 'once';
use Data::Dumper;
*f = *a;
my $f = foo();
print Dumper $f;
sub foo {
local *f = *b;
return \*f;
}
__END__
$VAR1 = \*::a;
So $f does contain a reference to *f, but once we leave the scope of
foo() the localized value of *f (as an alias for *b) dissapears, and it
becomes an alias for *a again.
-mjc
------------------------------
Date: Mon, 07 Oct 2002 21:50:47 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@dformosa.zeta.org.au>
Subject: Re: need help with regular expressions and not matching
Message-Id: <slrnaq40k3.j8p.dformosa@dformosa.zeta.org.au>
On 7 Oct 2002 20:53:52 GMT, :crp: <chips@eskimo.com> wrote:
> Hi,
> I am trying to find all lines that have the word "with" but do not have ";"
> anywhere on the line after it.
> I tried :
> with .*[^;]
> but that did not work.
Try
with [^;]*$
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
------------------------------
Date: 7 Oct 2002 13:35:36 -0700
From: leemur@uclink4.berkeley.edu (Stanley Lee)
Subject: needleman-wunsch alignment
Message-Id: <65c70263.0210071235.2df308ee@posting.google.com>
hi im new to perl. i am trying to implement a needlman-wunsch
alignment algorithm. where the script takes 2 sequences, constructs a
scoring matrix, iterates through it to determine prime alignment and
then prints it out. first step constructs a 1-0 matrix with 1 assigned
to wherever the sequences match. second step iterates through matrix
backwards to add up the max from each previous adjacent row and
column. now i must iterate thru the matrix again to grab the index of
the max of each row i encounter as i go from top left corner to lower
right hand corner. this i have trouble with. given a matrix, does
anyone have any code to grab the indices and print out the
corresponding alignment string of the sequences? see here for details
: http://helix.biology.mcmaster.ca/721/align.html
thanks for the help! stanley.
------------------------------
Date: Mon, 7 Oct 2002 13:24:05 -0500
From: "Jerry Preston" <g-preston1@ti.com>
Subject: Re: net::pop3 problem
Message-Id: <ansjg5$ade$1@tilde.itg.ti.com>
OK!
Here is the complete script that I copied from the web:
#!/usr/local/bin/perl
#===============================
# How to read email with Net::POP3
# Copyright 2000, Emmie P. Lewis
# Created 02/27/00
#===============================
# This script is designed to show
# how to use Net::POP3 to read your
# email from a Perl script.
#===============================
use strict;
print "Content-type: text/plain", "\n\n";
use Net::POP3;
# This debug flag will print debugging code to your browser, depending on
its value
# Set this to 1 to send debug code to your browser. Set it to 0 to turn it
off.
my $DEBUG = 1;
if($DEBUG)
{
$| = 1;
open(STDERR, ">&STDOUT");
}
# Set this variable to your POP3 server name
my $ServerName = "mail.it.com";
# Create a new POP3 object
my $pop3 = Net::POP3->new( $ServerName, Debug => 1 );
# If you can't connect, don't proceed with the rest of the script
die "Couldn't log on to server" unless $pop3;
# Initiate the mail transaction
my $UserName = "myname";
my $Password = "password";
my $Num_Messages = $pop3->login($UserName, $Password);
# Get the list of messages
my $Messages;
my $msg_id;
$Messages = $pop3->list();
# Parse each message header for "From" and "Subject" fields
foreach $msg_id (keys(%$Messages))
{
my $MsgContent = $pop3->top($msg_id, 20);
PrintList(@$MsgContent);
}
# Close the connection
$pop3->quit();
# This subroutine parses the "From" and "Subject" fields of a message header
sub PrintList
{
# Assign parameter to a local variable
my (@lines) = @_;
# Declare local variables
my ($from, $line, $subject);
# Check each line in the header
foreach $line (@lines)
{
if($line =~ m/^From: (.*)/)
{
# We found the "From" field, so let's get what we need
$from = $1;
$from =~ s/\"|<.*>//g;
$from = substr($from, 0, 39);
}
elsif( $line =~ m/^Subject: (.*)/)
{
# We found the "Subject" field, so let's get what we need
$subject = $1;
$subject = substr($subject, 0, 29);
}
# If we have parsed the "From" and "Subject" field, then we don't need
# to keep on going. Let's quit the loop here.
last if( defined($subject) && defined($from) );
}
# Print the result
printf "From: %-40s Subject: %s\n", $from, $subject;
}# end: PrintList()
I get the error:
"Couldn't log on to server"
This is my first e-mail script to work with and I am lost.
Thanks for your help!
Jerry
<news@roaima.freeserve.co.uk> wrote in message
news:75dsna.5ak.ln@moldev.cmagroup.co.uk...
> Jerry Preston <g-preston1@ti.com> wrote:
> > Hi!
>
> > I am having problem with this code:
>
> [...snip...]
>
> > I get the error:
> > "Couldn't log on to server"
>
> Not from that snippet you don't.
>
> > Any ideas in what I am doing wrong?
>
> Where's the call to log on to the POP3 server? You've missed that vital
> part out of the quoted script.
>
> Chris
> --
> @s=split(//,"Je,\nhn ersloak rcet
thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
> until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
------------------------------
Date: Mon, 07 Oct 2002 19:27:29 GMT
From: Bryan <bryan@akanta.com>
Subject: Perl shortcut question
Message-Id: <3DA1E021.20600@akanta.com>
Hi,
Just out of curiosity, is there any way in perl to modify the following
code:
if ( -e "file1.txt" ) {
# Do something with file1
} elsif ( -e "file2.txt" ) {
# Do something with file2
}
So that it does something more like this:
if ( -e "file1.txt" || -e "file1.txt" ) {
# Do something to existing file
# Maybe some perl special var?
}
I am assuming for this example that file1 OR file2 exists, not both.
Thanks,
Bryan
------------------------------
Date: 07 Oct 2002 20:02:24 GMT
From: ctcgag@hotmail.com
Subject: Re: Perl shortcut question
Message-Id: <20021007160224.290$ir@newsreader.com>
Bryan <bryan@akanta.com> wrote:
> Hi,
>
> Just out of curiosity, is there any way in perl to modify the following
> code:
>
> if ( -e "file1.txt" ) {
> # Do something with file1
> } elsif ( -e "file2.txt" ) {
> # Do something with file2
> }
>
> So that it does something more like this:
>
> if ( -e "file1.txt" || -e "file1.txt" ) {
> # Do something to existing file
> # Maybe some perl special var?
> }
do_something ( (grep -e $_, "file1.txt","file2.txt")[0] || die )
?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service
------------------------------
Date: Mon, 7 Oct 2002 13:03:51 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl shortcut question
Message-Id: <3da1e8a7$1@news.microsoft.com>
Bryan wrote:
> Just out of curiosity, is there any way in perl to modify the
> following code:
>
> if ( -e "file1.txt" ) {
> # Do something with file1
> } elsif ( -e "file2.txt" ) {
> # Do something with file2
> }
>
> So that it does something more like this:
>
> if ( -e "file1.txt" || -e "file1.txt" ) {
> # Do something to existing file
> # Maybe some perl special var?
> }
What about
for ('file1.txt', 'file2.txt', ....) {
if (-e $_) {
#do something with that file
}
}
jue
------------------------------
Date: Mon, 07 Oct 2002 12:54:48 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl shortcut question
Message-Id: <3DA1E688.2060501@vpservices.com>
Bryan wrote:
> if ( -e "file1.txt" || -e "file1.txt" ) {
> # Do something to existing file
> # Maybe some perl special var?
for my $fn(qw(file1.txt file2.txt)) {
next unless -e $fn;
#do something with $fn
}
> I am assuming for this example that file1 OR file2 exists, not both.
Then my example should work. If you have a case where both might exist
and you only want to operate on the first you find, put a "last"
statement at the end of the loop.
--
Jeff
------------------------------
Date: Mon, 7 Oct 2002 21:07:58 +0000 (UTC)
From: Nan Wang <nwang@panix.com>
Subject: Problem with SIG handling on WinNT
Message-Id: <anst3d$rvr$1@reader1.panix.com>
Hi all:
I'm trying to write a script to catch SIG{INT}, the script is as follows:
use strict;
$SIG{INT}=\&handler;
for (;;) {
}
sub handler {
my $sig=shift;
print "Caught SIG$sig\n";
exit 0;
}
When I ran this and press ctrl-c, I got the "Caught SIGINT" message, but also
an messagebox saying, "The exception unknown software exception (0xc0000029)
occurred in the application at location 0x77f893e6." And I get the choice to
terminate it or debug it.
I'm using ActivePerl 5.6.1, build 633, on a Windows NT box.
Has anyone seen anything like this?
Thanks in advance.
------------------------------
Date: Mon, 7 Oct 2002 23:16:28 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Problem with SIG handling on WinNT
Message-Id: <Pine.LNX.4.40.0210072310300.29941-100000@lxplus033.cern.ch>
On Oct 7, Nan Wang inscribed on the eternal scroll:
> sub handler {
> my $sig=shift;
> print "Caught SIG$sig\n";
> exit 0;
> }
perldoc -q SIG
"How do I trap control characters/signals?"
Be warned that very few C libraries are re-entrant.
Therefore, if you attempt to print() in a handler that got
invoked during another stdio operation your internal
structures will likely be in an inconsistent state, and
your program will dump core. You can sometimes avoid this
by using syswrite() instead of print().
Unless you're exceedingly careful, the only safe things to
do inside a signal handler are (1) set a variable and (2)
exit. In the first case, you should only set a variable
in such a way that malloc() is not called (eg, by setting
a variable that already has a value).
and so on. IOW there's very, very, little that you can safely do in a
SIG handler. Basically set a flag and exit, is the recommended
approach. Then in non-interrupted program you notice that the flag
has been set and take alternative action.
> I'm using ActivePerl 5.6.1, build 633, on a Windows NT box.
I can't speak to that specific configuration, but speaking in general
terms: you need to find another way. Hard to say what it is without
knowing your real-world intentions, but I'd recommend careful study of
perlipc, and any Windows-specific documentation that comes with your
package.
------------------------------
Date: Mon, 7 Oct 2002 18:57:53 +0100
From: "Paul Tomlinson" <me@home.com>
Subject: Re: Problems using Http::Date
Message-Id: <ypko9.353$La6.302@news-binary.blueyonder.co.uk>
yeah, i had "use date::format" included aswell. I took that out and my
problem went away.
one more question.
What purpose does "use diagnostics" serve? What functionality does it have
and where should it be used?
RD
"Helgi Briem" <helgi@decode.is> wrote in message
news:3da1b65c.2448277647@news.cis.dfn.de...
> On Mon, 7 Oct 2002 17:00:19 +0100, "Rubber Duck"
> <rubberducky703@hotmail.com> wrote:
>
> >Whenever i include http::date in any of my programs and then proceed to
use
> >it I keep getting this curious error when i start my program via the
command
> >line:
> >
> >Subroutine time2str redefined at C:/Perl/lib/Exporter.pm line 57.
> > Exporter::import('time2str', 'str2time') called at prog1.pl line
7
> > main::BEGIN() called at C:/Perl/site/lib/HTTP/Date.pm line 7
> > require 0 called at C:/Perl/site/lib/HTTP/Date.pm line 7
> >Prototype mismatch: sub main::time2str ($;$$) vs (;$) at
> >C:/Perl/lib/Exporter.pm
> > line 57.
> > Exporter::import('time2str', 'str2time') called at prog1.pl line
7
> > main::BEGIN() called at C:/Perl/site/lib/HTTP/Date.pm line 7
> > require 0 called at C:/Perl/site/lib/HTTP/Date.pm line 7
> >
> >I'm running 2k and the only function of the library i am using is
time2str
> >which i use like such
> >
> > $variable1 = time2str($variable2);
> >
> >Anyone got any ideas on how to get rid of this abrupt error??
>
> You presumably have another module loaded which defines
> a function with the same name, but I am unable to
> replicate your error.
>
> You can make it go away by calling the function with an
> explicit packagename, ie:
> my $variable1 = HTTP::Date::time2str($variable2);
>
> (although I don't much like your choice of variable names.
> That kind of thing will rise up and bite you on the ass in
> the future).
>
> Anyway, apart from a miniscule difference in formatting,
> what does this time2str function offer you that
> localtime($variable2) doesn't?
>
>
> --
> Regards, Helgi Briem
> helgi AT decode DOT is
>
> A: Top posting
> Q: What is the most irritating thing on Usenet?
> - "Gordon" on apihna
------------------------------
Date: Mon, 07 Oct 2002 19:42:10 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: Sending HTML email in Perl
Message-Id: <20021007.194209.1369321801.1006@richg.richg.zync>
In article <2481ff4b.0210070936.399fdbe2@posting.google.com>, "Serge"
<pulsar10@email.com> wrote:
> Hi,
>
> I have a Perl (CGI) script that sends out an email with a form.
> However, when I use sendmail and do stuff like print sendmail "<html
> tags>", all I get in the email are the actual tags. How do I make my
> HTML actually decode? It is only simple HTML, no frames or anything!
> Thanks in advance for your help.
This script assumes you have Mail::Sendmail installed. It uses a
Content-Type header of multipart/alternative and includes a text version
to be friendly to people who don't display html mail in their MUA because
of some ridiculous notion of html mail being insecure or that "it takes
up too much bandwidth". Pah!
#!/usr/bin/perl
use Mail::Sendmail;
use strict;
my ($boundary,$html_email,$text_email,%email);
$boundary = 'allyourbasearebelongtous' . time;
$html_email = qq(<html>
<head><title>Email</title></head>
<body>
Hello world!
</body>
</html>
);
$text_email = qq(Hello world!\n);
%email = ( To => 'you@yours.org',
From => 'me@mine.org',
Subject => 'Hello world',
'MIME-Version' => 1.0,
'Content-type' => "multipart/alternative; boundary=$boundary",
Message =>
qq(--$boundary
Content-type: text/plain; charset=UNKNOWN-8BIT
$text_email
--$boundary
Content-type: text/html; charset=iso-8859-1
$html_email
--$boundary--
)
);
sendmail(%email);
------------------------------
Date: Mon, 07 Oct 2002 21:34:25 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Sending HTML email in Perl
Message-Id: <pkent77tea-FDB94B.22341507102002@news-text.blueyonder.co.uk>
In article <2481ff4b.0210070936.399fdbe2@posting.google.com>,
pulsar10@email.com (Serge) wrote:
> I have a Perl (CGI) script that sends out an email with a form.
> However, when I use sendmail and do stuff like print sendmail "<html
> tags>", all I get in the email are the actual tags. How do I make my
> HTML actually decode? It is only simple HTML, no frames or anything!
> Thanks in advance for your help.
Sendmail isn't a web browser, it just transfers email from one place to
another. If you give sendmail '<html><head><title>...' it will put that
string into the email. There's nothing special about pointy brackets...
it's just a string.
The HTML is decoded, if at all, by the mail user agent of the person who
actually reads your email.
You'll need to look at setting the correct MIME headers for HTML mail,
building the correct MIME body structure and sending that. Also send a
plain text alternative as part of the MIME body unless you know all
recipients' email clients can deal with HTML adequately.
Perl has modules to make sending MIME-compliant email a doddle.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Mon, 07 Oct 2002 21:40:28 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: sendmail and perl
Message-Id: <pkent77tea-065044.22402507102002@news-text.blueyonder.co.uk>
In article <ans7fr$pia$1@sp15at20.hursley.ibm.com>,
"Saket Rungta" <saketrungta@hotmail.com> wrote:
> I modified /etc/aliases as follows:
Most copies of 'aliases' have this, or similar,. in large letters at the
top of the file:
# The program "newaliases" must be run after changing this file.
or the equivalent operation on your system.
> jbench: |/tmp/append.pl
> /tmp/append.pl is as follows:
> open (O, ">>append.out");
..... or die "Couldn't open file: $!";
'append.out' is a relativefilename.
I'm pretty sure that a die() will cause some kind of '50x Mailer Error'
problem which sendmail will pick up and hopefully send email about.
> Nothing seems to happen to append.out. Even though manual invocation of
> script appends the file. If mail is not redirected to perl script, the
Yes, manual invocation almost certainly not as the user that sendmail is
running as. Sendmail may run as one user. You ran the program as a
different user (probably).
So, there are my few ideas on what's wrong.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: 7 Oct 2002 12:42:29 -0700
From: kvnsmnsn@hotmail.com (Kevin Simonson)
Subject: Simple Way to Refer to ARGV Values as a String
Message-Id: <6dfb1603.0210071142.7d6daf97@posting.google.com>
I want to pass a Java program root name to a Perl file, along with the
arguments I want it to execute on. I want to do some processing to
the root name, and then when I'm done I want to execute the Java pro-
gram on the arguments I passed to it. From what I learned in the
class I took ages ago on Perl, it seemed like there was some quick way
to do this last bit, to call a program giving it all the arguments
that I originally passed the Perl file.
I guess one way I could do it would be like this:
#!/usr/bin/perl
if ($#ARGV >= 0)
{ $root = $ARGV[0];
shift @ARGV;
# Do some processing on $root.
$argumentList = join( " ", @ARGV);
# Execute command.
print `java $root $argumentList`;
}
else
{ # Print usage.
}
But it seems like there was a simpler way to concatenate all the argu-
ments into one string. Anybody out there know how to do it? Thanks!
---Kevin Simonson
"Maybe it started as a dream, but doesn't everything?"
from _James and the Giant Peach_
------------------------------
Date: Mon, 7 Oct 2002 13:07:15 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Simple Way to Refer to ARGV Values as a String
Message-Id: <3da1e973$1@news.microsoft.com>
Kevin Simonson wrote:
> I want to pass a Java program root name to a Perl file, along with the
> arguments I want it to execute on. I want to do some processing to
> the root name, and then when I'm done I want to execute the Java pro-
> gram on the arguments I passed to it.
No clue what you are trying to say here.
[...]
> But it seems like there was a simpler way to concatenate all the argu-
> ments into one string. Anybody out there know how to do it? Thanks!
That's easier to answer. Maybe you remember stringification of arrays, like
in the difference between
print @ARGV;
and
print "@ARGV";
jue
------------------------------
Date: Mon, 07 Oct 2002 13:11:58 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Simple Way to Refer to ARGV Values as a String
Message-Id: <3DA1EA8E.90908@vpservices.com>
Kevin Simonson wrote:
> if ($#ARGV >= 0)
> { $root = $ARGV[0];
> shift @ARGV;
>
> # Do some processing on $root.
>
> $argumentList = join( " ", @ARGV);
>
> # Execute command.
>
> print `java $root $argumentList`;
> }
> else
> { # Print usage.
> }
if (@ARGV >0) {
my $root = shift @ARGV;
# do some processing on root
print `$root @ARGV`;
}
else {
# print usage
}
--
Jeff
------------------------------
Date: Wed, 2 Oct 2002 09:22:33 +0100
From: "Nigel Goldsmith" <nigel@bannockfarm.freeserve.co.uk>
Subject: Re: What can I do if I have not got chmop
Message-Id: <ansulo$uk3$1@newsg3.svr.pol.co.uk>
Folks,
Thanks for all your input, I guess I will have to have a look at chop, the
Sun box did not complain to much at that so it should be happy with that
code. Can't really upgrade it as it is a print server first and foremost.
One last thought I had was to use nfs access and run perl 5 from a Windoze
box.
cheers anyway
Nigel
"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:creupu8j9ip2752lbsbc4igmq0oo72q3qp@4ax.com...
> Jürgen Exner wrote:
>
> >Nigel Goldsmith wrote:
> >> Wrote a little bit of code on perl 5 then took it on to an old Sun
> >> box and it did not like chomp, are there any alternatives? I am sure
> >> there are let the code flow!!!
> >
> >Well, you could use chop instead, but it's not as convenient because it
will
> >chop-chop any character, not just newlines.
>
> This will likely do what is wanted:
>
> s/\n$//;
>
> --
> Bart.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 3930
***************************************