[12274] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5874 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 3 12:07:57 1999

Date: Thu, 3 Jun 99 09:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 3 Jun 1999     Volume: 8 Number: 5874

Today's topics:
    Re: A Newbie needs HELP! <pathfinder@innocent.com>
    Re: Auto de/increments help <aqumsieh@matrox.com>
    Re: bareface ratio fullmoon@aspi.net
    Re: bareface ratio fullmoon@aspi.net
    Re: comparing 3 numeric values <uri@sysarch.com>
    Re: comparing 3 numeric values (Larry Rosler)
    Re: Concatenating variable names <gellyfish@gellyfish.com>
    Re: Form Values <gellyfish@gellyfish.com>
        Help! Perl "typo" error <khowe@performance-net.com>
    Re: help: is there a easy way to send mail? <gellyfish@gellyfish.com>
    Re: HELP: Regular Expressions (Larry Rosler)
        How to create a list-of-lists dynamically? (Michael Friendly)
    Re: How to scramble (hide) my perl code ? (Tad McClellan)
    Re: know Perl to maintain Perl (was: Re: I pass an arra <garethr@cre.canon.co.uk>
    Re: mail problems... still :) <gellyfish@gellyfish.com>
    Re: mail problems... still :) <olthoff@multiboard.com>
        msql, dbi, apache, linux <stefan@kuhlins.de>
    Re: Perl script keeps terminating <gellyfish@gellyfish.com>
    Re: Perl script keeps terminating (Larry Rosler)
        Perl Script wanted (to send SMS by WWW) (Oliver Timme)
    Re: Problem with NULLs <aqumsieh@matrox.com>
        Problem with opening 2 files at once. Please Help!!!! <cmanolis@clementpappas.com>
    Re: String extraction problem - please help? npolonsk@hotmail.com
    Re: stupid ISP? <gellyfish@gellyfish.com>
    Re: The artistic license and perl: (I R A Aggie)
    Re: Trying to make custom start page for users via cook <gellyfish@gellyfish.com>
    Re: Trying to make custom start page for users via cook <jeromeo@atrieva.com>
        turn cache off in IE <leenick@interchange.ubc.ca>
    Re: Tying a double knot in a hash <burton.not.spam@lucent.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 3 Jun 1999 11:16:03 -0400
From: "JJ" <pathfinder@innocent.com>
Subject: Re: A Newbie needs HELP!
Message-Id: <7j665r$1dva$1@newssvr01-int.news.prodigy.com>

----- Original Message -----
From: John Porter <jdporter@min.net>
Newsgroups: alt.perl,comp.lang.perl.misc
Sent: Wednesday, June 02, 1999 12:28 PM
Subject: Re: A Newbie needs HELP!

> Do you have all that data in a database, or some kind of data file,
> other than the html files themselves?  How were these html files
> generated in the first place?

I'm afraid that the files were generated in HTML format only.  They are all
basically a collection of links in exactly the same format as the example I
uploaded to the web.  If I could somehow convert the information into a
database format, I'm sure that would be the best answer, since this will be
an ongoing project whereby links will be added and deleted over time.

Since I am a *complete* novice at programming (in fact, I'm not even a
novice, I really know nothing about it, period), is there a way to
automatically append the information into a database format that wouldn't
require advanced programming skills?  Or is using Perl the best answer for
this project?

Belive me, your advice is much appreciated!

Thanks, JJ






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

Date: Thu, 3 Jun 1999 10:26:23 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Auto de/increments help
Message-Id: <x3yzp2h2wds.fsf@tigre.matrox.com>


jknoll@my-deja.com writes:

> Im trying to get this;
> Two $nums are 10 * 2 and adding one to $var makes Perl++
> Two $nums are 20 and adding to $var makes Perm
> 
> and I get this:
> Two $nums are 10 * 2 and adding one to $var makes Perl++
> Two $nums are 20 and adding to $var makes Perl
> 
> why doesn't the Perl change to Perm ??

It does, but you see $var before it changes.

> here's the code:
> 
> $var="Perl";
> $num=10;
> print "Two \$nums are $num * 2 and adding one to \$var makes $var++\n";
> print "Two \$nums are ", $num * 2," and adding one to \$var makes ",
> $var++,"\n";

There is a difference between $var++ and ++$var. The former returns
the values of $var and *THEN* it increments it. The latter increments
$var *FIRST* and then returns its value. So, you actually pass the
value of $var before incrementing ('Perl') to the print() statement, and
then you increment $var to make it 'Perm'. To test this either change
$var++ to ++$var, or add a

	print $var, "\n";

after your last line to see the final value of $var.

HTH,
Ala



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

