[16270] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3682 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 16 11:05:41 2000

Date: Sun, 16 Jul 2000 08:05:11 -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: <963759910-v9-i3682@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 16 Jul 2000     Volume: 9 Number: 3682

Today's topics:
    Re: @ not piped in print << -> must escape as \@ <shanen@my-deja.com>
    Re: @ not piped in print << -> must escape as \@ (Tad McClellan)
    Re: @ not piped in print << -> must escape as \@ (Keith Calvert Ivey)
    Re: @ not piped in print << -> must escape as \@ (Keith Calvert Ivey)
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
        ANNOUNCE: Finance::Quote 1.00 released pfenwick@my-deja.com
        Any comment on this mp3 trimming script? <abuse@localhost>
    Re: CGI email on NT server <4loops@home.com>
        communicating through the location bar <raphaelp@nr1webresource.com>
    Re: communicating through the location bar <ecco64@chello.nl>
    Re: flock nonsense ? (John Armsby)
        Form problem (Haazi2)
        Getting a random var as output <ecco64@chello.nl>
    Re: Help with Regular Expression (Tad McClellan)
    Re: Interfacing Perl with MIME : help needed <you.will.always.find.him.in.the.kitchen@parties>
    Re: Locking a file (Keith Calvert Ivey)
    Re: Net::Smtp problems <jdNOjdSPAM@syncon.ie.invalid>
    Re: Net::Smtp problems tony_barratt@my-deja.com
        NEWBIE QUESTION !!!!! <felix.gourdeau@videotron.ca>
        parsing cronjob emails tony_barratt@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 16 Jul 2000 09:42:05 +0900
From: "Shannon Jacobs" <shanen@my-deja.com>
Subject: Re: @ not piped in print << -> must escape as \@
Message-Id: <8ks58c$1gs$1@nwms2.odn.ne.jp>

"Tad McClellan" <tadmc@metronet.com> wrote in
<snip>
>    perldoc perldiag

Pretty sure I looked at that one, too. But diagnosing and even fixing the
problem wasn't too difficult.


> --------------------------------
> =item In string, @%s now must be written as \@%s
>
> (F) It used to be that Perl would try to guess whether you wanted an
> array interpolated or a literal @.  It did this when the string was first
> used at runtime.  Now strings are parsed at compile time, and ambiguous
> instances of @ must be disambiguated, either by prepending a backslash to
> indicate a literal, or by declaring (or using) the array within the
> program before the string (lexically).  (Someday it will simply assume
> that an unbackslashed @ interpolates an array.)

This sort of appears to address the "why" that I was seeking, but I'm afraid
that I still can't understand exactly what is going on here.

The camel book (and the other sources I used for this aspect) did not say
anything revealing about the use of "print <<foo;" or "print <<\"foo\";"
which makes me hope that there is nothing deep to be revealed there. Or is
there? It seems like the user's only responsibility should be to make sure
that the terminal string does not appear anywhere in the text to be spewed
[in the simplest of possible worlds].

If I understand what you are saying [or quoting], Perl (but only at compile
time?) is still trying to interpret the to-be-spewed text, and it is
concerned about the possibly ambiguous use of @bar.com. But I would prefer
it do nothing except watch for a literal occurrence of the terminal string.
What else might it be doing to the HTML that TopPage has so carefully thrown
at it? Are there other things I just haven't noticed or that I've luckily
avoided so far?


<snip>
> You should use single quotes for constant strings. Single-quoted
> strings don't care about @ signs.
>
> You can get single-quoted here-docs too:
>
> print <<'HEREDOC';
>    shanen@my-deja.com
>    tadmc@metronet.com
> HEREDOC

Sorry, but you're confusing me again... Hopefully my confusion on this point
is not critical? I've also seen it with no quotes at all and with double
quotes, but I trusted that Perl was doing one of it's apparently obscure
conversions to something it liked? Or are you actually suggesting that using
a ' in this situation would work around TopPage's use of " within the HTML?
I'm trying to remember if all of the @s in the HTML source were within
double quotes, though I'm sure that I used "print <<EOT;" without any...


<snip>
> Ah, finally. I was beginning to wonder if you were going to
> actually ask a question.
>
> I think the docs answer it though?

