[26724] in Perl-Users-Digest
Perl-Users Digest, Issue: 8817 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 2 06:05:24 2006
Date: Mon, 2 Jan 2006 03:05:05 -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 Mon, 2 Jan 2006 Volume: 10 Number: 8817
Today's topics:
CGI/sendmail help <ves@ves.net>
Increment Numbers <cjellison@ucdavis.edu>
Re: My Regexp XML Parser -> Structured Perl Data, Cut <matthew.garrish@sympatico.ca>
regexp: ignoring nested brackets (Kaveh)
Re: regexp: ignoring nested brackets <abigail@abigail.nl>
Shebang not working <scarmalt@swconsult.ch>
Re: Shebang not working <pertti.kosunen@pp.nic.fi>
Re: Shebang not working <jari.jokinen@iki.fi>
Re: Shebang not working <no@email.com>
Re: Shebang not working <no@email.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Jan 2006 08:01:16 GMT
From: Vespasian <ves@ves.net>
Subject: CGI/sendmail help
Message-Id: <e7nhr190f8foamjhpgl9gdfhbpc9rqrb67@4ax.com>
The first open MAIL always sends an email. The second does not. If
fact, I got a failure notice from the second one with the following
error,
<keepitsimple222@yahoo.com@host428.ipowerweb.com>:
Sorry, no mailbox here by that name. (#5.1.1)
It seems the the second MAIL wants to append '@host428.ipowerweb.com'
Maybe not
Any ideas?
ves
# Code
use CGI;
my $query = new CGI;
my $content = "Thanks for your submission.\r\n";
my $email = $query->param('send_to');
$email =~ s/\@/\\\@/;
my $from = "From: ss.net 1\n";
my $to = "To: $email\n";
my $subject = "Subject: Reservation request\n\n";
my $sendmail = "/usr/sbin/sendmail -t -f \'$email\'";
my $file = "logfile.txt";
#open (LOG, ">>$file") or print "Cannot open $file: $!";
#print LOG $to,"\n";
#close(LOG);
print "Content-type: text/html\n\n";
print $sendmail,"<br>";
print $from;
print $to;
print $subject;
$|=1;
if (1) {
open (MAIL, "| /usr/sbin/sendmail -t -f
\'keepitsimple222\@yahoo.com\'") || print "Opening sendmail failed:
$!";
print MAIL "From: tester\@1testdomain.com\r\n";
print MAIL "To: keepitsimple222\@yahoo.com\r\n";
print MAIL "Subject: old code 6\r\n";
print MAIL "Hi there. This script sure works great on UNIX, doesn't
it?\r\n";
close (MAIL);
}
if(1) {
open(MAIL, "| $sendmail") || print "Opening sendmail failed: $!";
print MAIL $from;
print MAIL $to;
print MAIL $subject;
print MAIL $content;
close (MAIL);
}
print "Confirmation of your submission will be emailed to you.\n";
------------------------------
Date: Sun, 01 Jan 2006 18:32:24 -0800
From: Chris Ellison <cjellison@ucdavis.edu>
Subject: Increment Numbers
Message-Id: <dpa3bp$3eb$1@skeeter.ucdavis.edu>
Hi,
"Larry's filename fixer"
------filename: rename-------------
#!/usr/bin/perl -w
# rename - Larry's filename fixer
$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename($was,$_) unless $was eq $_;
}
----------------------------------
I have a bunch of files 001.txt, 002.txt, 055.txt, 099.txt,... and
would like to increment them using the above script.
So, I was thinking something like this:
rename 's/(\d{3})/something/' *
Though, I don't know how to accomplish the "something".
I was thinking that it could be done with backreferencing:
$1+increment
but I don't know how to do operations within a regular expression.
Any suggestions?
------------------------------
Date: Sun, 1 Jan 2006 21:30:02 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: My Regexp XML Parser -> Structured Perl Data, Cut & Paste Version, No Module's (Vol I)
Message-Id: <Fe0uf.376$H37.52279@news20.bellglobal.com>
<robic0> wrote in message news:96qgr1p7h24qb3nlg2ng9698pjhcnld01h@4ax.com...
> On Tue, 20 Dec 2005 23:59:06 -0800, robic0 wrote:
>
> Final edition .904
> This is the last, it will not be continued. Further processing could
> have been done for all tag entities and alot of specialized handling.
> However due to the recent awareness of the latencies involved in regexp
> (re)searches, the "inner" substitution method is not viable in this
> context.
>
> Thats all I will say on this. Content is not examined for xml reserved
> characters (ie: &, etc..), although its easily added. Kind of too bad,
> this method has alot of potential.
>
Well, at least you had the good sense to abandon the sinking ship...
Matt
------------------------------
Date: Mon, 2 Jan 2006 11:03:41 +0530
From: kaveh@delete_this.river-valley.com (Kaveh)
Subject: regexp: ignoring nested brackets
Message-Id: <1h8jakk.gmksfah9xgvcN%kaveh@delete_this.river-valley.com>
I have the following expression:
\mymacro{abcd {abcdgte{asdfSA}ksd} {ASDFD}sdfsd} ;laksjd;lkfajs
I want to grab the first bracket and the matching one at the end,
including any enclosed, correctly neseted brackets. What is the best way
of doing this? Is it possible with one regexp?
--
Kaveh
------------------------------
Date: 02 Jan 2006 09:29:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regexp: ignoring nested brackets
Message-Id: <slrndrhsj3.lcd.abigail@alexandra.abigail.nl>
Kaveh (kaveh@delete_this.river-valley.com) wrote on MMMMDVII September
MCMXCIII in <URL:news:1h8jakk.gmksfah9xgvcN%kaveh@delete_this.river-valley.com>:
;; I have the following expression:
;;
;; \mymacro{abcd {abcdgte{asdfSA}ksd} {ASDFD}sdfsd} ;laksjd;lkfajs
;;
;; I want to grab the first bracket and the matching one at the end,
;; including any enclosed, correctly neseted brackets. What is the best way
;; of doing this? Is it possible with one regexp?
use Regexp::Common;
/$RE{balanced}{-parens => '{}'}/
Abigail
--
print 74.117.115.116.32, 97.110.111.116.104.101.114.32,
80.101.114.108.32, 72.97.99.107.101.114.10;
------------------------------
Date: Mon, 02 Jan 2006 11:06:28 +0100
From: Sam CARMALT <scarmalt@swconsult.ch>
Subject: Shebang not working
Message-Id: <2hthr156j56j53ioc42hcjuq601qdlac09@4ax.com>
I'm having trouble launching a Perl script with the shebang operator.
OS is SuSE 9.2 Professional. So far, I haven't had any helpful
insights at comp.os.linux.suse, and hope this isn't too far from Perl
to post here.
Complete Perl script:
#! /usr/bin/perl
print "Hello, World\n";
This is contained in a file of 3 lines, left-justified, created with
vi. It is saved with a directory entry of
-rwxrwxrwx 1 root root 44 Dec 31 15:32 hworld.pl
In the /usr/bin directory, I find the following entry
-rwxr-wr-w 3 root root 1160321 Oct 2 2004 perl
which leads me to believe that permissions are OK.
Now, here is how things work:
#perl hworld.pl
Hello, World
#hworld.pl
bash: hworld.pl: command not found
#./hworld.pl
bash: ./hworld.pl: /usr/bin/perl: bad interpreter: Permission denied
# ./hworld.pl
bash: ./hworld.pl: /usr/bin/perl: bad interpreter: Permission denied
#. hworld
bash: hworld: No such file or directory
#. hworld.pl
bash: print: command not found
#
From these I conclude that there is something going wrong with the
shebang line and getting started. Any pointers as to what I need to
change will be appreciated. (Obviously, I need to fix this in order
to use Perl in a CGI environment :)].
Thanks and regards,
Sam
------------------------------
Date: Mon, 02 Jan 2006 10:18:09 GMT
From: Pertti Kosunen <pertti.kosunen@pp.nic.fi>
Subject: Re: Shebang not working
Message-Id: <B57uf.70$Rs1.14@read3.inet.fi>
Sam CARMALT wrote:
> Complete Perl script:
>
> #! /usr/bin/perl
Try without space between ! and /.
------------------------------
Date: 02 Jan 2006 10:38:09 GMT
From: "Jari Jokinen" <jari.jokinen@iki.fi>
Subject: Re: Shebang not working
Message-Id: <43b90291$0$17491$7b1e8fa0@news.nbl.fi>
Sam CARMALT <scarmalt@swconsult.ch> wrote:
> #./hworld.pl
> bash: ./hworld.pl: /usr/bin/perl: bad interpreter: Permission denied
Error message above means that you don't have permission to execute Perl
interpreter at /usr/bin/perl. You should give execute permission to user
(for example chmod 755) or run script as root.
Also remember to use -T option when run script as CGI.
--
Jari Jokinen
jari.jokinen@iki.fi
------------------------------
Date: Mon, 02 Jan 2006 10:49:45 +0000
From: Brian Wakem <no@email.com>
Subject: Re: Shebang not working
Message-Id: <41seq9F1f7po4U1@individual.net>
Sam CARMALT wrote:
> I'm having trouble launching a Perl script with the shebang operator.
> OS is SuSE 9.2 Professional. So far, I haven't had any helpful
> insights at comp.os.linux.suse, and hope this isn't too far from Perl
> to post here.
>
> Complete Perl script:
>
> #! /usr/bin/perl
>
> print "Hello, World\n";
>
> This is contained in a file of 3 lines, left-justified, created with
> vi. It is saved with a directory entry of
>
> -rwxrwxrwx 1 root root 44 Dec 31 15:32 hworld.pl
>
> In the /usr/bin directory, I find the following entry
>
> -rwxr-wr-w 3 root root 1160321 Oct 2 2004 perl
Permissions on my perl are different.
-rwxr-xr-x 2 root root 10232 Dec 6 18:16 /usr/bin/perl5.8.6*
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
Date: Mon, 02 Jan 2006 10:50:43 +0000
From: Brian Wakem <no@email.com>
Subject: Re: Shebang not working
Message-Id: <41ses3F1f7po4U2@individual.net>
Pertti Kosunen wrote:
> Sam CARMALT wrote:
>> Complete Perl script:
>>
>> #! /usr/bin/perl
>
> Try without space between ! and /.
I tested this and it works fine with a space on my machine
(MDK10.2,Perl5.8.6).
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
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 8817
***************************************