Date: Wed, 02 Jun 1999 23:36:09 -0400
From: fullmoon@aspi.net
To: fl_aggie@thepentagon.com
Subject: Re: bareface ratio
Message-Id: <3755F829.45EF8CAB@aspi.net>

I R A Aggie wrote:
 
[snip]
 
 
> -----------begin repost----------somethings are timeless...
> 
> Date:         09 Nov 1995 02:57:30 GMT
> From:         mjd@plover.com (Mark-Jason Dominus)
> Subject:      Re: system() question

[snip]

>     The worst stupid questions are the ones that come from people who
> have no business asking them.  The most perfect example of this that I
> could have imagined was in comp.unix.questions a couple of years ago.
> Some guy came and asked how you could tell if a file is a hard link.
> My jaw flapped open and it's stayed open since then.  I couldn't have
> been any more stumped if he'd asked why Bodhidharma came from the
> West.  What do you say to this guy?  Do you tell him the truth, that
> all files are hard links, that even symbolic links are hard links?
> He's not going to understand you; you might as well keep your mouth
> shut.  Do you tell him the truth, that the answer won't do him any
> good because he doesn't know what a hard link is, so why did he bother
> asking in the first place?  No, that'll just make him mad.  I followed
> that message for the next couple weeks, and nobody said anything.
> What could you say?  The guy had no business asking the question and
> no use for the answer.  Maybe the right answer would have been to cut
> off his finger or something.  I dunno.
> 

[snip]

There actually is an answer to this kind of question.  It's a bit tricky
because you have to rely on side effects, but it is reported to work. 
The standard answer to a question that should not have been comes from
Zen.  It is "MU".  Hofstadter mentions it in his book EGB/EGB.  The
effect of reaponding MU is to _unask_ the question.  Sometimes that is
the perfect response.


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

Date: Wed, 02 Jun 1999 23:38:57 -0400
From: fullmoon@aspi.net
Subject: Re: bareface ratio
Message-Id: <3755F8D1.A788B5AE@aspi.net>

Don Roby wrote:
> 
> In article <37543D13.109FD1C8@xli.com>,
>   Greg Bartels <gbartels@xli.com> wrote:
> > just an interesting phenomenon I've noticed
> > on newsgroups in general.
> >
> > bareface ratio:
> >
> > the number of people who respond
> > to tell you your information is wrong
> >
> > versus
> >
> > the number of people who respond
> > to your requests for information
> > on the same topic.
> >
> > this seems to be about 3 (or more) to 1,
> > depending on the topic.
> >
> 
> We're just trying to keep a positive signal-to-noise ratio.
> All those wrong answers tend to push it negative.  Negative information,
> you know.
> 
> ;-)
> 
> > so, if you have a question, and no one
> > is responding, you can still get the
> > answer, all you have to do is make something
> > up first (bareface it), and the
> > corrections will flood in.
> >
> 
> Your description:
> 
> Q1: How do I do X?
> ...long wait...no response
> A1: To do X, use Y.  (incorrect fake response from original querent).
> A2: Wrong. use Z.
> A3: Wrong. use Z.
> ...etc.
> 
> Better approach:
> 
> Q1: Can I use Y to do X?
> A1: No. Use Z instead.
> 
> I think people are more likely to answer a question with an incorrect
> proposed solution.  I think this holds whether or not the incorrect
> proposed solution was part of the original post or not.  I have no
> statistical evidence for my claim, but there you go...
> 
> I'd rather see the fake answer as part of the original post, so it at
> least LOOKS like you've thought a bit yourself before posting.  ;-)

The fake proposal also provides a lot of context that the question may
fail to provide.  That context enables a respondent to answer with a
statement rather than a series of context questions.


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

Date: 03 Jun 1999 11:17:58 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: comparing 3 numeric values
Message-Id: <x7pv3db9eh.fsf@home.sysarch.com>

>>>>> "IJG" == I J Garlick <ijg@csc.liv.ac.uk> writes:

  IJG> Pity you daft Americans can't right dates properly. You wouldn't need to
                                     ^^^^^
  IJG> use the epoch start date if you wrote dates the way we English do.

too bad you english don't know the english language. :-) you get it
correct in the next sentence.

  IJG> For instance I write 6/15/1999 as 15/06/1999.

  IJG> Now split that out into an array, reverse the array and join it
  IJG> together with no separator. Actually it's probably better to use
  IJG> sprintf as single figure months and days would need a 0
  IJG> prefixing.

	sprintf "%d%02d%02d", (split( '/', '6/15/1999'))[2,0,1] ;


  IJG> This gives 19990615, 19990630, and 19990616 for the 3 dates above.
  IJG> They are numerical and you have to agree easy to work out
  IJG> relationships between them now.