I rather believe they do, and even if they didn't, Perl answers by its
behavior. But the answers to why questions can be tough, and right now I
still don't capish. I have a fuzzy feeling that Larry is planning to do
something more with @ in the future... Heaven forbid it isn't doing enough
already!  ;-)


<snip>
> >However, probably similar problem disables
> >perldoc--error is "In string, @sys now must be written as \@sys at...."
>
> Huh?

You mean this isn't intuitively obvious to the most casual observer?  ;-)
Seriously, that's part of the error message that "perldoc" invokes on the
Unix boxen. I've called it to the attention of the sysgods, but my English
may have confused them again... For now I bypass or use the lowly "man".


> >Hypothesis: weird@.
>
> Use the docs, Luke.

I have, and even the Japanese versions (but mostly indirectly). But Perl
does not seem to lend itself to convenient explication. Reminds me of trying
to talk about Lisp before I could use the language--and I think that's a big
chunk of why so few people care about Lisp anymore. Does a similar fate
await Perl?

So here is a doc-related question whose answer I've yet to stumble across in
the docs. A lot of the time in Perl-related matters strange characters are
part of the question, but they are not easily searchable. In this particular
case, if I had been able to figure out a good way to search for "<<" after
"print" I hope I would have quickly come to some revealing information... Is
there some search engine with such a capability linked to a significant body
of perl documentation?

Still, thanks for the information, and I'll try to digest it some more on
Monday, between battles with the new version of Notes...

--
 .a/ssig
Spam not unto me!  I shall decode thy email headers and trace thy routes,
and smite them, and I shall pursue thee and thy provider and thy provider's
upstream link.  Yea, unto the seventh generation shall I pursue thy links,
and thou shall spam no more.




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

Date: Sun, 16 Jul 2000 08:17:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: @ not piped in print << -> must escape as \@
Message-Id: <slrn8n39v7.jab.tadmc@magna.metronet.com>


[ Usenet is a plain text medium. Please use plain text. ]


On Sun, 16 Jul 2000 09:42:05 +0900, Shannon Jacobs <shanen@my-deja.com> wrote:
>"Tad McClellan" <tadmc@metronet.com> wrote in

>> =item In string, @%s now must be written as \@%s


>This sort of appears to address the "why" that I was seeking, but I'm afraid
>that I still can't understand exactly what is going on here.
>
>The camel book (and the other sources I used for this aspect) did not say
>anything revealing about the use of "print <<foo;" or "print <<\"foo\";"
>which makes me hope that there is nothing deep to be revealed there. 


There is not.

"here-docs" (that is the name of the << thingie) are merely a
different form of quoting a string.

You can use a quoted string many places, not just with print().

So you can use here-docs many places, it is not wedded to print().


>Or is
>there? It seems like the user's only responsibility should be to make sure
>that the terminal string does not appear anywhere in the text to be spewed
                                          ^^^^^^^^
>[in the simplest of possible worlds].


Actually in _can_ appear in the text, it just cannot appear as the
only thing on a line in the text:

$_ =<<ENDSTR;
line one
 ENDSTR
line three
ENDSTR

:-)



>If I understand what you are saying [or quoting], Perl (but only at compile
>time?) is still trying to interpret the to-be-spewed text, and it is
>concerned about the possibly ambiguous use of @bar.com. But I would prefer
>it do nothing except watch for a literal occurrence of the terminal string.


So you don't need the here-doc to interpolate variables?

You can use a single-quoted here-doc then:

$_ =<<'ENDSTR';
line one
tadmc@metronet.com
line three
ENDSTR



>What else might it be doing to the HTML that TopPage has so carefully thrown
>at it? Are there other things I just haven't noticed or that I've luckily
>avoided so far?


I dunno.

I would need to know what the data is to answer that, and I
don't know what TopPage spews (or even what TopPage is :-)



><snip>
>> You should use single quotes for constant strings. Single-quoted
>> strings don't care about @ signs.
>>
>> You can get single-quoted here-docs too:
>>
>> print <<'HEREDOC';
>>    shanen@my-deja.com
>>    tadmc@metronet.com
>> HEREDOC
>
>Sorry, but you're confusing me again... Hopefully my confusion on this point
>is not critical? I've also seen it with no quotes at all and with double
>quotes, 


