[18936] in Perl-Users-Digest
Perl-Users Digest, Issue: 1131 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 14 06:05:50 2001
Date: Thu, 14 Jun 2001 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <992513107-v10-i1131@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 14 Jun 2001 Volume: 10 Number: 1131
Today's topics:
Re: a question to programmers. <comdog@panix.com>
Announce: Perl Guru and Author to speak in Toronto <tpm.NOSPAM@to.pm.NOSPAM.org>
Re: ARGV <jurgenex@hotmail.com>
Re: autoload troubles <skilchen@swissonline.ch>
Re: autoload troubles <der.prinz@gmx.net>
Re: better way to break lines of data? <jurgenex@hotmail.com>
Re: better way to break lines of data? <mbudash@sonic.net>
Re: Can an lvalue sub also be an rvalue? <buggs-clpm@splashground.de>
DBI problem (Vulcho Nedelchev)
Re: DBI problem <pne-news-20010613@newton.digitalspace.net>
Re: efficient change file with locking? (Anno Siegel)
Re: How to create a script to emulate a task that can b (Tim Hammerquist)
Re: how to extract URL source with LWP ? (Vulcho Nedelchev)
Re: how to make a perl script run a batch file (isterin)
Re: modules (no, not perl modules) nobull@mail.com
Negative lookahead not working <morgan@hahaha.org>
Re: Negative lookahead not working <peter.sogaard@tjgroup.com>
Re: new to perl need help with concordance <der.prinz@gmx.net>
package, module or ??? <peter.sogaard@tjgroup.com>
Re: package, module or ??? (Anno Siegel)
Re: Removing ^M characters <pne-news-2001064@newton.digitalspace.net>
Re: Sending Attachments Via Sendmail (Villy Kruse)
Re: too late error? (Rafael Garcia-Suarez)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Jun 2001 00:23:00 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: a question to programmers.
Message-Id: <comdog-84C25C.00230014062001@news.panix.com>
In article <9g8mjp0elr@drn.newsguy.com>, thinkit <thinkit8@lycos.com>
wrote:
> In article <comdog-801957.10272913062001@news.panix.com>, brian says...
> >
> >In article <9g5mme04h8@drn.newsguy.com>, thinkit <thinkit8@lycos.com>
> >wrote:
> >>if a language only offered hexadecimal and binary input literals, would you be
> >>more or less likely to utilize it? in a similar line, how much hexadecimal do
> >> you use in the languages you use now? do you count to 16, or to 0x10?
> >i don't think that would make me stop using Smalltalk which allows
> >you to use just about any base that you like. :)
> >but then, you can use hexadecimal and binary literals in Perl too.
> >why use something with less features?
> yes, but you have to use "0x". hexadecimal is subordinate to decimal in perl.
> plus there's no way to deal with hexdecimal floats.
and?
if you only had hexidecimal you would have to have some special notation
for decimal when you wanted decimal (like for currency). so you have
to type two extra characters -- big deal. it all gets stored the same
way behind the scenes no matter which way you type it.
you could certainly fool with source filters to make Perl look like
whatever you want it to look like, even if that look is no look a la
Bleach.pm ;)
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 14 Jun 2001 04:07:56 GMT
From: "TPM" <tpm.NOSPAM@to.pm.NOSPAM.org>
Subject: Announce: Perl Guru and Author to speak in Toronto
Message-Id: <wMWV6.69910$W02.870281@news1.rdc2.on.home.com>
If you are interested in Perl the programming language, and you will be in
Toronto, Ontario, Canada, in mid-June, you may like to know:
Damian Conway will be presenting two lectures in Toronto on June 17th and
June 18th.
These lectures are open to the public.
June 17th (Sunday afternoon): Univerity of Toronto, Sanford Flemming (10
King's College Road).
Room 1105 (aka. The Blue Room, seats 159 )
1500-1730 hours
June 18th (Monday evening): Seneca@York, York University Campus.
Room 1206 (seats 160)
1900-2200 hours
More information, including the subject of the lectures and maps of the
campuses, is available at:
http://to.pm.org/talks.html
Damian is a senior lecturer at Monash University in Australia, is the author
of "Object Oriented Perl", an excellent and noteworthy book
(http://www.manning.com/Conway/), and is currently on sabbatical as the
programmer in residence for the Perl community at large (vide the Conway
channel at http://yetanother.org/damian/). You can visit Damian online at:
http://www.csse.monash.edu.au/~damian/
On behalf of
The Toronto Perl Mongers
------------------------------
Date: Wed, 13 Jun 2001 21:10:00 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: ARGV
Message-Id: <3b28391a$1@news.microsoft.com>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:quvcit4f2v2aaugr62o0auv89d6uq69bki@4ax.com...
> kevin wrote:
>
> >Can someone please explain the purpose of ARGV? ...for instance, what is
> >happening in the following line?
> >
> >$arg = shift(@ARGV);
>
> It conteins the words on the command line.
No! It contains the arguments (from the command line). This can be
individual words, but it can also be multiple words in a single value.
> Commonly, that means, the
> files you want your script to process.
Oh, well, that's a rather narrow view....
[...]
> Note that the command line witches for perl and the script name are
> missing. Also note that the "files" don't even need to exist.
That's because the arguments have nothing to do with files per se. They are
just arguments, nothing more, nothing less.
jue
------------------------------
Date: Thu, 14 Jun 2001 02:16:28 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: autoload troubles
Message-Id: <9g9h95$7v9ir$1@ID-13368.news.dfncis.de>
"Stefan Weiss" <der.prinz@gmx.net> schrieb im Newsbeitrag
news:3b27d39f$1@e-post.inode.at...
>
> I have a module that serves as a wrapper for external function calls.
> The external library has a hash table with references to the subs I
> want executed, but if a subroutine has the same name as a hash key,
> the sub will be executed as a method instead of a simple function.
> This happens only after the method was called (and AUTOLOADed) at
> least once.
>
Your problem has nothing to do with autoloading but with namespace
pollution.
After the line require "library.pl"; is executed you have the
subroutines wrong() and Xright() defined in the namespace of XWrapper.
Then you call the subroutine wrong() as a method using $module->wrong().
There is no autoloading involved at all in this call because the wrong()
is found in the namespace of $module.
>
> $module->right($params);
> $module->right($params);
> $module->wrong($params);
> $module->wrong($params); # this line shows the problem
>
Your comment is misleading. The first call to wrong() behaves exactly
the same way as the second.
I don't understand what you are trying to accomplish, but a simple way
to change the behavior of your example is to put your library code in
its own package (e.g. "Library") and then change the call in callfunc()
to
$Library::methods{$method}->($params);
------------------------------
Date: Thu, 14 Jun 2001 11:02:25 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Re: autoload troubles
Message-Id: <3b287d53@e-post.inode.at>
Samuel Kilchenmann <skilchen@swissonline.ch> wrote:
> Your problem has nothing to do with autoloading but with namespace
> pollution.
> After the line require "library.pl"; is executed you have the
> subroutines wrong() and Xright() defined in the namespace of XWrapper.
Yes, you are right. I was vaguely aware that the library would need
its own package, and that I would get in trouble for that sooner
or later.
The reason why I did it this way is that the location of the library
and its namespace would have to be determined dynamically, based on a
property of the module object. I have tried various combinations of
library calls with package names from callfunc(), along the lines of:
require $self->{pkg} . ".pl";
my $result = ${"XLib::$self->{pkg}::methods"}{$method}->($params);
instead of just loading them into the wrapper's namespace:
require $self->{pkg} . ".pl";
my $result = $XWrapper::methods{$method}->($params);
but to be honest, I had problems finding the right syntax to access
that other package. First, "strict refs" would complain, and after
adding "no strict refs" the line above I got an "Unknown error".
That's when I decided to just load it all into the same namespace.
That part was written about a week ago, and I only got a problem
yesterday when I needed two successive method calls. After reading
your answer I tried again to use a seperate namespace, and have
found a way that works, although maybe it's not very elegant:
require $self->{pkg} . ".pl";
my $coderef = eval '$XLib::'. $self->{pkg} . "::methods{$method}";
my $result = $coderef->($params);
Is this an acceptable solution (assuming a package like "XLib::Foo")?
> > $module->right($params);
> > $module->right($params);
> > $module->wrong($params);
> > $module->wrong($params); # this line shows the problem
> >
> Your comment is misleading. The first call to wrong() behaves exactly
> the same way as the second.
Really? I got the following output here:
| called from XWrapper, received a HASH ref
| called from XWrapper, received a HASH ref
| called from XWrapper, received a HASH ref
| called from main, received a XWrapper ref
Thanks a lot for your answer (and for reading my convoluted code),
you got me pointed in the right direction.
cheers,
stefan
------------------------------
Date: Wed, 13 Jun 2001 21:13:42 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: better way to break lines of data?
Message-Id: <3b2839fa@news.microsoft.com>
"Christopher Z. Collier" <ccollier@lavastorm.com> wrote in message
news:9g8l6l0jll@enews1.newsguy.com...
> I need to write a program that pulls data stored in a plain ASCII text
file
> and writes it to another file; this one comma-separated. In the original
> file, fields are designated only by a set number of characters for each
> field. These field sizes come from a separate specification document.
For
> instance; suppose:
> 1002003456779104
>
> were a line of data. The spec may say there are four fields, each four
> characters long. So our data is:
> 1002,0034,5677,9194
>
> My program uese regular expressions to pull out the fields. For my
previous
> example I'd do something like this:
[regex example snipped]
You could use "split" or as you already mentioned substr (provided you can
be sure that the fields are always 4 digits long).
jue
------------------------------
Date: Wed, 13 Jun 2001 21:20:03 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: better way to break lines of data?
Message-Id: <mbudash-452B95.21200313062001@news.pacbell.net>
In article <9g8l6l0jll@enews1.newsguy.com>, "Christopher Z. Collier"
<ccollier@lavastorm.com> wrote:
> I need to write a program that pulls data stored in a plain ASCII text
> file
> and writes it to another file; this one comma-separated. In the original
> file, fields are designated only by a set number of characters for each
> field. These field sizes come from a separate specification document.
> For
> instance; suppose:
> 1002003456779104
>
> were a line of data. The spec may say there are four fields, each four
> characters long. So our data is:
> 1002,0034,5677,9194
>
> My program uese regular expressions to pull out the fields. For my
> previous
> example I'd do something like this:
>
> $curLine =~ /(.{4})(.{4})(.{4})(.{4})/
> my $field1 = $1, my $field2 = $2, my $field3 = $3, my $field4 = $4;
>
> I can then do what I wish with the data in the $field variables.
> My question is this:
> Can anyone think of a more efficient or easier way do do this? Is this
> going to be really slow? Are those $1, $2, etc. variables stored in any
> kind of array that I can just iterate over? Or should I just be using
> substr()?
>
$_ = '1002003456779104';
$data = join (",", unpack("a4 a4 a4 a4", $_));
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Thu, 14 Jun 2001 08:02:26 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: Can an lvalue sub also be an rvalue?
Message-Id: <9g9k17$6s0$07$1@news.t-online.com>
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to
> Anno Siegel
> <anno4000@lublin.zrz.tu-berlin.de>], who wrote in article
> <9g7goh$qv2$1@mamenchi.zrz.TU-Berlin.DE>:
>> > *No* question about programming may be answered by experiments (unless
>> > answered negatively ;-). This is the difference between programming
>> > and scripting.
>>
>> Agreed, with reservations about the script/program semantics. But
>> I think you will agree too, that before asking "What would 'print
>> sqrt(-1)' print?" it's a good idea to run "perl -le 'print sqrt(-1)'".
>
> I do not agree. It is a good idea to run
>
> perldoc -f sqrt
>
> If it does not help, no experiments will (unless you find two systems
> which produce different results).
>
> Ilya
>
I wonder what
perldoc -f sqrt
would produce.
Buggs
------------------------------
Date: 14 Jun 2001 00:31:04 -0700
From: cgi@abv.bg (Vulcho Nedelchev)
Subject: DBI problem
Message-Id: <9ffb1079.0106132331.13bf8cec@posting.google.com>
On linux DBI is perfect but on windows is some problems. Drivers are
not installing alwais correct and this is not very well. However i try
to use it for my windows work, it is not good. Can i connect to DB
without DBI, DB, DB_File and how can i do that ?
------------------------------
Date: Thu, 14 Jun 2001 11:25:32 +0200
From: Philip Newton <pne-news-20010613@newton.digitalspace.net>
Subject: Re: DBI problem
Message-Id: <6m0hit46v27a26vq97g15166deaglprat8@4ax.com>
On 14 Jun 2001 00:31:04 -0700, cgi@abv.bg (Vulcho Nedelchev) wrote:
> On linux DBI is perfect but on windows is some problems. Drivers are
> not installing alwais correct and this is not very well. However i try
> to use it for my windows work, it is not good. Can i connect to DB
> without DBI, DB, DB_File and how can i do that ?
Did you compile your own Perl or did you fetch a binary distribution?
I have ActivePerl build 522 (I think) at home and 623 at work. The
precompiled versions of DBI and DBD::mysql work fine for me both at home
and at work. DBD::Oracle also works. I installed them with PPM.
How did you install your database drivers?
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 14 Jun 2001 07:34:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: efficient change file with locking?
Message-Id: <9g9pdq$slt$1@mamenchi.zrz.TU-Berlin.DE>
According to John Hall <jhall@ifxonline.com>:
> My system for whatever reason doesn't have flock or lockf, so I did this
> instead.. I don't know how great it is.. Simple semaphore-
>
> sub open_db {
>
> my $db = shift;
>
> while(-f ("$datadir/$db".'db.lock')){ select(undef,undef,undef,0.1); }
>
> dbmopen(%{"$db".'db'},"$datadir/$db", 0644) or die "dbmopen: $!";
> link (("$datadir/$db".'.db'), ("$datadir/$db".'db.lock'));
>
>
> }
No, you're doing it wrong. Hard links *have* been used as ersatz
locks, but the trick is to do the test for existence and the
creation of the link in a single atomic step. This can presumably
been done by trying to create the link and checking for an error.
Presumably, because the documentation of link() doesn't say
explicitly that the operation is atomic.
So the "lock loop" should look somewhat like this (untested):
use constant EEXIST => 17; # May be system dependent, check yours
until ( link( $file, "$file.lock") ) {
die "Can't create link $file.lock" unless $! == EEXIST;
select(undef,undef,undef,0.1);
}
# $file is now "locked"
It is also advisable to use an END block to remove the link when
the process dies. You may still occasionally have to remove a
left-over lock file manually.
Anno
------------------------------
Date: Thu, 14 Jun 2001 04:05:07 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to create a script to emulate a task that can be performed thru command line ?
Message-Id: <slrn9igejc.2mi.tim@vegeta.ath.cx>
blue <avocet@sympatico.ca> wrote:
> How to create a script to emulate a task that can be performed thru
> command line ?
>
> The way its done thru command line is to type
> I enter 'passwd username'
> PC responds with 'New password:'
> I enter 'newpassword'
> PC responds with 'Changing local password for username.'
>
> I could write the script except I need to know how to read the
> response from the PC to the input from the script, because simply
> doing
> system 'command';
> several times wouldn't work
You might look into achieving this with system calls instead of
interactive shell commands, but if you're set in accomplishing the
above, you probably want the open2() function.
perldoc perlipc
--
-Tim Hammerquist <timmy@cpan.org>
I'm already not yet convinced.
-- Larry Wall
------------------------------
Date: 13 Jun 2001 23:45:55 -0700
From: cgi@abv.bg (Vulcho Nedelchev)
Subject: Re: how to extract URL source with LWP ?
Message-Id: <9ffb1079.0106132245.78bc2d18@posting.google.com>
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
$meth = 'GET';
$url = 'http://www.somedomain.com';
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new($meth, $url);
$response = $ua->request($request);
if ($response->is_success) {
print $response->content;
}
else {
print $response->message;
}
------------------------------
Date: 13 Jun 2001 22:02:13 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: how to make a perl script run a batch file
Message-Id: <db67a7f3.0106132102.638f6260@posting.google.com>
Why not? Use system, or I believe there is a win32 API wrapper module
if you want more flexibility.
Ilya
"emre" <otoked@yahoo.com> wrote in message news:<9g9512$dus$1@plutonium.btinternet.com>...
> Is it possible to write a perl script that runs an external batch file or
> any other application on a windows system?
------------------------------
Date: 14 Jun 2001 09:00:16 +0100
From: nobull@mail.com
Subject: Re: modules (no, not perl modules)
Message-Id: <u9lmmvmqy7.fsf@wcl-l.bham.ac.uk>
"Todd Smith" <todd@designsouth.net> writes:
> Where can I learn to build a perl app that's advanced enough to be able to
> load other outside modules (written for it, not Perl modules), and use that
> code?
I think you need to explain what you are asking. If both the app and
the modules are written in Perl why are they not simply Perl modules
that conform to some interface spec.
> How do you make a script know when to give control to an outside
> module and what to expect back?
You define the interface between the app and the module, you then
implement that interface. For examples of interfaces look at say the
DBD modules or the protocol modules for LWP.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 14 Jun 2001 07:09:35 GMT
From: Morgan Fletcher <morgan@hahaha.org>
Subject: Negative lookahead not working
Message-Id: <874rtjtu4w.fsf@hahaha.org>
I'm having a hard time getting a negative lookahead working for me.
I'm printing lines from a file, some of which look like this:
@thing \w*XYZ
And some look like this:
@thing \w*
(without "XYZ" at the end)
I want to print every line but those that look like @thing \w*, i.e. those
without the XYZ on the end.
I tried:
print unless /\@thing\s+\w*(?!XYZ)/;
But that results in no lines beginning with @thing being printed at all.
What am I doing wrong?
morgan
------------------------------
Date: Thu, 14 Jun 2001 09:30:53 +0200
From: "Peter Søgaard" <peter.sogaard@tjgroup.com>
Subject: Re: Negative lookahead not working
Message-Id: <9g9p2t$d29$1@news.inet.tele.dk>
"Morgan Fletcher" <morgan@hahaha.org> wrote in message
news:874rtjtu4w.fsf@hahaha.org...
> I'm having a hard time getting a negative lookahead working for me.
>
> I'm printing lines from a file, some of which look like this:
>
> @thing \w*XYZ
>
> And some look like this:
>
> @thing \w*
>
> (without "XYZ" at the end)
>
> I want to print every line but those that look like @thing \w*, i.e. those
> without the XYZ on the end.
>
> I tried:
>
> print unless /\@thing\s+\w*(?!XYZ)/;
What are you trying to do with \w* ? Match zero or more word(\w)-characters?
or a word character followed by a * ?
In the first case it should be /\@thing\s+\w*?(?!XYZ)/;
The other case should be /\@thing\s+\w\*(?!XYZ)/;
Cheers.
------------------------------
Date: Thu, 14 Jun 2001 12:04:25 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Re: new to perl need help with concordance
Message-Id: <3b288bda$1@e-post.inode.at>
IlIIllllI1 <iliilllli1@hotmail.com> wrote:
> I cant figure out how to finish this exercise
> http://www.comp.leeds.ac.uk/Perl/split.html#exercise ive been trying for 2
> hours.
2 hours is nothing ;-)
> #!/usr/bin/perl
One good advice is to always "use strict" and to enable warnings.
> $string = @ARGV[0];
This is a scalar, you should use $ARGV[0] instead of @ARGV[0].
> $file = 'electricity.txt'; # Name the file
> open(INFO, $file); # Open the file
Always check the return status of an open() statement.
> @text = <INFO>;
> close(INFO);
>
> $text = "@text";
The instructions in your exercise advise you to chomp() your array
before joining it in a scalar.
> @splittext = split(/$string/,$text);
>
> foreach (@splittext) {
> $s1 = (' 'x10).$_;
> print substr($s1,-10,10).$string;
> }
The following loop will do what you want:
for (my $i=1; $i < @splittext; $i++) {
my $before = substr((' 'x10).$splittext[$i-1],-10,10);
my $after = substr($splittext[$i].' 'x10,0,10);
print $before, $string, $after, "\n";
}
> please help me
cheers,
stefan
------------------------------
Date: Thu, 14 Jun 2001 09:21:41 +0200
From: "Peter Søgaard" <peter.sogaard@tjgroup.com>
Subject: package, module or ???
Message-Id: <9g9ohb$bkh$1@news.inet.tele.dk>
Hi NG,
My question is somewhat difficult to explain, but i'll try anyway :)
I'm working on this cgi application in Perl where an administrator can
activate and deactivate certain parts of the application.
There's is a lot of different parts that can be activated or deactivated. My
problem is i don't quite know how to implement this the most efficient way.
Should i write all the parts as functions in a package that would be
required in the top of my cgi script? The problem with this, as I see it, is
that my application would include all the code of the different parts even
though they are not needed( if they are deactivated ).
Should I put all the parts in a module?
Should I put each part in it's own module?
Is it possible to somehow only include something in your code if it is
needed? ie:
if( module1IsActivated) use module 1;
Or maybe i should do this in a completely different way that i haven't
thought of :)
Any ideas appreciated!
------------------------------
Date: 14 Jun 2001 10:00:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: package, module or ???
Message-Id: <9ga20r$111$1@mamenchi.zrz.TU-Berlin.DE>
According to Peter Søgaard <peter.sogaard@tjgroup.com>:
> Hi NG,
> My question is somewhat difficult to explain, but i'll try anyway :)
>
> I'm working on this cgi application in Perl where an administrator can
> activate and deactivate certain parts of the application.
> There's is a lot of different parts that can be activated or deactivated. My
> problem is i don't quite know how to implement this the most efficient way.
>
> Should i write all the parts as functions in a package that would be
> required in the top of my cgi script? The problem with this, as I see it, is
> that my application would include all the code of the different parts even
> though they are not needed( if they are deactivated ).
>
> Should I put all the parts in a module?
> Should I put each part in it's own module?
>
> Is it possible to somehow only include something in your code if it is
> needed? ie:
> if( module1IsActivated) use module 1;
>
> Or maybe i should do this in a completely different way that i haven't
> thought of :)
Make the optional routines autoloading. For more on that subject,
look for 'autoload' in perlsub. It will point you to further
documents on the subject.
Anno
------------------------------
Date: Thu, 14 Jun 2001 06:20:21 +0200
From: Philip Newton <pne-news-2001064@newton.digitalspace.net>
Subject: Re: Removing ^M characters
Message-Id: <1regit0dotgcqpgog7gnuti8qmc9abo4a5@4ax.com>
On Wed, 13 Jun 2001 10:53:03 GMT, helgi@NOSPAMdecode.is (Helgi Briem)
wrote:
> often in the form of a short script which converts
> Mac/DOS files to Unix format:
>
> #!/usr/bin/perl -w
> while (<>) {s/\r\n*/\n/g;}
> continue {print;}
You whould be able to replace that with
#!/usr/bin/perl -pw
s/\r\n*/n/g;
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 14 Jun 2001 07:13:14 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Sending Attachments Via Sendmail
Message-Id: <slrn9igp0a.cj9.vek@pharmnl.ohout.pharmapartners.nl>
On Wed, 13 Jun 2001 08:57:59 -0500, Mr. SunRay <nospam@hotmail.com> wrote:
>I wrote:
>
>> Antoine Hall wrote in comp.lang.perl.misc:
>> } Is there a way to attach files to an email when using Sendmail? I want to
>> } be able to send an email to someone and attach log files but have the
>> } process automatic using sendmail. Can it be done?
>>
>> Of course, sendmail can handle emails with attachments. An attachment is
>> essentially a way to format the body of the mail. It's intended to be
>> decoded and encoded by mail user agents. The job of sendmail is only to
>> transport the mails over a network, not to handle its contents.
>>
>> To answer your question: use the MIME::Lite module.
>>
>Or the Mail::Sender module
>
The difference is that MIME::Lite can format a MIME message with
attachments and everything. Mail::Sender just sends it.
Villy
------------------------------
Date: 14 Jun 2001 07:21:11 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: too late error?
Message-Id: <slrn9igpgh.14n.rgarciasuarez@rafael.kazibao.net>
Brian E. Douglass wrote in comp.lang.perl.misc:
} Vice wrote:
}
} > I get the error:
} > Too late for "-T" option at isbuild.pl line 1.
} > when trying to execute a .pl script from telnet
} >
} > what does it mean?
}
} It means that you used #!/usr../perl -T, but didn't initialize it when
} you ran the program, you need to type perl -T file.pl
Or make the Perl script executable and run it directly (./file.pl).
The perl error messages are described in the perldiag man page.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
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 1131
***************************************