big deal. old trick. and it is better to compare it lexically as it
would be faster and you wouldn't have to worry about floating point
issues if you added the hours/seconds to the value as that would make it
longer than most system's integer size.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Thu, 3 Jun 1999 08:27:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: comparing 3 numeric values
Message-Id: <MPG.11c03ea7ad378d1d989b60@nntp.hpl.hp.com>

In article <FCqw0o.Jy3@csc.liv.ac.uk> on Thu, 3 Jun 1999 09:36:24 GMT, 
I.J. Garlick <ijg@csc.liv.ac.uk> says...
 ...
> Pity you daft Americans can't right dates properly. You wouldn't need to
> use the epoch start date if you wrote dates the way we English do.
> 
> For instance I write 6/15/1999 as 15/06/1999.
> 
> Now split that out into an array, reverse the array and join it together
> with no separator. Actually it's probably better to use sprintf as single
> figure months and days would need a 0 prefixing.
> 
> This gives 19990615, 19990630, and 19990616 for the 3 dates above.
> They are numerical and you have to agree easy to work out
> relationships between them now.
> 
> See it's even Y2K compliant 20000101, :-) :) ROFL

On the scale of daftness in date/time representation, Americans are 
certainly the worst.  But English and other Europeans are second worst.  
The ones who have it 'right' are the Chinese, and those who adopted 
their way into the ISO 8601 date/time standard.  They would use dates 
written as 1999-06-15, which are directly sortable lexicographically 
without any manipulation.

And it's even Y2K compliant 2000-01-01, :-) :) ROFL

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 3 Jun 1999 16:00:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Concatenating variable names
Message-Id: <3756988a@newsread3.dircon.co.uk>

stupon@my-deja.com wrote:
> I was trying to get the following to work:
> ===================
> $i = 1;
> $value_{$i}=5; // This is where the problem lies
> 
> print($value_1);
> ===================
> It prints nothing, where as I was hoping for 5.
> It looks kindof pointless like this, but basically
> it would be in a for loop, and would make things
> much easier if it worked this way.
> 
> 

No but what happens if you do :

   print $value_{1};

You have inadvertantly created yourself a hash there which is not what
you were trying to but infact is probably the thing that you should be
doing.

What you are trying to do is a 'a Symbolic reference' but this is largely
frowned upon and is totally unnecessary when there are so many other
data manipulation techniqyes available.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 3 Jun 1999 16:14:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Form Values
Message-Id: <37569be3@newsread3.dircon.co.uk>

Raj <technology@workmail.com> wrote:
> 
> How do i pass the "multiple select" drop-down-box form values from a
> CGI/perl script  to another? Thanx in Advance
> 

You ask in the newsgroup

   comp.infosystems.www.authoring.cgi

Or look in the CGI Faq:

<http://www.webthing.com/tutorials/cgifaq.html>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 3 Jun 1999 12:23:31 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Help! Perl "typo" error
Message-Id: <72x53.6384$%65.13422@tor-nn1.netcom.ca>

I have been using a script I wrote successfully for quite some time, but for
some reason on one of my servers I am now getting the following errors when
I do a syntax check, despite the fact that there are no "typos" in the
variable names. Can anyone tell me what is happenning?

Greatly appreciated,
Kevin

Errors
----------------------
Name "main::ITEM_AFTER_SHIPPING" used only once: possible typo at
/virtualhosts/triple-bypass.com//www/cgi-bin/carts/plans/shop.cgi line 293.

Name "main::options" used only once: possible typo at
/virtualhosts/triple-bypass.com//www/cgi-bin/carts/plans/shop.cgi line 332.

Name "main::tax1" used only once: possible typo at
/virtualhosts/triple-bypass.com//www/cgi-bin/carts/plans/shop.cgi line 460.





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

Date: 3 Jun 1999 16:24:11 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: help: is there a easy way to send mail?
Message-Id: <37569e1b@newsread3.dircon.co.uk>

Bastiaan S van den Berg <office@asc.nl> wrote:
> hi
> 
>  i need some code to send email from a cgi perl script ..
> 

This is a FAQ - perlfaq9:

<FAQ>

How do I send mail? 
Use the sendmail program directly: 


    open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
                        or die "Can't fork for sendmail: $!\n";
    print SENDMAIL <<"EOF";
    From: User Originating Mail <me\@host>
    To: Final Destination <you\@otherhost>
    Subject: A relevant subject line



    Body of the message goes here after the blank line
    in as many lines as you like.
    EOF
    close(SENDMAIL)     or warn "sendmail didn't close nicely";


The -oi option prevents sendmail from interpreting a line consisting
of a single dot as ``end of message''. The -t option says to use the
headers to decide who to send the message to, and -odq says to put the
message into the queue. This last option means your message won't be
immediately delivered, so leave it out if you want immediate delivery.