no quotes defaults to "double quotish".

You can have here-docs that interpolate:

   print <<HEREDOC;     # a "double quotish string"

   print <<"HEREDOC";   # same thing

And you can have here-docs that do not interpolate (as above).


Just as you can have more conventionally quoted strings that are double
quotish and ones that are not.



>but I trusted that Perl was doing one of it's apparently obscure
>conversions to something it liked? Or are you actually suggesting that using
>a ' in this situation would work around TopPage's use of " within the HTML?


I dunno what TopPage does (or is).

That sounds like something specific to the application that
you happen to be using Perl for. I know Perl, I do not know
your application.


>I'm trying to remember if all of the @s in the HTML source were within
>double quotes, though I'm sure that I used "print <<EOT;" without any...
                                                           ^^^^^^^^^^^


So you got a double quotish string then.

Literal at signs must be escaped in double quotish strings.

It must be escaped regardless of whether you use "double quotes"
or a here-doc.


>
><snip>
>> Ah, finally. I was beginning to wonder if you were going to
>> actually ask a question.
>>
>> I think the docs answer it though?
>
>I rather believe they do, and even if they didn't, Perl answers by its
>behavior. But the answers to why questions can be tough, and right now I
>still don't capish. I have a fuzzy feeling that Larry is planning to do
>something more with @ in the future... Heaven forbid it isn't doing enough
>already!  ;-)


Larry used @ to indicate an array data type.

He is already "doing something", not just "planning to"  :-)


-----------------------------
#!/usr/bin/perl -w
use strict;

my @metronet = qw/zero one two/;

$_ =<<ENDSTR;
line one
tadmc@metronet.com
line three
ENDSTR

print;
-----------------------------

@metronet gets expanded just the same as if we had not used a here-doc.

$_ ="line one
tadmc@metronet.com
line three
";



><snip>
>> >However, probably similar problem disables
>> >perldoc--error is "In string, @sys now must be written as \@sys at...."
>>
>> Huh?
>
>You mean this isn't intuitively obvious to the most casual observer?  ;-)


Strangle enough it is not.

We get asked several times a month how to fix the problem!



>Seriously, that's part of the error message that "perldoc" invokes on the
>Unix boxen. 


perl's docs are the same on all platforms. No "on Unix" qualifier needed.

Or are you saying that the perldoc program has this bug?


>So here is a doc-related question whose answer I've yet to stumble across in
>the docs. A lot of the time in Perl-related matters strange characters are
>part of the question, but they are not easily searchable. In this particular
>case, if I had been able to figure out a good way to search for "<<" 

   perldoc -q '<<'

That finds a FAQ about here-docs...


>after
>"print" I hope I would have quickly come to some revealing information... 


here-docs are not related to the print() function.

They are often used with print(), but they can be used *anywhere*
you would use a more conventionally quoted string.


here-docs are quoted strings.

They are not tricky. They are just strings.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 16 Jul 2000 13:37:34 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: @ not piped in print << -> must escape as \@
Message-Id: <3973b8bc.135612817@news.newsguy.com>

"Shannon Jacobs" <shanen@my-deja.com> wrote:

>Sorry, but you're confusing me again... Hopefully my confusion on this point
>is not critical? I've also seen it with no quotes at all and with double
>quotes, but I trusted that Perl was doing one of it's apparently obscure
>conversions to something it liked? Or are you actually suggesting that using
>a ' in this situation would work around TopPage's use of " within the HTML?
>I'm trying to remember if all of the @s in the HTML source were within
>double quotes, though I'm sure that I used "print <<EOT;" without any...

It's not the easiest thing to search for in the documentation,
but the explanation you want is in perldata, under "Scalar value
constructors", starting from the sentence "A line-oriented form
of quoting is based on the shell ``here-doc'' syntax."

