[21953] in Perl-Users-Digest
Perl-Users Digest, Issue: 4175 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 26 00:05:55 2002
Date: Mon, 25 Nov 2002 21:05:14 -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, 25 Nov 2002 Volume: 10 Number: 4175
Today's topics:
Re: A little help on a regex expression please <robertbu@hotmail.com>
Abduljalil Abbas Binalshibh: Al Queda will destroy the annihilator-5@erlenstar.demon.co.uk
Re: Already asking for help.. (Walter Roberson)
Re: Already asking for help.. (Walter Roberson)
Re: Already asking for help.. <extendedpartition@NOSPAM.yahoo.com>
Re: Already asking for help.. <nospam@nospam.com>
Re: Already asking for help.. <mgjv@tradingpost.com.au>
Re: Already asking for help.. <krahnj@acm.org>
Re: automatic email anniversay script <itshardtogetone@hotmail.com>
Re: automatic email anniversay script <bwalton@rochester.rr.com>
Basksh Imran Sanni: Al Queda will destroy the infidels annihilator-6@erlenstar.demon.co.uk
Re: Binary vs ascii ??? <bik.mido@tiscalinet.it>
Re: Converting UTF-8 to ISO-8859-1 <bart.lateur@pandora.be>
ftp - forking. <test@test.com>
get slow? if constructing html-page from several html s <ahj6@hotmail.com>
Re: get slow? if constructing html-page from several ht <pkent77tea@yahoo.com.tea>
Help writing simple script <congers@yoeric.com>
Re: Help writing simple script (Damian James)
Re: Help writing simple script <robertbu@hotmail.com>
Re: Help writing simple script <congers@yoeric.com>
Re: Help writing simple script (Tad McClellan)
incomplete Script using MIME::Parser <No_Mail_Address@cox.net>
mozilla & netscape. incapable of CSS word-break ? <ahj6@hotmail.com>
Re: mozilla & netscape. incapable of CSS word-break ? (Jay Tilton)
Re: mozilla & netscape. incapable of CSS word-break ? <ahj6@hotmail.com>
Re: mozilla & netscape. incapable of CSS word-break ? <jeff@vpservices.com>
Re: mozilla & netscape. incapable of CSS word-break ? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Nov 2002 02:07:47 GMT
From: "robertbu" <robertbu@hotmail.com>
Subject: Re: A little help on a regex expression please
Message-Id: <THAE9.30389$mL2.9643@nwrddc01.gnilink.net>
"Jane Doe" <jane.doe@acme.com> wrote in message
news:4415uukh6icmajtcr7f0nf1u3goqhklu22@4ax.com...
> On Mon, 25 Nov 2002 12:58:56 -0600, tadmc@augustmail.com (Tad
> McClellan) wrote:
> >> s/^.*size="4">(<strong>)?(.+)(<\/strong>)?<\/font>/$2/i;
> > ^^
>Thx for the tips. Like I said, I'm almost there, but there's still the
>need to tell Perl to ignore any <strong> and </strong> tags that are
>on some lines.
If you just want to patch up what you have given the input below:
s/^.*size="4">(<strong>)?([^>]+)(<\/strong>)?<\/font><\/p>/$2/i;
Or here is something that might help. Assuming that you don't have any of
the situations listed earlier like tags within comments, this code should
return any text, whitespace trimmed, outside of tags.
use warnings;
use strict;
our $input;
{ local ($/); $input = <DATA>; }
my @output = $input =~ /(?:\s*<[^>]+>\s*)*([^<]+)/g;
foreach (@output) {
print "$_\n";
}
__DATA__
<td align="center" width="50%"><p align="center"><font
color="#0080FF" size="4"><strong>PARIS</strong></font></p>
</td>
</tr>
</table>
</center>
<table border="1" width="496">
<tr>
<td width="75%"><font size="4">123 rue Dupont </font></td>
</tr>
You might also take a look at the Tk based regular expression evaluator
found at http://home.arcor.de/clemens.giegerich/. It helped me a lot when
I was first learning about regular expressions in Perl.
== Rob ==
------------------------------
Date: Mon, 25 Nov 2002 23:11:39 GMT
From: annihilator-5@erlenstar.demon.co.uk
Subject: Abduljalil Abbas Binalshibh: Al Queda will destroy the infidels (next attack on Buy Nothing Day)
Message-Id: <7xu8ut$8ru$3@news.hgc.com.hk>
-----BEGIN xxx SIGNED MESSAGE-----
Abduljalil Abbas Binalshibh, allah be praised, here are your orders:
-----BEGIN xxx MESSAGE-----
Version: 2.6.2i
kLHeDvxOXWkBP0pBYj6oB52Dr+GUH5fYbZut+B3JLxrIGWTltPfaNjM+TRIXgvor
ahWdK0scQGjVIFvnVcEnjSarFjLg7gdekgwBwq9GDy7nn4HpKxcqbo8+cpjRWlFv
nI5JRYPzkEfZjck24Qj0DYkVNrT5+IqPAmgV3v+N0hsaD+/WgXM+DqOjy4cMPRaH
3d2WVEyralVWEG+7RTR4hejzqdNXjxrEH1FPcjtKlQveVYGIai6I0BeUrohBA9qr
o4jQEfEzRHifIe28SKRwzYcRqd/66bdMMWf0WqVMja7vEhDhoL6isfl2H9RzjiOp
7Lg0xc753/fR22Lh4uAmHXOaLm2OxMaGvnlDZMpRwsVmqEfJJF9EJOPuBAnpim4F
ca4xfYfgTLbY7A7pyT68ZNwNp1OWyaLA/ugHVDvu/D2Q7KjnprRfCW==
=hibc
-----END PGP MESSAGE-----
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v0.9.5 (FreeBSD)
Comment: For info see http://www.gnupg.org
DBwFVR4GBlpABNACYAmaCDUQgdY7VHt3/zWmnGFv04BZ/9HMywh0q3/VMdFABXNL
tHNRLAErT18w3x5zrYnUpF7nm0Ayyxaz4k==
=PpaL
-----END PGP SIGNATURE-----
------------------------------
Date: 25 Nov 2002 23:05:58 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Already asking for help..
Message-Id: <aruacm$8f3$1@canopus.cc.umanitoba.ca>
In article <3de2ab9d_1@nntp2.nac.net>,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
:Can someone tell me what is wrong with this code (probably EVERYTHING)?
:Basically, it is not able to determine the remote host name so it always
:fails to connect.
:my @reciever_info = split(/\@/, $recip_info);
:$hostname = $receiver_info[1];
: print "Connecting to remote mail host $hostname...\n";
: my $sock = new IO::Socket::INET(
: PeerAddr =>'$hostname',
: PeerPort => 25,
: Proto => 'tcp');
Well for one thing, you aren't taking into account MX's
(mail exchangers.) You shouldn't be assuming that the recipient's
email domain is a hostname and that that hostname will accept
SMTP connections: you need to do a DNS lookup on the email domain
to find out which machines are willing to handle the SMTP traffic
on behalf of the email domain.
--
Strange but true: there are entire WWW pages devoted to listing
programs designed to obfuscate HTML.
------------------------------
Date: 25 Nov 2002 23:06:58 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Already asking for help..
Message-Id: <aruaei$8f9$1@canopus.cc.umanitoba.ca>
In article <3de2ab9d_1@nntp2.nac.net>,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
:Can someone tell me what is wrong with this code (probably EVERYTHING)?
: my $sock = new IO::Socket::INET(
: PeerAddr =>'$hostname',
: PeerPort => 25,
: Proto => 'tcp');
Wrong quotes. PeerAddr => "$hostname"
Or better yet, PeerAddr => $hostname
--
If a troll and a half can hook a reader and a half in a posting and a half,
how many readers can six trolls hook in six postings?
------------------------------
Date: Mon, 25 Nov 2002 17:16:35 -0600
From: "Extended Partition" <extendedpartition@NOSPAM.yahoo.com>
Subject: Re: Already asking for help..
Message-Id: <3de2b020_1@nntp2.nac.net>
> Well for one thing, you aren't taking into account MX's
> (mail exchangers.) You shouldn't be assuming that the recipient's
> email domain is a hostname and that that hostname will accept
> SMTP connections: you need to do a DNS lookup on the email domain
> to find out which machines are willing to handle the SMTP traffic
> on behalf of the email domain.
Thanks! I will look into the MX records and how to do the lookups.
Anthony
------------------------------
Date: Mon, 25 Nov 2002 16:42:55 -0800
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: Already asking for help..
Message-Id: <3de2c2f0$1_7@nopics.sjc>
"Extended Partition" <extendedpartition@NOSPAM.yahoo.com> wrote in message
news:3de2ab9d_1@nntp2.nac.net...
[snipped]
> PeerAddr =>'$hostname', <= This is why
anything between single quotes is considered a literal string. Here you
tell Perl to connect to a $hostname address which, of course, isn't what you
really mean. Instead, it should be like this PeerAddr => $hostname
BTW, you might want to drop Perl 4 syntax with ampersands (&'s) preceded
function names. It looks noisy!
Something like this works just fine.
connect($host, $port) || catch($error); etc...
------------------------------
Date: Tue, 26 Nov 2002 12:50:46 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Already asking for help..
Message-Id: <slrnau5krm.1rk.mgjv@martien.heliotrope.home>
On Mon, 25 Nov 2002 17:16:35 -0600,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
>> Well for one thing, you aren't taking into account MX's
>> (mail exchangers.) You shouldn't be assuming that the recipient's
>> email domain is a hostname and that that hostname will accept
>> SMTP connections: you need to do a DNS lookup on the email domain
>> to find out which machines are willing to handle the SMTP traffic
>> on behalf of the email domain.
>
> Thanks! I will look into the MX records and how to do the lookups.
You could, of course, look into one of the Mail::* or Mailer::* modules
to send mail. Or maybe use Net::SMTP. No need to do the raw socket
stuff.
Martien
--
|
Martien Verbruggen | You can't have everything, where would you
| put it?
|
------------------------------
Date: Tue, 26 Nov 2002 03:26:52 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Already asking for help..
Message-Id: <3DE2E9E1.D6C4E4FE@acm.org>
Extended Partition wrote:
>
> Can someone tell me what is wrong with this code (probably EVERYTHING)?
> Basically, it is not able to determine the remote host name so it always
> fails to connect. What am I doing wrong? Thanks in advance! -- Anthony
>
> #!usr/bin/perl
use warnings;
use strict;
> use IO::Socket;
>
> my ($recip_info, $from_address, $subject, $hostname, $username, $body);
>
> ($recip_info = $ARGV[0]) || &usage;
> ($from_address = $ARGV[1]) || &usage;
> ($subject = $ARGV[2]) || &usage;
> ($body = $ARGV[3]) || &usage;
usage() unless @ARGV == 4;
my ($recip_info, $from_address, $subject, $body) = @ARGV;
> my @reciever_info = split(/\@/, $recip_info);
> my @sender_info = split(/\@/, $from_address);
>
> $username = $receiver_info[0];
> $hostname = $receiver_info[1];
> $my_username = $sender_info[0];
> $my_hostname = $sender_info[1];
my ($username, $hostname) = split /\@/, $recip_info;
my ($my_username, $my_hostname) = split /\@/, $from_address;
> print "Connecting to remote mail host $hostname...\n";
> my $sock = new IO::Socket::INET(
> PeerAddr =>'$hostname',
PeerAddr => $hostname,
> PeerPort => 25,
> Proto => 'tcp');
> die "Could not initialize socket. Exiting.\n" unless $sock; #This is
> always executed when it fails!!
> print "Connected.\n";
> print "Sending mail...\n";
> &send_mail;
send_mail();
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 26 Nov 2002 09:00:42 +0800
From: "itshardtogetone" <itshardtogetone@hotmail.com>
Subject: Re: automatic email anniversay script
Message-Id: <arugst$4q1$1@mawar.singnet.com.sg>
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3DE17163.80803@rochester.rr.com...
> You'll have to clarify exactly what you mean by "'sending' via my
> homepage".
My homepage = my website .... eg www.free.prohosting.com/mywebsite
So what I want is to have a script in my cgi-bin whereby the "sendmail" will
automatically sent email (from my website) to my "friends" on their wedding
anniversay, birthdays ...... etc.
Currently what I could think of is to have a simple "database (with names,
anniversay dates, messages)" and when the anniversary dates coincides with
the time (of the hosting site), "sendmail" will automatically sent an email
to the receipient.
So probably the script will go something like this :-
if ($anniversary eq $time) {
open DATABASE ..... #blah blah blah
}
The only think I am not too sure is will the script be invoked / activated
by itself without anybody visiting the site at all.
I say so because I've done simple scripts and they are only activated if
someone visit the site .... eg a counter script.
Thanks
------------------------------
Date: Tue, 26 Nov 2002 04:02:06 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: automatic email anniversay script
Message-Id: <3DE2F236.30800@rochester.rr.com>
itshardtogetone wrote:
> "Bob Walton" <bwalton@rochester.rr.com> wrote in message
> news:3DE17163.80803@rochester.rr.com...
>
>>You'll have to clarify exactly what you mean by "'sending' via my
>>homepage".
>>
>
> My homepage = my website .... eg www.free.prohosting.com/mywebsite
>
> So what I want is to have a script in my cgi-bin whereby the "sendmail" will
> automatically sent email (from my website) to my "friends" on their wedding
> anniversay, birthdays ...... etc.
>
> Currently what I could think of is to have a simple "database (with names,
> anniversay dates, messages)" and when the anniversary dates coincides with
> the time (of the hosting site), "sendmail" will automatically sent an email
> to the receipient.
> So probably the script will go something like this :-
> if ($anniversary eq $time) {
> open DATABASE ..... #blah blah blah
> }
>
> The only think I am not too sure is will the script be invoked / activated
> by itself without anybody visiting the site at all.
>
> I say so because I've done simple scripts and they are only activated if
> someone visit the site .... eg a counter script.
...
You are correct that a CGI script will only be invoked when someone
requests it. Thus, a CGI script is not a good choice for invoking such
a script. It should be run on your local computer using cron or crontab
(if you have an OS -- if your OS is braindead, check out Task
Scheduler). But note that all this is off-topic for this newsgroup, in
that it has nothing to do with Perl.
--
Bob Walton
------------------------------
Date: Mon, 25 Nov 2002 22:07:34 GMT
From: annihilator-6@erlenstar.demon.co.uk
Subject: Basksh Imran Sanni: Al Queda will destroy the infidels (next attack on Buy Nothing Day)
Message-Id: <MPG.989aacb2b9fd@news.hgc.com.hk>
-----BEGIN xxx SIGNED MESSAGE-----
Basksh Imran Sanni, allah be praised, here are your orders:
-----BEGIN xxx MESSAGE-----
Version: 2.6.2i
r6YRB9PAqJNVPCwIart/U5m3PTyJILOB3TDznwjscz8YVA5ivd//ur5zsXvGwABC
5YuCpTLUBUPU4H8huxOhqc7bmSzZSgpD4wG2ypxODzsnDZNX03ZDSzAHJY9SeV26
ir7VUzD4x/neWtF0WAZaDn43s3oKMFPMpNYjmA44qvnUo4uBAj41grmz55ueut7j
4kw+IcTCGLD341647ALtRfHMTgJDN5oF5MXBTfL7ixYrRUwf2RfgA/WKnKMIbloG
hRv68op1EQF+gfRQ/ML2CCttfQq+yEO3YOEQ4MlfnUgnsRpY1nV6Dtpu5K3tvAVP
lD5Hp0JeP7RABUY6BMbA8lX+TSAX7Bg/8F8Xlywszida1v2u+3yRNg2tt/nPbREZ
3jmRCjHwhwoUCDspYUDEillcf1wSWTJLfsb4hjrZEJ==
=9wsn
-----END PGP MESSAGE-----
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v0.9.5 (FreeBSD)
Comment: For info see http://www.gnupg.org
/RNhAbdtun/LuJeZhV5KvWWi0zANZwFL5V/Gw0sHQMI6ZaGIJMo5q9WApKQsuMaw
1YD4dbWBJH9ziKJ+y44+PhO5tUUXeF==
=onLy
-----END PGP SIGNATURE-----
------------------------------
Date: Tue, 26 Nov 2002 00:12:34 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Binary vs ascii ???
Message-Id: <4t95uugijctnjgsb7ir3gao1dukrn30ljh@4ax.com>
On Sun, 24 Nov 2002 00:14:21 GMT, Noerd <n_joeller@sharaziilyar.com>
wrote:
>> > I'm not trying
>> > to be a contrarian; I just remember hearing a long time ago from a
>> > genius programmer that with Unix/Linux binary is always better.
I don't doubt what you say, but does the "CR/LF vs CR vs LF" problem
really take a 'genius programmer'?!?
[...]
>Lets say I upload a Perl script using EITHER binary, or ascii. When I SSH
>into my webserver, the script looks identical. But, if I were to guess, I
This may mean almost anything: the script looks identical if viewed
with WHAT?!? My editor is smart enough to manage both line-endings
conventions, and yours? What did you use: cat, cat -A, more, less,
emacs, vi?
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"
------------------------------
Date: Mon, 25 Nov 2002 23:19:25 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Converting UTF-8 to ISO-8859-1
Message-Id: <ghb5uu47659im148g961lulnmg41iirrag@4ax.com>
Francesco Moi wrote:
>Does anybody have any routine/function to convert a string from UTF-8
>to ISO-8859-1 by using Perl?
Yes. What version of Perl? Sadly enough, the best way to do it is
largely dependent on the perl version: Pre-5.6 needs manual conversion,
5.6 has some pack/unpack tricks up its sleeve, and 5.8 allegedly has a
nice conversion module (but I forgot the name... Encode? I think it is).
--
Bart.
------------------------------
Date: Tue, 26 Nov 2002 03:53:40 GMT
From: test <test@test.com>
Subject: ftp - forking.
Message-Id: <8fCE9.117462$WL3.51171@rwcrnsc54>
may be forking is not the right term as i'm just a novice.
i have perl script that transfers a file about 4MB in size
for managing a server farm. it takes about 20 minutes for
the script to generate additional scripts and ftp out the
file.
instead of simply executing this in sequential mannner
i would like to initiate ftp for about 50 boxes and kick
off the new ones as and when the running ones finish.
i have never done this before. so any information as to how
to make this happen is appreciated.
if there are any modules out there in CPAN that can make
my work easier, if you could let me know i will check them out.
thank you for your time.
------------------------------
Date: Tue, 26 Nov 2002 10:41:45 +0900
From: "Hyungjin Ahn" <ahj6@hotmail.com>
Subject: get slow? if constructing html-page from several html source files by perl script.
Message-Id: <arui1c$t96$1@news1.kornet.net>
hi,
Q: I know mod-perl save compiled script images in memory so that as soon as
requested, mod-perl replies fast. What if I compose a per script which opens
several html tag source files and combines them to build one page to show?
Is it cached, either? So, any speed loss or system-resource loss in doing
so?
thanks in advance! -Hyungjin Ahn(ahj6@hotmail.com)
------------------------------
Date: Tue, 26 Nov 2002 02:03:45 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: get slow? if constructing html-page from several html source files by perl script.
Message-Id: <pkent77tea-3C5FEC.02034426112002@news-text.blueyonder.co.uk>
In article <arui1c$t96$1@news1.kornet.net>,
"Hyungjin Ahn" <ahj6@hotmail.com> wrote:
> Q: I know mod-perl save compiled script images in memory so that as soon as
> requested, mod-perl replies fast. What if I compose a per script which opens
> several html tag source files and combines them to build one page to show?
> Is it cached, either? So, any speed loss or system-resource loss in doing
> so?
The files' contents will be cached if you cache them. They will not be
cached if you don't cache them. Mod_perl doesn't _automagically_ cache
anything like that.
The usual way I've seen of caching items in memory under mod_perl is to
use a package global hash inside a module, keyed on the filename. Of
course, beware of letting mod_perl children run forever and
inadvertantly caching your entire filesystem in memory :-) You may want
to profile your code in some way before bothering with file-contents
caching - it might not make any difference, or it might.
[ We /do/ have a really nice caching module at work, but it's just not
quite on CPAN yet :-( ]
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Mon, 25 Nov 2002 21:58:02 -0500
From: "Susan G. Conger" <congers@yoeric.com>
Subject: Help writing simple script
Message-Id: <congers-87F3EE.21580125112002@news.uswest.net>
Hi,
I am new to perl and I need to write a simple script. The script needs
to read the ivtest.vb file and find the # define USE_THIS line. It then
needs to uncomment out this line by removing the #. Then it has to find
the define OLD_USE_THIS and comment out this line by adding a #. Anyone
have any suggestions on how to do this?
Thanks,
Susan
--
============================================================
Susan G. Conger Custom Windows & Macintosh Development
President Web Site Design & Development
YOERIC Corporation Database Design & Development
256 Windy Ridge Road
Chapel Hill, NC 27517
Phone/Fax: (919)542-0071
email: congers@yoeric.com Web: www.yoeric.com
------------------------------
Date: 26 Nov 2002 03:16:58 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Help writing simple script
Message-Id: <slrnau5pta.h30.damian@puma.qimr.edu.au>
On Mon, 25 Nov 2002 21:58:02 -0500, Susan G. Conger said:
>I am new to perl and I need to write a simple script. The script needs
>to read the ivtest.vb file and find the # define USE_THIS line. It then
>needs to uncomment out this line by removing the #. Then it has to find
>the define OLD_USE_THIS and comment out this line by adding a #. Anyone
>have any suggestions on how to do this?
Not a script, but on the command line (on *one* line):
perl -i.bak -ple 's/^# (define USE_THIS)/$1/g;s/^(define OLD_USE_THIS)/# $1/g'
ivtest.vb
See perlrun, perlop and perlre.
HTH
--damian
------------------------------
Date: Tue, 26 Nov 2002 03:27:24 GMT
From: "robertbu" <robertbu@hotmail.com>
Subject: Re: Help writing simple script
Message-Id: <wSBE9.31360$mL2.1785@nwrddc01.gnilink.net>
"Susan G. Conger" <congers@yoeric.com> wrote in message
news:congers-87F3EE.21580125112002@news.uswest.net...
> Hi,
>
> I am new to perl and I need to write a simple script. The script needs
> to read the ivtest.vb file and find the # define USE_THIS line. It then
> needs to uncomment out this line by removing the #. Then it has to find
> the define OLD_USE_THIS and comment out this line by adding a #. Anyone
> have any suggestions on how to do this?
>
> Thanks,
> Susan
>
It takes your file at command line and sends the filtered file to STDOUT.
It would be a bit more work if you want to process the file inpalce.
use strict;
use warnings;
open FILE, $ARGV[0] or die "Could not open file $ARGV[0]: $!\n";
while (<FILE>)
{
s/^#\s*(define USE_THIS.*)/$1/;
s/^(\s*define OLD_USE_THIS.*)/#$1/;
print $_;
}
== Rob ==
------------------------------
Date: Mon, 25 Nov 2002 23:07:45 -0500
From: "Susan G. Conger" <congers@yoeric.com>
Subject: Re: Help writing simple script
Message-Id: <congers-EFDE92.23074525112002@news.uswest.net>
In article <slrnau5pta.h30.damian@puma.qimr.edu.au>,
damian@qimr.edu.au (Damian James) wrote:
> On Mon, 25 Nov 2002 21:58:02 -0500, Susan G. Conger said:
> >I am new to perl and I need to write a simple script. The script needs
> >to read the ivtest.vb file and find the # define USE_THIS line. It then
> >needs to uncomment out this line by removing the #. Then it has to find
> >the define OLD_USE_THIS and comment out this line by adding a #. Anyone
> >have any suggestions on how to do this?
>
> Not a script, but on the command line (on *one* line):
>
> perl -i.bak -ple 's/^# (define USE_THIS)/$1/g;s/^(define OLD_USE_THIS)/#
> $1/g'
> ivtest.vb
>
> See perlrun, perlop and perlre.
>
> HTH
>
> --damian
I tried this but I am still having problems. There are a couple of
things that are different. Basially the comment characters are /* */
not #. So here is what I have in a file that I can call.
#!/usr/bin/perl -pi
s/^//*# define QE_MAC_GCC310*///# define QE_MAC_GCC310$1/g;s/^# define
QE_MAC_CW83_102///*# define QE_MAC_CW83_102*// $1/g;
I think it is upset because the / is something it understands and I am
trying to use it in the search and replace strings. Any help is greatly
appreciated.
Thanks,
Susan
--
============================================================
Susan G. Conger Custom Windows & Macintosh Development
President Web Site Design & Development
YOERIC Corporation Database Design & Development
256 Windy Ridge Road
Chapel Hill, NC 27517
Phone/Fax: (919)542-0071
email: congers@yoeric.com Web: www.yoeric.com
------------------------------
Date: Mon, 25 Nov 2002 22:23:43 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Help writing simple script
Message-Id: <slrnau5tqf.1vk.tadmc@magna.augustmail.com>
Susan G. Conger <congers@yoeric.com> wrote:
> I am new to perl and I need to write a simple script. The script needs
> to read the ivtest.vb file
perldoc -f open
and the "I/O Operators" section in
perldoc perlop
> and find the # define USE_THIS line. It then
> needs to uncomment out this line by removing the #.
perldoc -f s
> Then it has to find
> the define OLD_USE_THIS and comment out this line by adding a #.
perldoc -f s
> Anyone
> have any suggestions on how to do this?
perldoc -q file
"How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 26 Nov 2002 01:47:21 GMT
From: Fred <No_Mail_Address@cox.net>
Subject: incomplete Script using MIME::Parser
Message-Id: <3DE2D2F3.B6332035@cox.net>
Hi there,
I use MIME::Parser to strip HTML-content from multipart/alternative
mail messages. The script works as expected on messages w/o special
characters (charset=us-ascii).
In Messages with special characters with headerlines like
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
The script changes headerlines to
Content-Type: text/plain
Content-Transfer-Encoding: binary
but quoted-printable characters in the body are not decoded, making
the messages unusable in mail-readers.
Any suggestions what I could try?
--- Fred
#!/usr/bin/perl -w
use strict;
$|++ ; # unbuffers standard output
use MIME::Parser ;
use MIME::Entity ;
my $infile = shift ;
my $logfile = shift ;
open (STDIN, "< $infile") or die "cannot open $infile: $! \n" ;
open (STDOUT, "> $logfile") or die "Could not open $logfile for
writing: $!\n";
my $parser = MIME::Parser->new;
$parser->output_to_core(1) ;
$parser->tmp_to_core(1) ;
my $ent = $parser->parse(\*STDIN) ;
if ($ent->effective_type eq "multipart/alternative"
and $ent->parts == 2
and $ent->parts(0)->effective_type eq "text/plain"
and $ent->parts(1)->effective_type eq "text/html") {
my $newent = MIME::Entity->build(Data =>
$ent->parts(0)->body_as_string ."\n");
$ent->parts([$newent]);
$ent->make_singlepart;
$ent->sync_headers(Length => 'COMPUTE' ,Nonstandard => 'ERASE' );
print "From - [Converted to text/plain]\n" ;
$ent->print;
}
close (STDOUT) or die "could not close STDOUT: $!";
close (STDIN) or die "could not close STDIN: $!";
------------------------------
Date: Tue, 26 Nov 2002 08:06:17 +0900
From: "Hyungjin Ahn" <ahj6@hotmail.com>
Subject: mozilla & netscape. incapable of CSS word-break ?
Message-Id: <aru8tt$bmm$1@news1.kornet.net>
in <table> tag, style="word-break:break-all;" command doesn't work in
mozilla & netscape. what's wrong?
any solution for this? -Hyungjin Ahn(ahj6@hotmail.com)
(ps: I tried the following:
use utf8;
#$title =~ s/([^\s]{30})/$1 /g; # comment7
$title =~
s/([^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\
s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s
][^\s][^\s][^\s][^\s][^\s][^\s][^\s][^\s])/$1 /ig; #comment8
no utf8;
as you see, it's failed when I use #comment7 rather than #comment8.
thanks in advance!
------------------------------
Date: Tue, 26 Nov 2002 00:39:56 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: mozilla & netscape. incapable of CSS word-break ?
Message-Id: <3de2c0b4.109217459@news.erols.com>
"Hyungjin Ahn" <ahj6@hotmail.com> wrote:
: in <table> tag, style="word-break:break-all;" command doesn't work in
: mozilla & netscape.
Why would it? It only exists for IE.
: any solution for this?
Don't use properties that aren't in the CSS specification.
Of course, CSS and browser-specific behaviors have nothing to do with
Perl.
------------------------------
Date: Tue, 26 Nov 2002 10:43:06 +0900
From: "Hyungjin Ahn" <ahj6@hotmail.com>
Subject: Re: mozilla & netscape. incapable of CSS word-break ?
Message-Id: <arui3t$s$1@news1.kornet.net>
thanks for your good information..
they do have something to do with perl, though I didn't question "any perl
script for this?". -Hyungjin Ahn(ahj6@hotmail.com)
"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3de2c0b4.109217459@news.erols.com...
> "Hyungjin Ahn" <ahj6@hotmail.com> wrote:
>
> : in <table> tag, style="word-break:break-all;" command doesn't work in
> : mozilla & netscape.
>
> Why would it? It only exists for IE.
>
> : any solution for this?
>
> Don't use properties that aren't in the CSS specification.
>
> Of course, CSS and browser-specific behaviors have nothing to do with
> Perl.
>
------------------------------
Date: Mon, 25 Nov 2002 18:09:50 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: mozilla & netscape. incapable of CSS word-break ?
Message-Id: <3DE2D7EE.4050802@vpservices.com>
Hyungjin Ahn wrote:
> thanks for your good information..
[which you topposted out of the conversation]
> they do have something to do with perl
No it doesn't.
--
Jeff
------------------------------
Date: Mon, 25 Nov 2002 22:27:44 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: mozilla & netscape. incapable of CSS word-break ?
Message-Id: <slrnau5u20.1vk.tadmc@magna.augustmail.com>
Hyungjin Ahn <ahj6@hotmail.com> wrote TOFU:
> "Jay Tilton" <tiltonj@erols.com> wrote in message
> news:3de2c0b4.109217459@news.erols.com...
>> "Hyungjin Ahn" <ahj6@hotmail.com> wrote:
>>
>> : in <table> tag, style="word-break:break-all;" command doesn't work in
>> : mozilla & netscape.
>>
>> Why would it? It only exists for IE.
>> Of course, CSS and browser-specific behaviors have nothing to do with
>> Perl.
> they do have something to do with perl,
They do NOT have something to do with perl (nor with Perl).
If you switched to writing your programs in Java, then the
above would _still_ be true.
It can't be "about Perl" if switching to something other
than Perl changes nothing.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 4175
***************************************