Or use the CPAN module Mail::Mailer: 


    use Mail::Mailer;



    $mailer = Mail::Mailer->new();
    $mailer->open({ From    => $from_address,
                    To      => $to_address,
                    Subject => $subject,
                  })
        or die "Can't open: $!\n";
    print $mailer $body;
    $mailer->close();


The Mail::Internet module uses Net::SMTP which is less Unix-centric
than Mail::Mailer, but less reliable. Avoid raw SMTP commands. There are
many reasons to use a mail transport agent like sendmail. These include
queueing, MX records, and security.
</FAQ>


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 3 Jun 1999 08:06:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP: Regular Expressions
Message-Id: <MPG.11c039b146ec7c8b989b5f@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7j37pf$i7l$1@nnrp1.deja.com> on Wed, 02 Jun 1999 12:24:21 
GMT, S Starre <sstarre@my-deja.com> says...
> Hi there..

Hi.  Hope your Perl job tribulations are over.
 
> To force the regex to consider the entire line, use ^,$, such as
> 
> /^[a-zA-Z][\w-.]+$/

As I said in my response, that isn't 'the entire line' if there is a 
"\n" at the end.

> Also where is the '_' in the regex?

It is in the "\w", which is "[A-Za-z0-9_]".

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 3 Jun 1999 15:17:37 GMT
From: friendly@hotspur.psych.yorku.ca (Michael Friendly)
Subject: How to create a list-of-lists dynamically?
Message-Id: <7j66ah$57g$1@sunburst.ccs.yorku.ca>

In a module I'm writing, I want to store a list of lists in an object,

	if ($type =~ /$store/) {
		## How to construct this list dynamically from $items??
		my @item = ($lineno, $step, $type, $stmt, $statement);
		push (@{$self->{stored}}, [@item]);
	}

but where the variables in @item are names passed as an option to the
method, in the form,

	$p->mymethod($text, {items => ($lineno, $step)});

How can I create the @item list from the names of the variables passed
in the items option, as in

sub mymethod {# ($text, \%options)
	my $self = $_[0];
	my $text = $_[1];
	my %options = defined $_[2] ? %{$_[2]} : ();
 ..
}

--
Michael Friendly     Email: friendly@yorku.ca (NeXTmail OK)
Psychology Dept
York University      Voice: 416 736-5115  Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA


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

Date: Thu, 3 Jun 1999 05:36:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to scramble (hide) my perl code ?
Message-Id: <0bi5j7.r2i.ln@magna.metronet.com>

Jean Laganiere (jean@laganiere.qc.ca) wrote:

: Subject: How to scramble (hide) my perl code ?
                            ^^^^
                            ^^^^

: Is there a tool to make the script unreadable ?


   There are 2 Frequently Asked Questions with "hide" in the
   question. One of those is:

      "How can I hide the source for my Perl program?"


   How do the suggestions there not meet your needs?


: Thanks in advance.


   Uh huh.


: Please reply to jean@laganiere.qc.ca.


   Ask it here, get the answer here.


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


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

Date: Thu, 3 Jun 1999 15:29:57 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: know Perl to maintain Perl (was: Re: I pass an array...)
Message-Id: <silne1xpxm.fsf@cre.canon.co.uk>

Greg Bacon <gbacon@itsc.uah.edu> wrote:
> Why is Perl the only programming language that seems to be cursed with
> this bizarre requirement of political correctness?  You never hear of
> C programmers writing something in a particular way because it would
> be easier for someone who doesn't understand C.  Lisp programmers
> certainly wouldn't bow to the nonbelievers.

Perl is by no means the only language to be cursed with this "don't use
the appropriate idiom for the language" attitude.

"C Elements of Style" (Steve Oualline) happens to be at hand: here are
some sample rules:

  4-14 Put the operators ++ and -- on lines by themselves.  Do not use
       ++ and -- inside other statements.

  4-15 Never put an assignment statement inside any other statement.  [I
       think "expression" is meant here by "statement" - gdr]

  5-1  Always put a comment in the null statement [when a for or while
       loop has no body - gdr], even if it is only /* Do Nothing */.

  5-15 Avoid do/while.  Use while and break instead.

Lisp is even worse.  Some people come to Lisp and try to write C.  This
can lead to bizarre guidelines like these from Jari Aalto
(ftp://cs.uta.fi/pub/ssjaaa/ema-code.html):

  * put the closing parentheses on a separate line

  * bind all the local variables for a function in one `let' form at the
    start of the block and then assign to them with `setq' (rather than
    binding them with multiple `let' forms as appropriate)

  * don't use `progn', use `and'

  * use an explicit variable for the result of a function, that is,
    don't write

        (defun fact (n) (if (< n 1) 1 (* n (fact (1- n)))))

    but instead write

        (defun fact (n)
          (let* ((result))
            (if (< n 1)
	      (setq result 1)
	      (setq result (* n (fact 1- n))))
            result
            ))
              
  * don't use GENSYM to solve the macro variable capture problem, but
    instead respell the variables used by the replacement form in funny
    ways

So Perl doesn't really have it so bad after all.

-- 
Gareth Rees


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

Date: 3 Jun 1999 16:08:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mail problems... still :)
Message-Id: <37569a75@newsread3.dircon.co.uk>