It has nothing to do with the occurrence of the " character in
your HTML.  It has to do with whether the string is being
interpreted in double-quotish or single-quotish context.  If you
pur double quotes or no quotes around the marker after <<, then
Perl interpolates scalar and array variables (just as in a
double-quoted string), so you have to escape all $ and @
characters that you want included literally; it also interprets
backslashed sequences like \n for newline.  If you put single
quotes around the marker after <<, then Perl doesn't do that; it
sounds like that's the solution to your problem.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Sun, 16 Jul 2000 14:08:10 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: @ not piped in print << -> must escape as \@
Message-Id: <3976c187.137864143@news.newsguy.com>

tadmc@metronet.com (Tad McClellan) wrote:
>On Sun, 16 Jul 2000 09:42:05 +0900, Shannon Jacobs <shanen@my-deja.com> wrote:

>>You mean this isn't intuitively obvious to the most casual observer?  ;-)
>
>Strangle enough it is not.

Freudian slip, Tad?

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: Sun, 16 Jul 2000 10:22:40 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage963743041.25018@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://www.cpan.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

For an alternative way to get answers, check out the Perlfaq website.

    http://www.perlfaq.com/

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://www.cpan.org/
    http://www.perl.com/CPAN/
    http://www.cpan.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Sun, 16 Jul 2000 10:47:03 GMT
From: pfenwick@my-deja.com
Subject: ANNOUNCE: Finance::Quote 1.00 released
Message-Id: <edic5.7544$8V2.178827@news-east.usenetserver.com>

G'day everyone,

	Finance::Quote 1.00 has been released and should be available via CPAN
shortly.  All versions of Finance::Quote are also available via the web
at <http://sourceforge.net/project/filelist.php?group_id=4232>.

	The Finance::Quote module provides a simple and powerful way of
fetching financial information from a variety of stock markets and
investment houses from around the world -- including those in Europe,
Canada, the United States, and Australia.

	The new version of Finance::Quote provides many new features and
advantages over previous versions, including:

* Loadable module support (plug your own module in to Finance::Quote)
* Currency look-ups.
* Automatic currency conversion (get foreign stocks in local currency).
* Automatic failover support.
* User-specified list of required labels to return.
* Better configuration options of user-agent.
* Muchly improved documentation.
* Many small bugfixes and improvements.

	More information can be found at the Finance::Quote webpage,
<http://finance-quote.sourceforge.net/>.

	Cheers,

		Paul
		(pjf at cpan dot org)


Sent via Deja.com http://www.deja.com/
Before you buy.




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

Date: Sun, 16 Jul 2000 19:12:36 +0800
From: "multiplexor" <abuse@localhost>
Subject: Any comment on this mp3 trimming script?
Message-Id: <8ks4si$iv5264@imsp212.netvigator.com>

I've written a script to reduce the size of a mp3 file:

http://mpx.virtualave.net/trim3.txt

