[27344] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9052 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 14 18:06:01 2006

Date: Tue, 14 Mar 2006 15:05:08 -0800 (PST)
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, 14 Mar 2006     Volume: 10 Number: 9052

Today's topics:
    Re: A Problem With GD <abigail@abigail.nl>
    Re: Creating Graphs Dynamically with Perl <abigail@abigail.nl>
        Great JAPH (was Re: Creating Graphs Dynamically with Pe <1usa@llenroc.ude.invalid>
    Re: MAIL code error hope@hope.com
    Re: MAIL code error <1usa@llenroc.ude.invalid>
    Re: Native Cut&Paste on Win*: CON: buggy? <nospam-abuse@ilyaz.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 14 Mar 2006 20:45:58 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: A Problem With GD
Message-Id: <slrne1eas6.1v0.abigail@alexandra.abigail.nl>

Mark Manning (markem@airmail.net) wrote on MMMMDLXXVIII September
MCMXCIII in <URL:news:121e4203g00m77f@corp.supernews.com>:
??  Abigail wrote:
?? <code snipped for space>
??  
??  I added in a new line which reads "$v = ++$v % 2" and the results are:

But since '$v = ++$v % 2' modifies $v twice in the same statement, the
fact it toggles $v is just happistance, and there's no garantee it will
work on every platform, or on a next version of Perl.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


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

Date: 14 Mar 2006 20:53:11 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Creating Graphs Dynamically with Perl
Message-Id: <slrne1eb9n.1v0.abigail@alexandra.abigail.nl>

Kraven (kraven@not-here.org) wrote on MMMMDLXXVII September MCMXCIII in
<URL:news:7dnRf.53773$H71.44453@newssvr13.news.prodigy.com>:
,, > -:  You mean a pipe like
,, > -:  
,, > -:  #!/usr/bin/perl -w
,, > -:  use strict;
,, > -:  my $somefile = "/path/to/somefile";
,, > -:  my $pid = open Apipe, "| cat $somefile|less";
,, > -:  close(Apipe);
,, > -:  	
,, > -:  but surely not...
,, > -:  
,, > -:  system("cat $somefile|less");
,, > 
,, > 
,, > Those are different types of pipes?
,, > 
,, > 
,, > Abigail
,,  
,,  
,,  Yes, piping from inside PERL.


Actually, all three pipes you have there are between different 
programs. I still think all the pipes are the same.


,,                                 It can get way more complicated with the 
,,  $pid version.

The $pid version of what? 

,,                 Basically you can run other programs from within perl 
,,  with open, system, exec, `....`, or glob.


Actually, you can't run another program "within perl" using 'exec', as
'exec' *replaces* the current program with another. 


Abigail
-- 
#!/opt/perl/bin/perl   --    # No trailing newline after the last line!    
BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_ 
,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ


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

Date: Tue, 14 Mar 2006 21:05:53 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Great JAPH (was Re: Creating Graphs Dynamically with Perl)
Message-Id: <Xns9786A3DF67849asu1cornelledu@127.0.0.1>

Abigail <abigail@abigail.nl> wrote in
news:slrne1eb9n.1v0.abigail@alexandra.abigail.nl: 

> #!/opt/perl/bin/perl   --    # No trailing newline after the last line!
> BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
> ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ 

This is an amazing JAPH. Very instructive.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Tue, 14 Mar 2006 22:38:40 GMT
From: hope@hope.com
Subject: Re: MAIL code error
Message-Id: <sfhe125qtd7efu9dc7a7omr1e5ur2kh5q6@4ax.com>

Hi Sinan



>hope@hope.com wrote in news:flud121066op0o18unb6hps2gbccb12p3v@4ax.com:
>
>> =========================
>> Bareword found where operator expected at test.cgi line 560, near
>> "&o_0 MAIL" 
>>      (Missing operator before MAIL?)
>> syntax error at test.cgi line 560, near "&o_0 MAIL"
>> Execution of test.cgi aborted due to compilation errors.
>> ============================
>> 
>> I cannot find the ref to near "&o_0 MAIL" at all 

On Tue, 14 Mar 2006 17:50:06 GMT, "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:

>
>Not surprising.
>
>> this is what is in line 560
>> 
>> line 560 
>> 
>>   open MAIL, "|$config{'mailprog'}";
>
>What is in $config{mailprog}?
>
>>   print MAIL "To: $to\nFrom: $from\nSubject: $subject\n$message\n";
>>   close MAIL;
>
>...
>
>> SO what have I got wrong please
>
>You have not posted a short, complete, self-contained program that 
>others can run easily.
>
>Please consult the posting guidelines for information on not only how 
>you can help yourself, but also help others help you.
>
>Sinan

Ok sorry here is the part of the mail script


Code start


sub sendemail {
        my ($to,$from,$subject,$message) = @_;
        my $trash;
        if ($config{'mailhost'}) {
		eval('use IO::Socket; 1;') or &oops("IO::Socket could not be loaded by the
script. Perl version $].  IO::Socket may not be included with versions of perl prior to
5.00404.");
                my $remote;
                $remote = IO::Socket::INET->new("$config{'mailhost'}:smtp(25)");
                $remote->autoflush();
                print $remote "HELO\r\n";
                $trash = <$remote>;
                print $remote "MAIL From:<$config{'admin_address'}>\r\n";
                $trash = <$remote>;
                print $remote "RCPT To:<$to>\r\n";
                $trash = <$remote>;
                print $remote "DATA\r\n";
                $trash = <$remote>;
                print $remote "From: <$from>\r\nSubject: $subject\r\n\r\n";
                print $remote $message;
                print $remote "\r\n.\r\n";
                $trash = <$remote>;
                print $remote "QUIT\r\n";
        }
        else {
		       ## open(MAIL,"|$config{'mailprog'}"); 
                open (MAIL, "|$config{'mailprog'}");
                print MAIL "To: $to\nFrom: $from\nSubject: $subject\n$message\n";
                close MAIL;
        }
code end

Hope this is better

Thank you




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

Date: Tue, 14 Mar 2006 23:01:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: MAIL code error
Message-Id: <Xns9786B76EC4B53asu1cornelledu@127.0.0.1>

hope@hope.com wrote in news:sfhe125qtd7efu9dc7a7omr1e5ur2kh5q6@4ax.com:

> On Tue, 14 Mar 2006 17:50:06 GMT, "A. Sinan Unur"
> <1usa@llenroc.ude.invalid> wrote: 

>>hope@hope.com wrote in
>>news:flud121066op0o18unb6hps2gbccb12p3v@4ax.com: 
>>
>>> =========================
>>> Bareword found where operator expected at test.cgi line 560, near
>>> "&o_0 MAIL" 
>>>      (Missing operator before MAIL?)
>>> syntax error at test.cgi line 560, near "&o_0 MAIL"
>>> Execution of test.cgi aborted due to compilation errors.
>>> ============================
>>> 
>>> I cannot find the ref to near "&o_0 MAIL" at all 
 ...

>>>   open MAIL, "|$config{'mailprog'}";
>>
>>What is in $config{mailprog}?
>>
>>>   print MAIL "To: $to\nFrom: $from\nSubject: $subject\n$message\n";
>>>   close MAIL;
>>
>>...
>>
>>> SO what have I got wrong please
>>
>>You have not posted a short, complete, self-contained program that 
>>others can run easily.
>
> Ok sorry here is the part of the mail script
> 

You still have not posted such a program.

Let me just frankly state that I cannot comprehend why anyone would 
actually write stuff like this.

I mean, if you really are into SMTP, there is Net::SMTP.

On the other hand, if you just want send email, there is a FAQ entry on 
this, as well as a bazillion messages in this groups archives showing 
you how to do it using well written modules.

> sub sendemail {
>         my ($to,$from,$subject,$message) = @_;
>         my $trash;
>         if ($config{'mailhost'}) {

You still have not shown what is in $config{mailhost}?

>           eval('use IO::Socket; 1;') or &oops("IO::Socket could not be
>           loaded by the script. Perl version $].  IO::Socket may not 
> be included with versions
> of perl prior to 5.00404.");

Why string eval for use? What advantage does the above have over a 
simple:

eval {
    require IO::Socket;
} or oops("some message");

By the way, if you do not know the difference between &oops("message") 
versus oops("message"), you should use the latter. See perldoc perlsub.

>                 print $remote "HELO\r\n";
>                 $trash = <$remote>;
>                 print $remote "MAIL
>                 From:<$config{'admin_address'}>\r\n"; 

Again, I don't find it very productive to try to speak SMTP.

>         else {
>                  ## open(MAIL,"|$config{'mailprog'}"); 
>                 open (MAIL, "|$config{'mailprog'}");

Again, what is in $config{mailprog}???

At the very least, you can use the three-argument form of open with a 
lexical filehandle, and report any errors.

> Hope this is better

Not really.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Tue, 14 Mar 2006 22:39:24 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Native Cut&Paste on Win*: CON: buggy?
Message-Id: <dv7gms$k4a$1@agate.berkeley.edu>

[A complimentary Cc of this posting was NOT [per weedlist] sent to
Ilya Zakharevich 
<nospam-abuse@ilyaz.org>], who wrote in article <dust2a$8l4$1@agate.berkeley.edu>:
> > SetConsoleMode failed, LastError=|6| at 
> > C:/opt/Perl/site/lib/Term/ReadKey.pm line 265.

> As Adam Kennedy informed me, this may be not a bug in Perl
> installation, but a bug in the Windows device driver for 'CON:'.

I would appreciate tests of the latest version 1.0208 of
Term::ReadLine::Perl on Win*.  It should have a workaround for this
bug.  (Best if the test are run with unpatched Term::ReadLine.)

[I already know about the "multiple Enter presses" required syndrom.]

Thanks,
Ilya


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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