{comp.lang.perl does not exist why have put this in here }

Bastiaan S van den Berg <office@asc.nl> wrote:
> hiya
> 
> i've got this program running like a breeze now , but unfortunately , i
> can't seem to recieve mail from it..
> 
> i've invested almost 3/4 hours into this program today , and i still can't
> see why it can't mail ..
> 
> plz , there must be some perl-guru's still alive around this time ..
> could you take a look at it , and suggest changes , or rewrite what you
> think needs to be done ..
> 
> tnx!!
> buZz
> 
> btw. don't mind the string values , they're in dutch :)
> 
> -=[code]=-
> 
> $sendmail = "\usr\bin\sendmail"
>              ^^^^^^^^^^^^^^^^^ 

Whats that supposed to be - the most usual place for sendmail is in
/usr/lib/sendmail - you had better ask your ISP - as we have no way of
knowing.

> open (MAIL, "|$sendmail -oi -t") || die ("Content-Type: text/html
> \n\n<html><body>Error opening pipe to $sendmail: $!\n</body></html>\n");
> print MAIL ("To: office\@asc.nl\n",
>             "Subject: [Site] Contactformulier.\n");
> print MAIL "\n\n";
> 


You also appear to have ignored everything else I said about your program
yesterday - so I think I'll just ignore your questions in future.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 3 Jun 1999 11:21:26 -0400
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: mail problems... still :)
Message-Id: <7j66ho$253@falcon.ccs.uwo.ca>

> -=[code]=-
>
> $sendmail = "\usr\bin\sendmail"

Shouldn't this be either  $sendmail = '/usr/bin/sendmail'?
Even if it shouldn,t because you are using the " the backslashes do nothing
for you, it would have to be
$sendmail = "\\usr\\bin\\sendmail";

Other than that I don't see anything wrong with it.  I use sendmail in some
of my programs, and while I don't use a variable in the open statement, it
shoudl work with it.  Let me know how it goes.

Darryl




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

Date: Thu, 03 Jun 1999 16:56:19 +0100
From: Stefan Kuhlins <stefan@kuhlins.de>
Subject: msql, dbi, apache, linux
Message-Id: <3756A5A3.31F6B7CE@kuhlins.de>

The following simple CGI-script runs at the command prompt, but not as 
http://localhost/cgi-bin/test.pl
because auto/DBI/connect.al is not found.
(The content of @INC is in both cases the same!)
Any ideas?

Thanks in advance,
  Stefan

----------------------
#!/usr/bin/perl -w
use DBI;
use CGI;
$q = CGI->new;
print $q->header, $q->start_html('msql Test');
print $q->h1('DBI->available_drivers');
@driver_names = DBI->available_drivers;
print '<ul>';
foreach $drv (@driver_names) {
	print '<li>', $drv, '</li>';
}
print '</ul>';
print $q->end_html;


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

Date: 3 Jun 1999 16:13:22 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl script keeps terminating
Message-Id: <37569b92@newsread3.dircon.co.uk>

kevin <kevin@nospam.co.uk> wrote:
> On 3 Jun 1999 12:55:36 +0100, an opinion was expressed by Jonathan
> Stowe <gellyfish@gellyfish.com> stating:
> 
>>kevin <kevin@nospam.co.uk> wrote:
>>> My perl script has been running fine
>>> until recently when it appears
>>> to auto-terminate within 2-5
>>> mins of of commencing.
>>> 
>>> Any know if this is likely to be
>>> a code/server problem?
>>> 
>>
>>How can we tell? 'auto-terminate' is not a very usefull piece
> 
> <snip>
> 
> Well it is. Because that is all that happens.
> 
> If you do a ps you see it for a set amount of time
> and then 'bingo' it's gone.
> 

Programs dont just go away - have you made any attempt to try and cause
it to give you some message, redirect its STDIO to a file or something.

> I just wondered if anyone else has experienced
> a similar problem. 

But we dont know what your problem is do we - your program ends
unexpectedly thats all you you are saying - that is a symptom that
may be caused for any one of a myriad problems.

>                    The fact that i suspect it 
> may be a server problem does not preclude it from being
> code related does it?
> 

Who knows - you refuse to help us help you.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 3 Jun 1999 08:39:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl script keeps terminating
Message-Id: <MPG.11c0418ba1d378dd989b61@nntp.hpl.hp.com>