The principle is simple. It counts the number of digital silence ("\x00" or
"\xFF", I'm not sure the later) in a frame, and delete the frame if the
number excceeds a particular amount.

I use a string variable, $line, to store the content of the whole mp3 file,
since I know Perl is good at string processing. I don't know whether it is
appropriate and there are better ways.

Any comment would be appreciated.

MP3 frame info:
http://www.id3.org/mp3frame.html

Tested platform:
Win98, ActivePerl

Thanks.




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

Date: Sun, 16 Jul 2000 04:55:19 -0600
From: 4loops <4loops@home.com>
Subject: Re: CGI email on NT server
Message-Id: <39719497.9BB9CAAC@home.com>

Russell Smallwood wrote:
> In article <sn1luv5lnd657@corp.supernews.com>, patty@xidd.com belched:
> > I've moved my site over from a UNIX platform to an NT platform and I'm
> > experiencing some difficulties with the cgi scripts. I've worked out all
> > of the bugs with the exception that the sendMail function is not working.
> > After researching I now know that this function does not work on NT and
> > I've tried the BLAT.EXE command but it isn't working for me.
> > <snip>
>
> NET::SMTP

Even better, use MIME::Lite which I got working pretty easily.
Check Deja-news for MIME::Lite info to include locally.

I had Blat and Windmail working on NT locally. But when I tried
deploying the script on a hosted NT server, windmail would not
send any mail, and I can't use blat there.  Your send_email()
is not working with blat because it does not accept piped input
like sendmail. Here's what I used for blat (fragments)...


# TEMP_WIN is a temporary windows file to store the body text
# Only required on Windows systems, change path to temporary directory
my($TEMP_WIN) = "c:\\temp\\blat_$$.tmp";
my($mailprog) = 'c:\\bin\\blat.exe';                  # NT
 ...
    my $blat_args  = qq/$TEMP_WIN -q -noh2 -subject \"User
requested...\"/;
    $blat_args .= qq/ -from \"$qs{admin_email} ($qs{admin_name})\"/;
    $blat_args .= qq/ -to \"$qs{email} ($qs{full_name})\"/;
    # for $i loop for each file to attach...
        my $att = ((qq/$qs{$i}/ =~ /\.txt$/) ? "t" : "");
        $blat_args .= qq/ -attach$att $basedata$qs{$i}/;

    open(MAIL,">$TEMP_WIN") || &error("Could not open temporary windows
file");
    print MAIL <<MAIL_STUFF;
A user requested articles from your site.

    Name: $qs{fullname}
   Email: $qs{email}
 Address: $qs{addresses}
    City: $qs{city}
   State: $qs{state}
Zip code: $qs{zip}
   Phone: $qs{phone}

MAIL_STUFF
    close(MAIL);

    # This sends mail when running under Windows...
    system "$mailprog $blat_args";
    unlink $TEMP_WIN;

Thanks...Dan


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

Date: Sun, 16 Jul 2000 15:25:28 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: communicating through the location bar
Message-Id: <8ksde7$liq$18$1@news.t-online.com>

Hi,

I'm trying to make the script act according to the location that it is
called upon. For example:

preview.pl?form_type=feedback

gives the variable $form_type the value "feedback". Is this possible? Here's
what I've come up with so far:

#!/usr/bin/perl

# Create Forms Code

use CGI 'param';
$form_type=param('form_type');

$form_type_file1 = "forms/".$form_type."1.txt";
$form_type_file2 = "forms/".$form_type."2.txt";

$/ = undef;
open FILE, $form_type_file1;
$form_type_code1 = <FILE>;
close FILE;
$/ = "\n";

$/ = undef;
open FILE, $form_type_file2;
$form_type_code2 = <FILE>;
close FILE;
$/ = "\n";

print "Content-type: text/html\n\n";
print "<form>";
print "$form_type_code1";
print "$form_type_code2";
print "</form>";

exit;


Thanks in advance,

Raphael




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

Date: Sun, 16 Jul 2000 14:04:37 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: communicating through the location bar
Message-Id: <Vhjc5.394500$k22.1733772@flipper>

The way you use stores everything after the ? in the URL in the variable
$ENV{'QUERY_STRING'}
So when you use

preview.pl?form_type=feedback

you just need to split it up:

@array = SPLIT(/=/$ENV{'QUERY_STRING'});

now both "form-type" and "feedback" are stored in an array, you can work
with that.
Hope I was of any help, goodluck!

"Raphael Pirker" <raphaelp@nr1webresource.com> wrote in message
news:8ksde7$liq$18$1@news.t-online.com...
> Hi,
>
> I'm trying to make the script act according to the location that it is
> called upon. For example:
>
> preview.pl?form_type=feedback
>
> gives the variable $form_type the value "feedback". Is this possible?
Here's
> what I've come up with so far:
>
> #!/usr/bin/perl
>
> # Create Forms Code
>
> use CGI 'param';
> $form_type=param('form_type');
>
> $form_type_file1 = "forms/".$form_type."1.txt";
> $form_type_file2 = "forms/".$form_type."2.txt";
>
> $/ = undef;
> open FILE, $form_type_file1;
> $form_type_code1 = <FILE>;
> close FILE;
> $/ = "\n";
>
> $/ = undef;
> open FILE, $form_type_file2;
> $form_type_code2 = <FILE>;
> close FILE;
> $/ = "\n";
>
> print "Content-type: text/html\n\n";
> print "<form>";
> print "$form_type_code1";
> print "$form_type_code2";
> print "</form>";
>
> exit;
>
>
> Thanks in advance,
>
> Raphael
>
>




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

Date: Sun, 16 Jul 2000 14:15:32 GMT
From: jaws@mindspring.com (John Armsby)
Subject: Re: flock nonsense ?
Message-Id: <3971bf82.602405@news.mindspring.com>


As just a guy who wants the basics of file locking like everyone else,
I have followed these and other posts, compared code snippets, etc. To
use Fcntl or not to use Fcntl... to use semaphone files... not to use
semaphore files...not sure how semaphone files work....  Can I not
just avoid the problem by renaming the file to PID ($$), doing
something to it, and then renaming it back? 

I have concurrently run the code below as test1.pl and test2.pl.  I
changed test1.pl and test2.pl so that they would print slightly
different values.  That way I could compare what each program was
doing to the common file..  It seems to work.  Why should I agonize
with flock?



#!/usr/bin/perl/bin

$PID =$$;
print("\nPID is:  $PID\n\n");

if ($PID !=NULL)
{
   
      {
      print("\ntrying to rename.....");   
      sleep 2;
      redo until (rename("TestFile.txt",$PID));
      }
   

print("\nopening OUTFILE...");

fflush;
open (OUTFILE,">>$PID") or die " can not open $PID";
for($i=0;$i<1000000;$i++)
{

print OUTFILE "\n$i";    			# test1.pl print out

print OUTFILE "\nTest2$i";    		# test2.pl print out

}
print("\nclosing the OUTFILE..."); 
close(OUTFILE);
print("\nOpening for reading....");

open(INFILE,"$PID") or die "can not open $PID";
while(<INFILE>)
   {
   $Line =$_;
   next; 
   }
close(INFILE);
print("\n\nThe last line is $Line");

rename($PID,"TestFile.txt");
}




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

Date: 16 Jul 2000 14:21:55 GMT
From: haazi2@aol.com (Haazi2)
Subject: Form problem
Message-Id: <20000716102155.29977.00000838@ng-md1.aol.com>

Well, I thought I had solved everything but I have one more bug in
my perl script. I use an HTML form and then process it with a perl script.
If there are errors in the required fields the perl script should redraw the
form
with the data that was entered in the HTML form. If the the required fields are
correct then the perl script generates a thank you message to the user.

Here's the problem:

If the user fills out the required fields with the correct values and clicks on
the next button, the user will get error messages about the required fields
which is wrong. However if the user submits the info a second time, filling out
the required fields correctly, you will get a thank you message. It seems the
field values submitted from the HTML form are lost some how. How do I make sure
I keep the form values submitted from the HTML form? Thanks for any help in
advance.


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

Date: Sun, 16 Jul 2000 13:38:22 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Getting a random var as output
Message-Id: <iVic5.394345$k22.1732510@flipper>

I need to find a way to have my script randomly pick a variable out of a
list of variables for output...Any suggestions would be appreciated!

--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/





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

Date: Sun, 16 Jul 2000 07:55:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with Regular Expression
Message-Id: <slrn8n38ks.jab.tadmc@magna.metronet.com>

On Sat, 15 Jul 2000 20:39:51 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Tad McClellan wrote:
>
>(snipped blatherings)
>
>
>> >Godzilla Rocks!
> 
>> Says you.
> 
>
>Reads like insane jealousy to me Mr. McClellan.


No, it reads like the only person that says you are great is you,
which is a statistically insignificant sample size.


>Doesn't it just piss you off to have to change givens,
>have to change parameters, 


No, but you do.


>otherwords tell some lies 
>to massage and band-aid your bruised fragile ego?


I did not tell lies.

Every condition I gave where your code fails _is_ a condition
where your code fails!


What lie(s) are you referring to?


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 16 Jul 2000 22:11:46 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: Interfacing Perl with MIME : help needed
Message-Id: <963742270.973522@shelley.paradise.net.nz>


"Bo" <bo@bo.com> wrote in message
news:8kr8gj$k54$1@slb7.atl.mindspring.net...
> We have a user who needs to send web-based mail in *plain-text*
> format, WHILE attaching .jpeg images to the messages, which would seem
> to involve MIME. Can this be done with Perl scripts and how?
>
> Thanks. Please reply in the newsgroup.

You'll be wanting the MIME::Lite module.  You'll be able to code it in 4
lines.

See www.cpan.org or http://www.zeegee.com/code/perl/MIME-Lite/




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

Date: Sun, 16 Jul 2000 13:42:54 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Locking a file
Message-Id: <3974bb7c.136316688@news.newsguy.com>

martho@my-deja.com wrote:

>Okay, I see the problem: With the download of my win-perl-bins, I didn't
>get any doc-files. Where can I get them ?

If you're using ActivePerl, look under Start > Programs >
ActivePerl > Online Documentation.  If it's not there, there's
something wrong with your installation.  Or you can find the
documentation at perl.com.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: Sun, 16 Jul 2000 07:02:49 -0700
From: deno <jdNOjdSPAM@syncon.ie.invalid>
Subject: Re: Net::Smtp problems
Message-Id: <184ae8a0.20d3380e@usw-ex0105-036.remarq.com>


See the original question which started the topic and you'll see
the script.


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Sun, 16 Jul 2000 13:56:57 GMT
From: tony_barratt@my-deja.com
Subject: Re: Net::Smtp problems
Message-Id: <8ksev4$ua2$1@nnrp1.deja.com>

I had to resort to hitting the "previous in thread" hotlink to find out
the context. No big deal.
In article <em8c5.39271$fR2.354889@news1.rdc1.mi.home.com>,
  clintp@geeksalad.org (Clinton A. Pierce) wrote:
> [posted and mailed]
>
> In article <30a7589c.55654d8e@usw-ex0105-036.remarq.com>,
> 	deno <jdNOjdSPAM@syncon.ie.invalid> writes:
> >
> > I have increased the timeout to limit. This script does not work
> > reliably connecting to 3 different mail hosts which are in the
> > same room (never mind the same network).
> >
> > The mail hosts are rock solid,  hence the question. (Yes I have
> > tried another workstation also)
>
> Who are you?  What do you want?  Is this even a Perl question?
> Where's the Perl?  What script?  I see no script here.  What's the
> question?  There's no question here!  What workstation?
>
> What in the name of bloody Hell are you talking about?
>
> Or are we expected to wade through the last few weeks of
> comp.lang.perl.misc looking for your (spam-blocked) e-mail address to
> try to reconstruct some earlier thread in which you may or may not
> have asked an intelligible question?
>
> --
>     Clinton A. Pierce              Teach Yourself Perl in 24 Hours!
>   clintp@geeksalad.org         for details see
http://www.geeksalad.org
> "If you rush a Miracle Man,
> 	you get rotten Miracles." --Miracle Max, The Princess Bride
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 16 Jul 2000 10:32:19 -0400
From: =?iso-8859-1?Q?F=E9lix?= Gourdeau <felix.gourdeau@videotron.ca>
Subject: NEWBIE QUESTION !!!!!
Message-Id: <3971C773.8408B5E4@videotron.ca>

Hello everybody,

i have a little question in perl :

i have this string :

	$sun =3D <<'FF';

	aaaaa [
	bbbbbb
	bbb
	]
	aaaaaa
	[
	bbbbbbbb
	bbb
	]

	FF

and i want to delete all newline \n characters inside all brackets
[...]. Can someone help me ???
I know there is an easy solution but i tried everything and didn't found
anything.

Thanx

F=E9lix Gourdeau
felix.gourdeau@videotron.ca


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

Date: Sun, 16 Jul 2000 13:43:45 GMT
From: tony_barratt@my-deja.com
Subject: parsing cronjob emails
Message-Id: <8kse6e$ts4$1@nnrp1.deja.com>

Hi,
I'd like to implement some perl code to react to incoming emails to root
and look for keywords like failed and generate an event if found.
Because there are a lot of cronjobs, on mostly Solaris boxes, that
invoke tasks like backup and send a email to root@localhost usually
using sendmail. It's a feature of cron to generate a email as a result
of output, from the cronjob, of either stdout and stderr. And there
usually is some.
So root's mailbox fills with emails that might say backup failed or
might say backup succeeded. emails that noone reads.
So i want to parse the email when it arrives and say turn the screen red
if a keyword is found. I guess I can find the relevant command to turn
the screen red on whatever GUI happends to be running.
But I'm not clear on how to react to emails. I expect there's a hard way
and a very hard way, but is there perhaps an easy way?

TIA

Tony




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3682
**************************************


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