[13483] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 893 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 23 18:07:31 1999

Date: Thu, 23 Sep 1999 15: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: <938124311-v9-i893@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 23 Sep 1999     Volume: 9 Number: 893

Today's topics:
    Re: (-d $filename) test (Larry Rosler)
    Re: [perl c exe switch off question] (Michael Stevens)
    Re: Be careful about using constants <michael@shoebox.net>
    Re: beauty of a Y2K bug (Michael Stevens)
    Re: Case insensitive SQL query <gellyfish@gellyfish.com>
    Re: CGI sending email with attachment <gellyfish@gellyfish.com>
    Re: CGI sending email with attachment <gellyfish@gellyfish.com>
    Re: Compile problem (Michael Stevens)
    Re: confusing localtime (Michael Stevens)
    Re: confusing localtime <gellyfish@gellyfish.com>
    Re: DBD::Pg problem (Michael Stevens)
    Re: DBD::Pg problem <codex@bearclaw.bogus.net>
    Re: decomposing an outline-style text body (ugly regexp <kbandes@home.com>
    Re: HELP: Newbie opendir question <gellyfish@gellyfish.com>
        How do I get this to work? <master@openendon.com>
    Re: ODBC and sub-routines (Larry Rosler)
    Re: Perl - CGI -MySQL (Michael Stevens)
        Perl friendly server <wizard@psychodad.com>
    Re: perl multi-thread ? (Michael Stevens)
    Re: Problems 'use'ing URI::URL and CGI in the same scri <gellyfish@gellyfish.com>
    Re: proper 'my' usage <aqumsieh@matrox.com>
    Re: Term::Cap <gellyfish@gellyfish.com>
    Re: two frames using pelr <gellyfish@gellyfish.com>
    Re: You should be admired (Michael Stevens)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 23 Sep 1999 14:50:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: (-d $filename) test
Message-Id: <MPG.12544073f725e72b989fca@nntp.hpl.hp.com>

In article <37ea82c5.5121970@news.club-internet.fr> on Thu, 23 Sep 1999 
20:09:16 GMT, Vasile Calmatui <vasile@club-internet.fr> says...
> >> #concatenes two pathes and be sure a '\' is added between
> >
> >Ack!  Don't *DO* that.  Win32 can understand paths separated by '/' just
> >as well.
> 
> You mean Win32 Perl "understand ...", isn't it ?

No.  It means the Windows/DOS file systems understand ...

> >  Also, doing it that way means your routines are portable across 
> >many operating systems.  The only reason (okay, I'm exaggerating a
> >little) you should ever use '\\' in a Win32 system is when you're passing 
> >arguments to CMD.EXE.
> 
> You mean "passing arguments outside Perl", isn't it ?

No, essentially the problem is restricted to the so-called command 
interpreter, as he said.

 ...

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


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

Date: 23 Sep 1999 21:24:44 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: [perl c exe switch off question]
Message-Id: <slrn7ul6ks.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 13:37:52 -0700, tonyko <tonyko@pacbell.net> wrote:
>Is there a way to disable user's capability calling hisCprogram.exe from
>inside his perlscript ?

Use the Safe module. It comes with recent perls.

>Is there a way to figure out who I disable and who I did not from a perl
>script ?

If some serious looking gentlemen start explaining about your right
to remain silent, this is one clue you may accidentally have disabled
someone.



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

Date: 23 Sep 1999 13:11:06 -0800
From: Michael Fowler <michael@shoebox.net>
Subject: Re: Be careful about using constants
Message-Id: <87ogetpc45.fsf@beowulf.one.eth>

Tom Phoenix <rootbeer@redcat.com> writes:

> On 23 Sep 1999, Michael Fowler wrote:
> > Because autoloading is done at run-time, any constant lookups do incur
> > the overhead of a subroutine call.
> 
> [Maybe I'm misunderstanding you?] No, this happens at compile time. If
> your code uses a constant like this:
> 
>     use constant PI => 3.1416;
> 
>     $sin_two_pi = sin(2 * PI);
> 
> ...perl should calculate the sin of two PI at compile time

The discussion on autoloaded constants (from what I gathered of it)
was originally regarding Fcntl.pm's odd way of doing constant lookups.
Instead of defining them all at compile-time, it'd export the constant
names and do lookups via autoload and XS.  That would incur run-time
subroutine calls.

Does that clarify any?


Michael
--
There isn't a mome rath alive that can outgrabe me.
--


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

Date: 23 Sep 1999 20:55:54 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: beauty of a Y2K bug
Message-Id: <slrn7ul4uq.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 11:22:56 -0700, David Cassell <cassell@mail.cor.epa.gov> wrote:
>Randal L. Schwartz wrote:
>[snip of painfully-funny maldesigned code]
>> And this stuff is all over.  No telling how many scripts are available
>> in those "free download" areas but not indexed by the spiders.
>I think we'll be able to tell right around January 1 [or perhaps
>Monday the 3rd], when all the users of those kludges come
>crying to this ng for rescue.  Maybe Jocelyn will keep count
>for her next news article.

It might be interesting to study this vaguely scientifically -- 
keep an articles/day count for various programming groups, watch the
rise after jan 1st, and see which language has the worst y2k problem
(yes, it's not exactly statistically rigorous, but it should be 
amusing)



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

Date: 23 Sep 1999 20:18:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Case insensitive SQL query
Message-Id: <7se1ug$93b$1@gellyfish.btinternet.com>

On Wed, 22 Sep 1999 21:29:44 GMT mrbog@my-deja.com wrote:
> 
> 
> Fuck the "accepted" charter. This is the INTERNET. We as a people
> decide our social standards, not some controlling higher body.
> 

Fine yes. This process is indeed what you are witnessing here, we as a
body of people have a consensus as to what is appropriate topic for this
group - there is no controlling body, there is no cabal who decide - this 
is a consensus - the practical application of the compromise and cooperation
and *resolve* that is necessary in a society without a power structure.

Of course there are guidelines and conventions, some even codified into
rules - these are described in the articles posted to the group
news.announce.newusers .

If you feel that you dont want to engage usenet in a way that is tolerable
to the other users then I suggest that you newgroup alt.mrbog and there you
can do and say just about anything you like without the risk of offending
anyone else.

> And yes, by the way- if I had a "general algorythym" question I
> definately might post it to a perl programming group  (or a java group
> or a c group or a lisp group) Know why? Because is TANGENTIALLY RELATED.
> 

That would almost certainly be a complete waste of time and energy on your
part. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 20:51:26 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI sending email with attachment
Message-Id: <7se3se$95t$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 16:24:59 GMT Kragen Sitaker wrote:
> In article <37ea51cd_2@newsread3.dircon.co.uk>,
> Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>>Burt Hwang <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com> wrote:
>>> To tell you the truth, I don't really know what I'm doing.  But as I've
>>> observed from other email source codes, it looks like you would define a
>>> boundary, then use it with "--" before each.  Am I wrong?  To me, it looks
>>> like I AM using the same boundary, no?  Here's my code again and sample
>>> email source(see bottom)
>>
>>Yes you are wrong.  You are not using the same boundary because the one
>>that you declare has no dashes in from of it.  Again if you dont what
>>you are doing use a module like MIME::Lite.
> 
> Actually, Burt Hwang is correct.  From RFC 1521:
>    The Content-Type field for multipart entities requires one parameter,
>    "boundary", which is used to specify the encapsulation boundary.  The
>    encapsulation boundary is defined as a line consisting entirely of
>    two hyphen characters ("-", decimal code 45) followed by the boundary
>    parameter value from the Content-Type header field.
> 

Hmm.  You are entirely correct.  My answer was based purely on observation -
I have a program that for one reason and another cannot use MIME::Lite so
what I did was send myself a message with the appropriate attachments and
copy the headers into a here document and then fill in the blanks - and that
was how the boundaries were. Lazy yes, lame probably, pragmatic certainly
but the wonder of it is that it works at all - I think it is probably
because the specified boundary had the two dashes in front of it in the
first place and the mail client compromises to deal with that from other
crap clients.  

I think I'll go back and fix that tomorrow.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 20:56:06 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI sending email with attachment
Message-Id: <7se456$960$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 12:06:15 -0400 Burt Hwang wrote:
> Jonathan Stowe wrote in message <37ea48ed_1@newsread3.dircon.co.uk>...
>>Burt Hwang <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com> wrote:
>>>
>>>
>>>   print MAIL "Content-Type: multipart/mixed; boundary=\"gc0y0pkb9ex\"\n";
>>
>>In the rest of the output you are using a different boundary.  If you dont
>>understand what you are doing with this code then I would recommend
>>that you use the module MIME::Lite available from CPAN.
>>

I take all of that back : the problem is because there should be another
newline between the part header and the body of the attachment:

>   print MAIL "Content-Disposition: attachment;\n
> filename=\"$filename\"\nContent-Transfer-Encoding: base64\n";

that should end " ...base64\n\n"; instead.

Sorry about any confusion - you will have noticed I was confused too ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 20:59:04 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: Compile problem
Message-Id: <slrn7ul54o.1qq.mstevens@swirl.internal.fict>

On Wed, 22 Sep 1999 14:00:18 -0700, MORRISON DAVIS <MORRY.DAVIS@Sun.COM> wrote:
>Below is the error message, any ideas how to fix this? Solaris 2.6 cc
>4.2

Why do you seem to think that posting this 3 times is more
likely to get an answer?

(alternatively, you may have a problem with your news server you
_really_ should be aware of...)


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

Date: 23 Sep 1999 21:00:00 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: confusing localtime
Message-Id: <slrn7ul56f.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 11:04:28 -0700, Tim Diller <t.dillerNOovSPAM@xpres.com> wrote:
>Hi!
>According to the ctime man pages, the month is returned as 
>a value from 0 to 11 indicating the current month.
>Could it be that localtime doesn't add one to this value?

It's documented to return in the range 0..11. see perldoc -f localtime.



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

Date: 23 Sep 1999 21:25:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: confusing localtime
Message-Id: <7se5sq$97c$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 00:48:16 -0400 Z. Huang wrote:
>     Today is 9/23/99. But localtime shows 8/23/1999. I tested it on two
> unix machines with the same result. Anyone one knows why?
> 


=item localtime EXPR

Converts a time as returned by the time function to a 9-element array
with the time analyzed for the local time zone.  Typically used as
follows:

    #  0    1    2     3     4    5     6     7     8
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
						localtime(time);

All array elements are numeric, and come straight out of a struct tm.
In particular this means that C<$mon> has the range C<0..11> and C<$wday>
has the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the
number of years since 1900, that is, C<$year> is C<123> in year 2023,
and I<not> simply the last two digits of the year.

If EXPR is omitted, uses the current time (C<localtime(time)>).

In scalar context, returns the ctime(3) value:

    $now_string = localtime;  # e.g., "Thu Oct 13 04:54:34 1994"

This scalar value is B<not> locale dependent, see L<perllocale>, but
instead a Perl builtin.  Also see the C<Time::Local> module, and the
strftime(3) and mktime(3) function available via the POSIX module.  To
get somewhat similar but locale dependent date strings, set up your
locale environment variables appropriately (please see L<perllocale>)
and try for example:

    use POSIX qw(strftime);
	$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;

Note that the C<%a> and C<%b>, the short forms of the day of the week
and the month of the year, may not necessarily be three characters wide.

-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 21:02:42 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: DBD::Pg problem
Message-Id: <slrn7ul5bi.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 08:44:07 GMT, Codex <codex@bearclaw.bogus.net> wrote:
>I, ahem, have come across a problem. I've followed the perldoc for DBD::Pg
>(as far as I can tell), but I'm still having trouble.
>The code I am trying to get to work is as follows:
>$dbname="foo";
>$dbuser="nobody";
>$dbpasswd="";
>DBI->trace(2,"/tmp/dbi.trace.out");
>$dbh = DBI -> connect("dbi:Pg:dbname=$dbname",$dbuser,$dbpasswd);
>if($DBI::errstr) {
>   print STDERR $DBI::errstr;
>   exit(1);
>}
>$table="film";
>$statement = $dbh->prepare("SELECT DISTINCT genre FROM $table");
>$rv = $dbh->do($statement);
>The error I get is:
>DBD::Pg::db do failed: ERROR:  parser: parse error at or near "dbi"
>I can't for  the life of me see what I've done wrong here.

I think the problem is that you're trying to 'do' a statement handle,
when do is meant to be given a query in string form. see perldoc DBI.



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

Date: Thu, 23 Sep 1999 21:56:21 GMT
From: Codex <codex@bearclaw.bogus.net>
Subject: Re: DBD::Pg problem
Message-Id: <9mxG3.391$pn4.2421@news1.online.no>

Michael Stevens <mstevens@ashre.demon.co.uk> wrote:

> I think the problem is that you're trying to 'do' a statement handle,
> when do is meant to be given a query in string form. see perldoc DBI.

Damnit, you might be right.

[...]

You sure are. I shouldn't use prepare() at all! Perhaps the DBD::Pg
is a little ambiquous?

Or perhaps I am on crack?

Thanks a bunch! I've been reading DBD::Pg so much I thought my eyes would
wear out.

 .cdx


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

Date: Thu, 23 Sep 1999 17:56:03 -0400
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: decomposing an outline-style text body (ugly regexp question)
Message-Id: <37EAA1F3.5349EB8B@home.com>

George Willman wrote:
>     Here's a sample, and following it will be my 3 failed attempts and
> ideas.  \n's are explicitly noted since word wrapping is notoriously
> variable across the net (what's so bad about green phosphor terms?? :) ).
> Throw me a bone if you would, please.
> 
> <START OF $_>
> 1. Event: Foundation of Rome\n
>     A. blah blah....\n
> blah Romulus.\n
>     B. yet more blah... Remulus\n
> blah Wolf blah blah Rivers.\n
> 2. Event: Foundation of 3 River's Stadium\n
>     A. blah blah...Hoffa...blah\n
> blah blah concrete.\n
>     B. blah... dirt nap.\n
>     C. you get the picture...\n
> <END OF $_>
> 
> Ideally (well maybe not, suggestions are certainly welcome on any fronts),
> 
> @paragraph=(1,Foundation of Rome,A. blah *everything up to*
> Rivers.,2,Foundation of 3 River's Stadium,A. blah *everything up to* nap.)
> 
>     This assumes my next step would be to go into @paragraph and breakout
> every 3rd element and hash/decompose IT further into (1.A, *contents of
> 1.A*, 1.B, etc).  From here I'd be set to turn the beast loose on 1.5 gigs
> of existing data (well, at least they kept good records), go to sleep and
> let it populate mySQL.

This works on your sample data but I haven't tested it extensively:

@paragraphs = 
  /^(\d+)\.\s+Event:\s+(.+?)$(.+?)(?=(?:^\d+\.\s+Event:\s+|\z))/gms;

notes:
- Uses non-greedy match on the event to capture everything up to
the end-of-line ($ when m flag is used).
- Uses non-greedy matching again to capture the rest of event.
- Uses lookahead (?=) to match up to another Event or the end of 
string (\z).

Ken Bandes


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

Date: 23 Sep 1999 21:40:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: HELP: Newbie opendir question
Message-Id: <7se6ng$97j$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 12:03:26 -0500 Bruce Welton wrote:
> I am trying to use the opendir function in a script to open a directory
> one level up from my cgi-bin, and something in my setup does not allow
> that script to process.  It is as follows:
> 
> #opendir(DIR,"/home/~wbwelton/public_html/entry");

This I suppose is the line that you are having trouble with - despite
it being commented out here.  I doubt (although this is not impossible)
that you actually have a tilde in your pathname.

When using opendir (as with open) you should always check whether it was
succesful before you use the dirhandle :

opendir(DIR,'/home/dir/wbwelton/public_html/entry') || die "opendir - $!\n";

although in the CGI environment you might want to trap the error in some
other way if you want to get a meaningful message to the users browser.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 23 Sep 1999 21:36:22 GMT
From: Jordan DeLozier <master@openendon.com>
Subject: How do I get this to work?
Message-Id: <938102052.1691932465@news.tds.net>

Hello,
	I have a couple of scripts and people have to put in their passwords to
log in. The password looks something like this:

if ($password =~ "$check") {
&dothis;
}

if someone has a password of "Login" and they put in "Loginnow" as their
password, it still thinks it is right. How can I make this script only take
"Login" and not "Loginnow"? Exact Matches, not these type of things.

Thanks,
Jordan DeLozier




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

Date: Thu, 23 Sep 1999 14:47:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ODBC and sub-routines
Message-Id: <MPG.12543fcf736b9956989fc9@nntp.hpl.hp.com>

In article <37EA60AC.E39A6252@magix.com.sg> on Fri, 24 Sep 1999 01:17:32 
+0800, Jonathan Teo <jonnyace@magix.com.sg> says...
> Hello, is anyone there? I've received no reply to this question. Is it
> really so stupid a question? If so,
> I should receive at least a few flames? *Any* pointers at all, pleeease. I
> know there's a lot of you
> gurus out there and I'm honestly stuck. Come on, give me a break!

First suggestion:  get a newsreader that doesn't produce sick line 
breaks like those above.

 ...

> > exit if ($mydb = connectDB("nt10", "abcd", "efgh") == undef);

The test above is bogus.  Probably your connection failed and you don't 
know it.

Second suggestion:

    die "with a suitable descriptive error message" unless
        defined($mydb = connectDB("nt10", "abcd", "efgh"));

 ...

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


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

Date: 23 Sep 1999 21:11:30 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: Perl - CGI -MySQL
Message-Id: <slrn7ul5s2.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 12:32:16 -0400 (EDT), KernelKlink@webtv.net <KernelKlink@webtv.net> wrote:
>c_j_marshall@hotmail.com
>wrote:  
>=========
>Good question. And I'm sure the guys on the MySQL newsgroup would be
>delighted to receive it. 
>But not us. 
>Where is the MySQL newsgroup? I searched deja.com before I posted here,
>but could not find such a newsgroup.

So, how come here is suddenly the right place, purely because you
couldn't find the proper place for such a question?


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

Date: 23 Sep 1999 16:44:01 -0500
From: "Michael D. Kirkpatrick" <wizard@psychodad.com>
Subject: Perl friendly server
Message-Id: <x9xG3.12158$F07.363162@newscene.newscene.com>

I am in the process of setting up a Unix server and I am looking at setting
up to allow anyone to sign up for an account to host web sites and be
completely Perl CGI friendly.  Of course I would have to charge a $10/month
fee.  I am also going to allow anyone to have a Domain name on the server at
no additional charge.  It will have DNS servers closely tied for that
purpose only.  You would only be responsible for obtaining a domain name
from network solutions.  If you don't want a domain name, you can be found
at www.mydomain.com/your_account_name.

This server will be tied to a dedicated T-1 link for 24/7 access.  Also to
make things handy for yourself for debugging your perl scripts, you would
also have access to your log files for your site.  I will have it all
written where you just go to a specific url to access it via your web
browser.  I will have several features written like a guestbook where you
would have full access to it for your site.  Your own counter which you will
have access to it as well.  All info would be provided on the help pages and
when you sign up.  Anyway, I am starting the code writing this evening for
an automated interface for signing up and complete server setup.

Please E-Mail me at perlserver@psychodad.com if you are interested.  This is
to see if there is a high enough demand for this service to be available.
In the future, I will work on an E-Mail help system for all members.  It
would be like an e-mail news group.




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

Date: 23 Sep 1999 21:13:09 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: perl multi-thread ?
Message-Id: <slrn7ul5v5.1qq.mstevens@swirl.internal.fict>

On 23 Sep 1999 13:59:06 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>In comp.lang.perl.misc, 
>    shawn fang <shawn@unifygroup.com> writes:
>:I have a perl scripts that forks a lot of children.  How can I reduce
>:the footprint of those processes ?  
>Perl is big.  Perl makes big processes.  Forking is largely irrelevant
>to this.    If you change the data, then it costs, but only that.

I have no idea as to the actual trends here, but it would not surprise
me to hear that there are implementations of unix out there without shared
copy-on-write stuff for forking...


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

Date: 23 Sep 1999 21:59:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problems 'use'ing URI::URL and CGI in the same script
Message-Id: <7se7s4$9aq$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 18:14:02 GMT mbarnicle@my-deja.com wrote:
> Hiya,
> 
> I'm having trouble with the following code:
> 
> #!/bin/perl
> 
> use URI::URL;
> use CGI qw(:standard :escape :unescape);
> 
> print header;
> print "Hello, World!<br>\n";
> 
> When I execute it, I get the following error:
> 
> Prototype mismatch: sub main::url ($;$) vs none
> at /usr/local/lib/perl5/CGI.pm line 205.
> 
> Has anyone seen this before?  Is there some way to get around this?  I
> would really like to be able to use URI::URL and CGI in the same
> script, if possible.  Thanks,
> 

Ooh - its something very strange about the way that CGI manipulates the
symbol table in its import() function :

      *{"${callpack}::$sym"} = \&{"$def\:\:$sym"};

You ought to see the errors you get when you put the two uses round the other
way ;-}

I havent got any inclination to get right to the bottom of this but it can
be overcome by using the Object Oriented interface to CGI.pm in which case
this case is not used.

#!/usr/bin/perl -w

use URI::URL:

use CGI;

my $q = CGI->new;

print $q->header ;

etc ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 23 Sep 1999 15:48:01 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: proper 'my' usage
Message-Id: <x3yln9xwgsv.fsf@tigre.matrox.com>


Marty Landman <marty@catnmoose.com> writes:

> Is there a penalty to be paid by saying 'my $he' within the for loop in
> bar?  Or is this a reasonable way of doing my declarations?

My benchmarks suggest that there is a slight gain in speed if you
declare your variables outside the loop. But, I am not exactly sure as
to what Perl actually does, and I recall a thread in this ng that
discussed this around 1 year ago. I wan't able to find the thread but
I'll try to look again later.

Personally, I would usually declare my variables whenever I need
them. This limits their scope correctly, and allows for cleaner and
easier to read programs. The only time that I might consider doing it
differently is if there is a significant gain in speed. Note that if
you document why you did things the way you did, readability will not
suffer much.

HTH,
--Ala



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

Date: 23 Sep 1999 21:46:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Term::Cap
Message-Id: <7se744$98j$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 12:26:41 -0500 Marshall Culpepper wrote:
> This is a fairly trivial question, but I'm currently using the Term::Cap
> Module to output text in an xterm in certain plot points....
> 
> I've got the code working just great, but I'd like to make it look a
> little more pleasing to the eye, so I thought there might be a way to
> bolden and italicize the text (i'm not really interested in coloring the
> text just yet)
> 
> Can anyone point me to some documentation on this subject?

man termcap in concert with the Term::Cap manpage should be enough - your
actual termcap file (often /etc/termcap ) may be annotated as well. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 21:34:06 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: two frames using pelr
Message-Id: <7se6ce$97g$1@gellyfish.btinternet.com>

On Thu, 23 Sep 1999 16:58:34 GMT nallurichandu@my-deja.com wrote:
> Hello Friends,
> 
>  my home page consists of frames in the home1frame  i have the user name
> and password field once i submit the data to login.pl file.if he is a
> valied user then i want to open a up a new frame removing the existing
> frame. if he is a invalied user it should give a message in the
> homeframe2.please help me in this regard.
> 

Please dont post four times, if you have problems with your newsreader
you should file a bug report to its author.

If you are using the module CGI.pm then you should read the section of
the manpage that is entitled:

   WORKING WITH NETSCAPE FRAMES

If that doesnt address your need then you should read the CGI FAQ at:

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

If that doesnt work then you should address this to the correct newsgroup
which in all probability is comp.infosystems.www.authoring.cgi

[followups set]

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 23 Sep 1999 21:20:54 GMT
From: mstevens@ashre.demon.co.uk (Michael Stevens)
Subject: Re: You should be admired
Message-Id: <slrn7ul6dm.1qq.mstevens@swirl.internal.fict>

On Thu, 23 Sep 1999 16:06:33 +0930, Henry Penninkilampi <spamfree@metropolis.net.au> wrote:
>In article <slrn7uifmp.e5i.abigail@alexandra.delanet.com>, Abigail
><abigail@delanet.com> wrote:
>> ## In my book, it's OK to make a mistake *once* and we should all exercise a
>> ## little bit of patience when newbies pose questions.  Venomous attacks are
>> ## possibly best reserved for those that *repeatedly* demonstrate their lack
>> ## of research skills, don't you think?
>> No. You're a whiner.
>:^o  Oooohhh.  Gee that hurt.  Sniff, sniff.
>
>Tell me, Abigail, how does a petulant child gain respect in life?  I'm
>wondering if you know - you seem to be an authority on the subject.

I don't know about anyone else, but abigail has gained my respect
by consistently being right.


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

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 893
*************************************


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