In article <37577aa6.21790684@news.free-online.net> on Thu, 03 Jun 1999 
12:57:35 GMT, kevin <kevin@nospam.co.uk> says...
> On 3 Jun 1999 12:55:36 +0100, an opinion was expressed by Jonathan
> Stowe <gellyfish@gellyfish.com> stating:
> >kevin <kevin@nospam.co.uk> wrote:
> >> My perl script has been running fine until recently when it appears
> >> to auto-terminate within 2-5 mins of of commencing.
> >> 
> >> Any know if this is likely to be a code/server problem?
> >
> >How can we tell? 'auto-terminate' is not a very usefull piece
 ...
> Well it is. Because that is all that happens.
> 
> If you do a ps you see it for a set amount of time
> and then 'bingo' it's gone.
> 
> I just wondered if anyone else has experienced
> a similar problem. The fact that i suspect it 
> may be a server problem does not preclude it from being
> code related does it?

Try putting code into an END { } subroutine that writes something to a 
permanent file, which you can examine after the program terminates.  If 
the Perl program terminates in any reasonable manner, the END { } code 
will be executed.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 3 Jun 1999 13:29:05 +0200
From: aussie@gmx.ch (Oliver Timme)
Subject: Perl Script wanted (to send SMS by WWW)
Message-Id: <MPG.11c0856cf815799a989693@dino.active.ch>

Hello all

I'm looking for a Perl script that can take some values from the
command line and send some AT commands to a COM Port. I like
to call that script on a webserver by a HTML Form. The programm
should take the values and send some AT commands to the port.

As example I have two formfields, lets say <form1> and <form2>.
The programm should take the values, send an init string
to the port, like ATZ, then send other commands like:

AT<form1> ..
AT<form2> ..

For what I need this? Well I'd like to connect a nokia cell
phone to my webserver and use the Perl programm to pass the
AT commands to a virtual com port (via Nokia Cell. Data Suite)
and send some SMS messages. You can also say I need for a
quick and dirty WWW to SMS gateway.

Any ideas out there?

Oliver


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

Date: Thu, 3 Jun 1999 10:17:30 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Problem with NULLs
Message-Id: <x3y1zft4bd1.fsf@tigre.matrox.com>


quanlay@my-deja.com writes:

> I would like to use a standard routine to write
> to a database using a module but I can seem to
> write NULLs to a variable and write it to the
> database.

what are NULLs? Perl has no NULLs. Maybe you mean undef?

> The database can accept nulls and in some
> instances, other programs accessing the database
> expect them.
> 
> Currently, an example of my code looks like this:
> 
> package testnull;
> 
> sub new {
>   my $test = shift;
>   my $class = ref($test) || $test;
>   my $self = {
>     String => '',
>     Integer => 0,
>     Nothing => null

	Nothing => undef,

>   };
>   bless($self, $class);
>   return $self;
> }
> 
> sub Write {
>   my $self = shift;
>   my $sql = "
>     INSERT INTO testtable (
>     String, Integer, Nothing
>     ) VALUE (
>     $self->{String},
>     $self->{Integer},
>     $self->{Nothing}
>     )
>   ";

Maybe you would like to use a heredoc here. It make things a bit
prettier.

>   return $sql;
> }
> 
> ...
> 
> Anyhow the return SQL statement is written to the
> database but the problem is that it chokes.

Chokes?

> Nothing could be an Integer or a Null.  I want to
> avoid if thening the $self->Nothing for an undef
> or null to build a sql statement of
> ... $self->(Integer), null) ...
> because I want the full sql in one statement
> quote if possible...
> 
> Any Suggestions?

I don't know SQL, so I am not sure. But I have the feeling that 'null'
is a keyword in SQL. Now, $self->{Nothing} could be either an integer
or the 'null' keyword, if I understand correctly. So what's wrong with
setting:
		$self->{Nothing} = 'null';

in your new() method. You can change it to an integer or back to
'null' if you wish. No need for any "if thening" ;-)

I still don't see your problem.

Ala



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

Date: Thu, 03 Jun 1999 15:46:04 GMT
From: Chris Manolis <cmanolis@clementpappas.com>
Subject: Problem with opening 2 files at once. Please Help!!!!
Message-Id: <3756A378.E4896CC0@clementpappas.com>

Can anyone please help me.  I wrote the following script to capture
outgoing calls from my
PBX.  The file c:/temp/phone.dat is used as a test file and contains
some sample incoming data.
What I try to do is read the incoming data and create separate files
based on date.

SAMPLE INCOMING DATA:
05 23  <---- this is the date 

0722 0004 7   9  71         4557705   275                            5
0     16   

0810 0012 7   9  71         4557705   275                            5
0     10   

05 24

0812 0004 7   9  76         9353282   223                            5
0     07   

0825 0005 7   9  71         4551700   223                            5
0     08   

0844 0034 7   9  71     18008091463   211                            7
0     15   


The Script works fine on an WinNT PC but when I try to run it on a LINUX
PC I get the error

Can't write file : No such file or directory at pbx line 27, <INPUT>
chunk 1.

line 27 contains this:
         open (OUTPUT, ">> /root/$datafile") or die "Can't write file :
$!";  

The only diference between the WinNT and Linux are the INPUT and OUTPUT
paths.

Please HEEEELLLLLPPPPP!!!!!!!!!!!!!

Please email your replies to
cmanolis@clementpappas.com

Thanks Chris Manolis
--------------------------- BEGIN SCRIPT
-------------------------------------------------

open (INPUT, "c:/temp/phone.dat")	# Open file for read OR device
     or die "Couldn't Open the file : $!\n";
	
while(<INPUT>) {
	$in_data=$_; # Read first record
	$in_datecheck = substr($in_data,5,2);
	if ($in_datecheck=~/^[\r\n]+$/) # Check if record contains just the
date
		{
			$in_datemm=substr($in_data,0,2);
			$in_datedd=substr($in_data,3,2);
			$datafile="pbx$in_datemm$in_datedd.dat";
		}
	else { 			# If the record does not contain the date read record fields 

			$in_time = substr($in_data,0,4);
			$in_duration = substr($in_data,5,4);
			$in_outcalln = substr($in_data,20,15);
			$in_ext = substr($in_data,36,5);
			$in_chanel = substr($in_data,76,3);
	
				if ($in_time ne "\n") # If the in_time field DOES NOT contain new
line and CR codes 
						      # Then add record to data file
						{
				open (OUTPUT, ">> c:/temp/$datafile") or die "Can't write file :
$!"; 
				print OUTPUT $in_datemm," ",$in_datedd," ",$in_time,"
",$in_duration," ",$in_outcalln,$in_ext,$in_chanel,"\n";
				close(OUTPUT);
						}
		  }

}
close(INPUT);
-------------------------------- END SCRIPT
----------------------------------------


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

Date: Thu, 03 Jun 1999 03:01:51 GMT
From: npolonsk@hotmail.com
Subject: Re: String extraction problem - please help?
Message-Id: <7j4r6s$4dc$1@nnrp1.deja.com>

If you're looking for a lot of info on Regular expressions you can
pickup the O'Reilly and Associates "Owl" book on RE. If you just want a
quick reference, O&A also has a perl pocket ref that has some good RE
stuff in it as well.

If I wanted to extract that data from a string here's how I'd do it:

($month, $number) = ($line[0]=~ /\/usr\/home\/avert\/www\/cgi\/archive_
(\d{2})\/(\w{3}).+/im);

If you pardon the line wrapping you'll see that this RE expression
captures what is in the parenteses in your string and puts them into
the two strings at the beginning of the line. the '\' before each '/'
is to "escape" the special meaninf of the '/'. The (\d{2}) is to look
for 2 decimal characters specifically and put them in the $x spaces you
mentioned earlier. I'm pretty sure that by specifying ($month, $number)
you are giving names to what is otherwise $1, $2.

I'm sure that someone else would do it another way, but this is the
most readable way that I could concieve to do it. I also tested the
above string and it works, putting your 3 letter month in $month and 2
digit number in $number.

Finally, I don't like the idea of ridiculing someone for asking a
question, no matter how stupid it may seem. The whole point of the
usenet is to share information and ask seemingly stupid questions.
I learned perl by playing with it and asking questions, it wasn't until
recently that I could actually understand some of the perldocs that are
available. The best thing to do if you're realling interested is get
one of the O&A books. Either the "Camel" book (Programming Perl) or the
other one "Learning Perl".

--Nathan

--
------------------
Nathan Polonski
Input Support Engineer
NewsEdge Corporation


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 3 Jun 1999 16:04:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: stupid ISP?
Message-Id: <37569965@newsread3.dircon.co.uk>

Bastiaan S van den Berg <office@asc.nl> wrote:
> hiya
> 
>  i just mailed my isp for the 2853-th time , and finally they replied ...
> 
>  i wanted a copy of the perl logs , but they said that perl doesn't make
> logs! , is this true , or should i be flaming there asses off right now?
> 

Yes they are correct Perl does not make logs - however when used in a CGI
program then any error messages Perl creates will go into the HTTP servers
error_log.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 3 Jun 1999 15:44:25 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: The artistic license and perl:
Message-Id: <slrn7ld8t2.77v.fl_aggie@thepentagon.com>

On Thu, 03 Jun 1999 12:01:14 GMT, Chris Nandor <pudge@pobox.com>, in
<pudge-0306990801170001@192.168.0.77> wrote:
+ In article <yl7lpm56bc.fsf@windlord.stanford.edu>, Russ Allbery
+ <rra@stanford.edu> wrote:

+ # This is a tool of our trade.  The license on a free software package is
+ # it's *protection*.

+ But the Artistic License does protect, and protect well, for some values
+ of "protect" (the ones I care about).

Only if the license is enforcable, which it may not be. Or it may come
to pass that the interpretation that is enforced is not one that you
think should.

Admittedly, I fall asleep when I look at licenses...

James



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

Date: 3 Jun 1999 16:16:20 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Trying to make custom start page for users via cookie and perl.  Help please?
Message-Id: <37569c44@newsread3.dircon.co.uk>

SiKnight <knightrdr@nospam.com> wrote:
> On 30 May 1999 11:21:48 -0000, Jonathan Stowe
> <gellyfish@gellyfish.com> wrote:
> 
>>On 28 May 1999 14:15:08 -0500 SiKnight wrote:
>>> [SNIP]
>>Oh thats a shame.  I think that you will probably want to ask in a group
>>that is interested in such matters - comp.infosystems.www.authoring.cgi
>>
>>/J\
> So, you're telling me that this group isn't interested in matters in
> PERL?  Gee, I guess the name of the newsgroup is deceiving...
> 

But your question wasnt about Perl it was about SSI and CGI.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 03 Jun 1999 08:47:41 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: knightrdr@nospam.com
Subject: Re: Trying to make custom start page for users via cookie and perl.  Help please?
Message-Id: <3756A39D.A486A4AD@atrieva.com>

SiKnight wrote:

> So, you're telling me that this group isn't interested in matters in
> PERL?  Gee, I guess the name of the newsgroup is deceiving...

Quite the opposite.  You have made a fairly common mistake by equating
Perl with CGI, which is clearly not the case.  Perl has nothing to do
with cookies, custom pages, or web enabled applications.  The referral
to one of the many CGI focused newsgroups is quite appropriate, as that
is where they *do* deal with cookies, custom pages, and web enabled
applications.

If you are trying to implement these things in Perl, then this may be an
appropriate news group.  However, no one here cares about your project,
so attempting to describe what you want to do is futile.  A better
approach is to describe specific parts of your implementation that are
giving you problems.

Example:

*BAD*  I want to put a widget in my foobaz so I can retrieve xactblats
over the internet.  How can I do this?

*GOOD*  The following code is supposed to place widget in my foobaz,
however the xactblats are never retrieved.  The documentation for widget
says X, but I'm not understanding part Y where is states Z.  Can I get
some clarification?

<CODE>

Good Luck!

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Thu, 03 Jun 1999 08:04:00 -0700
From: Nick Lee <leenick@interchange.ubc.ca>
Subject: turn cache off in IE
Message-Id: <37569960.33FD5603@interchange.ubc.ca>

Hi,

Anyone knows how to turn OFF the cache in IE? I've tried using the
header called Pragma (with a value of "no-cache"), but it seems to
work only in NS, not in IE. IE still cache the document and doesn't
reload unless I press 'refresh' explicitly.


Any help is appreciated,
Nick


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

Date: Thu, 03 Jun 1999 10:10:33 -0500
From: Burton Kent <burton.not.spam@lucent.com>
To: zenin@bawdycaste.org
Subject: Re: Tying a double knot in a hash
Message-Id: <37569AE9.F7B8A15E@lucent.com>

I'm wondering if 'use'ing SDBM_File makes my
tied hash not work, since it imports its own
subroutines for the tied hash.

Is the following code helpful?

package Tasks;
use SDBM_File;

sub TIEHASH  {
        my $hash = {};  #needed for bless;
        my $DATABASE = "/home/burton/audit/data/tasks.db";

        #dbmopen(%{$hash}, $DATABASE, 0700) ||
        #tie (%{$hash}, 'SDBM_File', "$DATABASE", O_RDWR|O_CREAT, 0700) ||
        #       die "Could not open database $DATABASE\n";

        bless ($hash, $_[0]);
}

> 
>         Your code please, or we can't help you much.
> 
>         Consider this however:
> 
>         package DoubleKnot;
>         sub TIEHASH {
>             my $class = shift;
> 
>             my $self = bless {}, $class;
> 
>             tie %{ $self->{MyDBM} }, 'AnyDBM_File', @args or die $!;
>             return $self;
>         }
> 
> --
> -Zenin (zenin@archive.rhps.org)         Caffeine...for the mind.
>                                         Pizza......for the body.
>                                         Sushi......for the soul.
>                                              -- User Friendly


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5874
**************************************

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