[18924] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1119 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 12 14:10:57 2001

Date: Tue, 12 Jun 2001 11:10:16 -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: <992369415-v10-i1119@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 12 Jun 2001     Volume: 10 Number: 1119

Today's topics:
    Re: Mysql connect specifying port (isterin)
    Re: Mysql connect specifying port <vmurphy@Cisco.Com>
        MYSQL DBI:  $sth->execute($variable) is not working. (Frank M)
    Re: MYSQL DBI:  $sth->execute($variable) is not working <someone@one.net>
    Re: MYSQL DBI:  $sth->execute($variable) is not working nobull@mail.com
    Re: MYSQL DBI:  $sth->execute($variable) is not working <postmaster@127.0.0.1>
        New word <gamtci@mpinet.net>
    Re: newbie question <mjcarman@home.com>
    Re: newbie question <jddp@tid.es>
        Pipe problem (expressionlibre)
    Re: Pipe problem (Anno Siegel)
    Re: printing from webpage <pne-news-20010612@newton.digitalspace.net>
    Re: Q: How to make a Perlscript Shareware? <pne-news-20010612@newton.digitalspace.net>
    Re: Q: How to make a Perlscript Shareware? nobull@mail.com
    Re: Simplest code to test if web site is up? (B Wooster)
        SNMP - We need advice <ronald.rijerkerk@compaq.com>
    Re: sorting a hash on part of its value? <andras@mortgagestats.com>
    Re: Sorting versions of a file, Help needed <afshina@newbridge.com>
    Re: Spurious "Ambiguous call resolved as ..." warning nobull@mail.com
    Re: Table/Cell formatting with CGI.pm (E.Chang)
    Re: Table/Cell formatting with CGI.pm <mjcarman@home.com>
    Re: Table/Cell formatting with CGI.pm (Craig Berry)
    Re: Table/Cell formatting with CGI.pm <paanwa@hotmail.com>
    Re: The meaning of $#, $/, and $* (Craig Berry)
    Re: Vars, vars, vars... <ren@tivoli.com>
    Re: What is ${'string'} ? (Tad McClellan)
    Re: What is ${'string'} ? <bart.lateur@skynet.be>
    Re: What is ${'string'} ? <mjcarman@home.com>
    Re: What is ${'string'} ? nobull@mail.com
    Re: Win32::OLE Question (isterin)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 12 Jun 2001 07:56:47 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Mysql connect specifying port
Message-Id: <db67a7f3.0106120656.ff09751@posting.google.com>

There is actually a mail list for DBI an DBD::*,  send email to
dbi-users-help@perl.org for subscription info.

Ilya

antikythera_bloodbath@hotmail.com wrote in message news:<9g4j2l$nrf$1@news.netmar.com>...
> As this has to do with the Perl DBI, and I couldn't find a mysql specific
> newsgroup I posted it here.
> 
> I need to specify the port which is used to connect to the host. Up till now I
> have been running the script on a localhost and did not need to specify the
> port. Below is the code fragment with the connect command.
> 
> my ($dsn) = "DBI:mysql:database:hostname.host.com"; 
> my ($database_user_name) = "username";
> my ($database_password) = "password";
> 
> $dbh = DBI->connect ($dsn, $database_user_name, $database_password);
> 
> I am able to run mysql with the -P <port> option from the command line. My
> question is how would I go about specifying the port in the call to connect.
> 
> my ($dsn) = "DBI:mysql:database:hostname.host.com"; 
> my ($database_user_name) = "username";
> my ($database_password) = "password";
> my ($database_port) = "11111"; 
> 
> $dbh = DBI->connect( ?????? );
> 
> 
> Thanks in advance.
> 
> Anti
> 
>  -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
>   http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
>    NewsOne.Net prohibits users from posting spam.  If this or other posts
> made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: 12 Jun 2001 13:02:31 -0400
From: Vinny Murphy <vmurphy@Cisco.Com>
Subject: Re: Mysql connect specifying port
Message-Id: <m3u21l1viw.fsf@vpnrel.cisco.com>

antikythera_bloodbath@hotmail.com writes:

> As this has to do with the Perl DBI, and I couldn't find a mysql specific
> newsgroup I posted it here.
> 
> I need to specify the port which is used to connect to the host. Up till now I
> have been running the script on a localhost and did not need to specify the
> port. Below is the code fragment with the connect command.
> 
> my ($dsn) = "DBI:mysql:database:hostname.host.com"; 
> my ($database_user_name) = "username";
> my ($database_password) = "password";

From 'perldoc DBI'

           Examples of "$data_source" values are:

             dbi:DriverName:database_name
             dbi:DriverName:database_name@hostname:port
             dbi:DriverName:database=database_name;host=hostname;port=port


-- 
Vinny


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

Date: 12 Jun 2001 08:18:25 -0700
From: frm@writeme.com (Frank M)
Subject: MYSQL DBI:  $sth->execute($variable) is not working.
Message-Id: <5bfbdc2b.0106120718.2ef4daa9@posting.google.com>

Hello,

I have a Join query as follows:

SELECT Employees.FirstName, Employees.LastName, PhoneNumbers.* 
  FROM Employees, PhoneNumbers
  WHERE Employees.UserName = PhoneNumbers.UserName
  ORDER BY Employees.LastName;

I want Perl/DBI to access the data and sort it according to a user
defined variable for the sort column:

 $sortby = $ENV{'QUERY_STRING'};  
 #Column given by the user (like Employees.FirstName)

 my $sql_statement = "SELECT Employees.FirstName, Employees.LastName,
PhoneNumbers.*
 FROM Employees, PhoneNumbers						
 WHERE Employees.UserName = PhoneNumbers.UserName
 ORDER BY ?";

 my $sth = $dbh->prepare($sql_statement);
 $sth->execute($sortby) or die "Can't execute SQL statement :
$dbh->errstr";


The Query gets the info from the database, but the sort method does
not work.  I am not sure if $sortby is even being passed to the ORDER
BY ? at all.  What could be causing this?

Any response is greatly appreciated.  Thanks!


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

Date: Tue, 12 Jun 2001 15:43:29 -0000
From: Sean Keplinger <someone@one.net>
Subject: Re: MYSQL DBI:  $sth->execute($variable) is not working.
Message-Id: <tice519e93l6ef@corp.supernews.com>

Frank M <frm@writeme.com> wrote:

>  my $sth = $dbh->prepare($sql_statement);
>  $sth->execute($sortby) or die "Can't execute SQL statement :
>  $dbh->errstr";

> The Query gets the info from the database, but the sort method does
> not work.  I am not sure if $sortby is even being passed to the ORDER
> BY ? at all.  What could be causing this?

Try doing this:

  my $sth = $dbh->prepare($sql_statement);
  $sth->bind_param(1,$sortby);
  $sth->execute;


HTH,
Sean

-- 
 Sean Keplinger   |                        )\._.,--....,'``.     
  (skeplin at     |  "Are you a lion,     /,   _.. \   _\  (`._ ,.
  one dot net)    |   or an antelope?"   `._.-(,_..'--(,_..'`-.;.'



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

Date: 12 Jun 2001 17:45:55 +0100
From: nobull@mail.com
Subject: Re: MYSQL DBI:  $sth->execute($variable) is not working.
Message-Id: <u9snh51wak.fsf@wcl-l.bham.ac.uk>

frm@writeme.com (Frank M) writes:

>  my $sql_statement = "SELECT Employees.FirstName, Employees.LastName,
> PhoneNumbers.*
>  FROM Employees, PhoneNumbers						
>  WHERE Employees.UserName = PhoneNumbers.UserName
>  ORDER BY ?";

Not that this has anything to do with Perl but doesn't the "ORDER BY"
clause in SQL expect a column name list, not an expression?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 12 Jun 2001 18:17:20 +0100
From: Anthony Peacock <postmaster@127.0.0.1>
Subject: Re: MYSQL DBI:  $sth->execute($variable) is not working.
Message-Id: <3B264EA0.DDBE6E6A@127.0.0.1>

Frank M wrote:
> 
> Hello,
> 
> I have a Join query as follows:
> 
> SELECT Employees.FirstName, Employees.LastName, PhoneNumbers.*
>   FROM Employees, PhoneNumbers
>   WHERE Employees.UserName = PhoneNumbers.UserName
>   ORDER BY Employees.LastName;
> 
> I want Perl/DBI to access the data and sort it according to a user
> defined variable for the sort column:
> 
>  $sortby = $ENV{'QUERY_STRING'};

Is this how you really get the value for $sortby?

Have you printed what this scalar is being set to?

You can always use the DBI trace() method to see exactly what is
happening.


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

Date: Tue, 12 Jun 2001 15:29:20 GMT
From: Gary <gamtci@mpinet.net>
Subject: New word
Message-Id: <3B2635A0.407E@mpinet.net>

Since version 6 is in the brew, to whom might I suggest a
keyword/function?

Since having used require and use, I find that a simpler merge 
would be handy, particularly if all one wanted to do was have a 
Perl script brought it to the currently being read/compiled one 
as though the merged-in file were part of the original file and 
at the location merge was encountered.


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

Date: Tue, 12 Jun 2001 08:30:26 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: newbie question
Message-Id: <3B261972.382D8FDC@home.com>

Juan Delgado wrote:
> 
> But i have just installed 5.6.1 version and the warnings.pm file 
> is in the
>     /usr/local/lib/perl5/5.6.1
> directory. It doesn't seem to be mixed.

If you have more than one version of Perl installed on your machine
(which is not uncommon, at least on *nix systems) then you need to be
careful about which one you invoke. If you type 'which perl' where does
it point? You may need to edit your shebang line (the very first line in
your script -- the one that starts with #!) to explicity point to a
particular version if your script doesn't run properly under the
whichever perl is the default.

> Is it correct to have a function like this in that file:
[snip]

Why are you mucking with a standard module? If you don't know what
you're doing (and with a subject like "newbie question" it's a safe
assumption that you don't) then don't screw around with the
distribution. The module was fine the way it was. Hands off!
 
> Lots of thanks
> Juan
> 
> Anno Siegel wrote:
> >
[...]

Anno has asked you several times to stop top-posting. You're going to
raise his blood pressure if you keep doing it. Do NOT quote an entire
message and then stick your reply at the top. Go read this
    http://www.geocities.com/nnqweb/nquote.html
to learn how to reply to a post properly. If you refuse to learn, expect
to end up in a lot of killfiles. (Not a threat, just a warning.) Having
good manners is important, especially in this newsgroup.

-mjc


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

Date: Tue, 12 Jun 2001 19:43:48 +0200
From: Juan Delgado <jddp@tid.es>
Subject: Re: newbie question
Message-Id: <3B2654D3.C5192F8F@tid.es>

Hi Michael,

Sorry if i missunderstood what Anno was telling me when he said that about
top-posting, my english is not so good as that. I agree that good manners
are important.

Juan



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

Date: 12 Jun 2001 06:47:21 -0700
From: expression_libre@yahoo.com (expressionlibre)
Subject: Pipe problem
Message-Id: <83c74064.0106120547.3d4144eb@posting.google.com>

Hi,

I'm learning how to fork() and pipe() so I try to build a
"simple" example :

Reads lines from a file "a" in a FATHER process,
send them through a pipeline to a CHILD process which
writes them to a file named "A" after some work on them...

My child process is able to read data from the pipe and works on them
but it never writes output to the file.

Worse of it : IT NEVER STOPS. (must 'kill' child process when program ends)

(The child process ends normally if it doesn't try to read from pipe)

Did I forget anything in the script ?

----------------------------------------------------------------------------
#!/usr/local/bin/perl -w

use strict;

# Creating pipeline :
pipe (Fi, Fo);

# Creating a child process to compute data from pipe :
my $pid;
if ($pid=fork)
{
  print "\nFATHER process running. (Child is PID $pid)\n";
  open (F1, "<a");
  # Reading lines from F1 :
  while (my $l=<F1>)
  {
    # Send line into pipe for child process :
    print Fo $l;
  }
  
  close F1;
  close Fo;
  print "\nExiting from FATHER...\n";
  }
elsif ($pid==0)
{
  print "\nCHILD process running. (Father is PID ".getppid.")\n";
  open (F2, "+>A");
  # Reading lines from pipeline :
  while (my $l=<Fi>)
  {
    $l=uc($l); # Example of work : uppercase line
    print "\n $l"; # OK
    print F2 "$l"; # Does nothing
  }
  close F2;
  close Fi;
  print "$s Exiting from CHILD...\n"; # Line never reached
  # Terminate child process :
  exit;
}
else
{
  die "\nCannot \"fork\" : $!";
} 
print "\n End of program";


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

Date: 12 Jun 2001 14:33:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Pipe problem
Message-Id: <9g598k$13d$1@mamenchi.zrz.TU-Berlin.DE>

According to expressionlibre <expression_libre@yahoo.com>:
> Hi,
> 
> I'm learning how to fork() and pipe() so I try to build a
> "simple" example :
> 
> Reads lines from a file "a" in a FATHER process,
> send them through a pipeline to a CHILD process which
> writes them to a file named "A" after some work on them...
> 
> My child process is able to read data from the pipe and works on them
> but it never writes output to the file.
> 
> Worse of it : IT NEVER STOPS. (must 'kill' child process when program ends)
> 
> (The child process ends normally if it doesn't try to read from pipe)
> 
> Did I forget anything in the script ?

Yes, a couple of precautions.  One of them leads to the effect you
are seeing, but I'll point out others too.
 
> ----------------------------------------------------------------------------
> #!/usr/local/bin/perl -w
> 
> use strict;
> 
> # Creating pipeline :
> pipe (Fi, Fo);

  pipe (Fi, Fo) or die "Can't create pipe: $!\n";

Always check the return value of a system call.

> # Creating a child process to compute data from pipe :
> my $pid;
> if ($pid=fork)
> {
>
>   print "\nFATHER process running. (Child is PID $pid)\n";
>   open (F1, "<a");

    open (F1, "<a") die "Can't read a: $!\n";

Always check...

Also, you should close file handles you are not going to use.
This is especially important with pipes, so

    close Fi;

>   # Reading lines from F1 :
>   while (my $l=<F1>)
>   {
>     # Send line into pipe for child process :
>     print Fo $l;
>   }
>   
>   close F1;
>   close Fo;
>   print "\nExiting from FATHER...\n";
>   }
> elsif ($pid==0)
> {
>   print "\nCHILD process running. (Father is PID ".getppid.")\n";
>   open (F2, "+>A");

Why are you opening F2 for read/write?  You are only writing it.

    open (F2, '>A') or die "Can't create A: $!\n";

Again, close the filehandle(s) you aren't using, here

    close Fo;

This is the omission that threw you.  As long as have the writing
end of a pipe open, there can't be an eof condition on the reading
end, so your loop will never end.  That nothing ever arrives at the
far end (as it seems) must be due to buffering, I suspect.

>   # Reading lines from pipeline :
>   while (my $l=<Fi>)
>   {
>     $l=uc($l); # Example of work : uppercase line
>     print "\n $l"; # OK
>     print F2 "$l"; # Does nothing
>   }
>   close F2;
>   close Fi;
>   print "$s Exiting from CHILD...\n"; # Line never reached
>   # Terminate child process :
>   exit;
> }
> else
> {
>   die "\nCannot \"fork\" : $!";
> } 
> print "\n End of program";

Anno


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

Date: Tue, 12 Jun 2001 16:30:09 +0200
From: Philip Newton <pne-news-20010612@newton.digitalspace.net>
Subject: Re: printing from webpage
Message-Id: <4p9cit4fdsmdd5fjonn4ea4q6rajdum8be@4ax.com>

On Tue, 12 Jun 2001 14:16:31 +0200, S.E.Franke <snefski@hotmail.com>
wrote:

> I'm making a webpage that shows something in a template. I want to print 
> the same data on the users printer.

I suggest asking on comp.infosystems.www.authoring.cgi, as this is not a
Perl problem. I don't even know whether it's a CGI problem, but they
might be able to help you further.

> i know I can use javascript, but then some ugly headers are printed......

I would guess you could only use JavaScript (or other client-side
scripting language) for this. Well, or other active content such as Java
or ActiveX controls.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Tue, 12 Jun 2001 16:25:31 +0200
From: Philip Newton <pne-news-20010612@newton.digitalspace.net>
Subject: Re: Q: How to make a Perlscript Shareware?
Message-Id: <gb9cit02cersnqpvm0bim87sq0ucc5mb52@4ax.com>

On Tue, 12 Jun 2001 11:58:52 +0200, "Tom Klinger" <admin@the-piper.net>
wrote:

> From my point of view why not earn money with your code when it is used by a
> company which makes finally money using your script while you have to
> develope all that code?

Why not indeed? I believe, for example, that Radiator, a "configurable
and flexible Radius server that supports authentication by a huge range
of authentication methods" uses that approach:
http://www.open.com.au/radiator/ .

> I know that there are too many gurus out there who can modify the code,
> sure.

So forbid it in your license conditions that potential customers have to
accept before they can buy your software; that way, if someone tries to
circumvent those features, you can seek legal recourse.

> But why not give it a try?

Trying to make software uncrackable is probably an exercise in futility.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 12 Jun 2001 17:47:23 +0100
From: nobull@mail.com
Subject: Re: Q: How to make a Perlscript Shareware?
Message-Id: <u9puc91w84.fsf@wcl-l.bham.ac.uk>

"Tom Klinger" <admin@the-piper.net> writes:

> My problem now is how to secure the code so that for example a pro version
> will expire for example after 30 days or only runs if is already licensed?
> I know that there are too many gurus out there who can modify the code,
> sure.

I trust you reliase that this is a FAQ: "How can I hide the source for
my Perl program?"

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 12 Jun 2001 09:17:26 -0700
From: b.wooster@usa.net (B Wooster)
Subject: Re: Simplest code to test if web site is up?
Message-Id: <cb45ebcb.0106120817.7343e64@posting.google.com>

Philip Newton <pne-news-20010611@newton.digitalspace.net> wrote in message news:<t08aito255ut6hiag8521019b1bf37lf16@4ax.com>...
> On 11 Jun 2001 11:35:58 -0700, b.wooster@usa.net (B Wooster) wrote:
> 
> > check if the web server at a particular site is up?

> [use libwww-perl, and do a HEAD]

> [On other approaches:]
> You could, but it probably wouldn't be much fun (get the IP address of

I agree, looks like libwww-perl is best solution, 
unfortunately, my web server host does not include 
libwww-perl (I can of course add the files to my own CGI folder).

In the end, I decided to change my requirements (wanted to stick
to Perl CGI - if it was easy), and have decided to go with PHP3,
a single line - $file = fopen("http://myurl/", "r") does exactly
the same thing, so that is what I ended up using...

> Oh, and Perl 5.004 is also slightly old. Is there a reason that prevents
> you from upgrading to 5.005_03 or even 5.6.1?
> Philip

I misswrote - (my head is still stuck seeing 5.004 all over the place),
I'm upto 5.6.0 right now.

Thanks for all the input!


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

Date: Tue, 12 Jun 2001 17:59:29 +0200
From: "Ronald Rijerkerk" <ronald.rijerkerk@compaq.com>
Subject: SNMP - We need advice
Message-Id: <I3rV6.1382$fi2.39415@news.cpqcorp.net>

We are currently working on a custom application, which should get SNMP-TRAP
messages from an UPS, which is attached to a MS-NT-Server. Does anybody have
any experience with SNMP-programming in any language.(vb,c++,perl, etc.).

Ronald




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

Date: Tue, 12 Jun 2001 13:02:15 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: sorting a hash on part of its value?
Message-Id: <3B264B16.3D460BC1@mortgagestats.com>



Mark Grimshaw wrote:

> Hi all,
>
> I have what I suspect is a highly inefficient algorithm (due to the
> number of loops I have) for sorting a hash based on _part_ of its value
> string.  (perldoc -q sort only demonstrates how to sort a hash on all of
> its value string.)  What I have works but is slow.  I would appreciate
> any help in making the alogorithm more efficient/quicker.
>
> The value string of my DB_File db is delimited by '¬' and among other
> data, contains the UNIX time of when a user last logged on (using a
> bulletin board I've written).
>
> A further complication is that this UNIX time may be the same across
> different key : value pairs (if people happen to have logged on in the
> same second).
>
> Additionally, I need to keep the rest of the hash value tied to its UNIX
> time so that I can display, for example, who it was who logged in at
> that time.
>
> example:
>
> key : status¬email¬numposts¬UNIX time¬etc.¬etc.¬etc. although my actual
> UNIX time is in index 10.
>
> I need to sort the hash on UNIX time which may be the same as another
> UNIX time in another key : value pair.
>
> Here's the code I'm using:
>
>         foreach $key(keys %USER)
>         {
>                 @string = split(/¬/, $USER{$key});
>                 if($string[10] ne 'null')
>                 {
>                         push(@time, $string[10]);
>                 }
>                 else
>                 {
>                         push(@reprobates, $key); # these will be
> displayed last - order unimportant.
>                 }
>         }
>         @time = reverse sort {$a <=> $b} @time; # to get last login time
> first.
> # highly inefficient sort algorithm - needs sorting ;) some time
>         foreach(@time)
>         {
>                 $time = $_;
>                 @names = keys %USER;    # keys are the names of users which
> will be $profile'ised
>                 BACK2: foreach(@names)
>                 {
>                         $name = $_;
>                         foreach(@done)
>                         {
>                                 next BACK2 if($name eq $_);     #
> already done this one
>                         }
>                         @string = split(/¬/, $USER{$name});
> # doesn't matter if $time happens to be from another @string (another
> key:value pair)
> # as it's simply the login time and if 2 people happen to have logged in
> at the same time, who cares
> # which is displayed first.
>                         if($string[10] eq $time)
>                         {
> # check for spaces in usernames
>                                 $profile = $name;
>                                 if($profile =~ / /)
>                                 {
>                                         $profile =~ s/ /%20/g;
>                                 }
>                                 push(@done, $name);
>                                 last;
>                         }
>                 }
>                 $time = q_time_of_post($time); # pulled from an external
> module - simply formats $time
>                                                 # into readable format
>                 print "<LI><A
> HREF=\"register.cgi?view=$profile\">$name</A>,
>                         last seen: $time";
>         }

Try this: I think

sort {(split(/¬/, $USER{$b})[10]  <=> (split(/¬/, $USER{$a})[10] } keys %USER

would give you a list of the keys in %USER sorted descending by time.




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

Date: Tue, 12 Jun 2001 09:59:54 -0400
From: Afshin Akbari <afshina@newbridge.com>
Subject: Re: Sorting versions of a file, Help needed
Message-Id: <3B26205A.9E1F830B@newbridge.com>

All,


I just wanted to thank you all for replying. I got pretty good ideas.
I have not timed any of them to see which code is the fastest
but they all look more efficiend than the one I wriote.

Once again, thanks for all the help.

Thanks,
aa-



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

Date: 12 Jun 2001 17:47:59 +0100
From: nobull@mail.com
Subject: Re: Spurious "Ambiguous call resolved as ..." warning
Message-Id: <u9ofrt1w74.fsf@wcl-l.bham.ac.uk>

rolf.krahl@gmx.net (Rolf Krahl) writes:

> (I am still using Perl 5.00503)

> Sys::Hostname requires syscall.ph in main context

This bug is fixed in the Sys::Hostname shipped with 5.6

> Well, fine, does anybody got an idea, how i can avoid this warning
> without having to qualify all calls to system as CORE::system in my
> programs?

You may find the new Sys::Hostname will work under 5.5.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 12 Jun 2001 13:56:40 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Table/Cell formatting with CGI.pm
Message-Id: <Xns90BE658E3E74Cechangnetstormnet@207.106.92.86>

"PaAnWa" <paanwa@hotmail.com> wrote in
<tic0vaalbb53ca@corp.supernews.com>: 

> The main problem I am still having is getting the correct
> formatting for placing a param('') variable inside a cell -- it
> seems that no matter what I do the code does not work.

param() is not a variable, it is a subroutine call.  It will not be 
interpolated.
> 
> Here is what I am trying to accomplish:
> 
> print "<td><input type='textbox'

textbox is not an HTML input type.  I think you mean type="text" 

> name='Contact_FirstName'value="

You quoted string ends with this " , creating a syntax error.

,param('Contact_FirstName'),"></td>";

What are the commas doing there?
As noted before, param() will not be interpolated.

> Why do I need this?  

Why do you need what?

Try 

print '<td>',
       textfield(-name=>'Contact_FirstName',
                 -default=>"insert_your_initial_value_if_any"),
       '</td>';

The very complete documentation for CGI.pm is available online at 
http://stein.cshl.org/WWW/software/CGI/.  Study the examples that it 
includes.

-- 
EBC


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

Date: Tue, 12 Jun 2001 10:43:47 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Table/Cell formatting with CGI.pm
Message-Id: <3B2638B3.15DAB78A@home.com>

"E.Chang" wrote:
> 
> "PaAnWa" <paanwa@hotmail.com> wrote in
> <tic0vaalbb53ca@corp.supernews.com>:
> 
> > name='Contact_FirstName'value="
> 
> You quoted string ends with this " , creating a syntax error.

No, the syntax is fine.

> ,param('Contact_FirstName'),"></td>";
> 
> What are the commas doing there?

Seperating the list of arguments to print().

> As noted before, param() will not be interpolated.

Who said it was? It will be evaluated. (Look more closely, the call is
outside of double-qoutes.) Syntactically, the OP's code is equivilant to
this:

    print "aaa", f('x'), "bbb";

-mjc


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

Date: Tue, 12 Jun 2001 16:52:00 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Table/Cell formatting with CGI.pm
Message-Id: <tici5gs5sdalf4@corp.supernews.com>

PaAnWa (paanwa@hotmail.com) wrote:
: The main problem I am still having is getting the correct formatting for
: placing a param('') variable inside a cell -- it seems that no matter what I
: do the code does not work.
: 
: Here is what I am trying to accomplish:
: 
: print "<td><input type='textbox'
: name='Contact_FirstName'value=",param('Contact_FirstName'),"></td>";

It's 'textarea', not 'textbox'.  And this is astonishingly easy using
CGI.pm:

  use CGI qw(:all);
  print td(textarea('Contact_FirstName'));

CGI.pm is your friend.  Note that it will automagically fill in the value
of the Contact_FirstName parameter as the text area value.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Magick is the art and science of causing change in conformity
   |   with Will."  - Aleister Crowley


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

Date: Tue, 12 Jun 2001 13:51:19 -0400
From: "PaAnWa" <paanwa@hotmail.com>
Subject: Re: Table/Cell formatting with CGI.pm
Message-Id: <ticlkojk7q6q6b@corp.supernews.com>

*sigh*

You are absolutely right Craig!

Can you tell I was having a bad day?

I am trying to convert

print "<td><input type='text' name='Contact_FirstName' size='35'
value=",param('Contact_FirstName'),">";

into CGI.pm compatible code.  Sorry for the confusion with my bad HTML
reference.  The CGI.pm documentation is quite extensive but not entirely
clear when it comes to putting various snippets of code together.  That is
the basis of my question.

When I try to insert the textfield() in a td() things are OK; when I try to
insert a param() inside the textfield() in a td() things go all haywire.
Can anyone give me an example of the syntax?

--
PAW
"Red meat is NOT bad for you.  Now blue-green meat, that is REALLY BAD for
you."
                                --Tommy Smothers








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

Date: Tue, 12 Jun 2001 16:41:45 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: The meaning of $#, $/, and $*
Message-Id: <tichi94aoa173c@corp.supernews.com>

Philip Newton (pne-news-20010612@newton.digitalspace.net) wrote:
: On Tue, 12 Jun 2001 05:53:09 -0000, cberry@cinenet.net (Craig Berry)
: wrote:
: [$#]
: > Note that it could behave the old way when set, and the new way when read.
: > I'm sure a tiny fraction of the scripts using $# ever read its value.
: 
: E2MUCHMAGIC. Try explaining *that* behaviour to a beginner :-)

Yeah, I know, I know.  I'd prefer just ditching the old interpretation,
and making $# read-only.  Then you'd get a hard error (and have to fix the
script) if older code was using $#.  It's been deprecated for how long,
now?

Of course, those of us who used to code at the device register level find
nothing unusual about the same address having utterly different read and
write semantics. :)

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Magick is the art and science of causing change in conformity
   |   with Will."  - Aleister Crowley


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

Date: 12 Jun 2001 10:23:12 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Vars, vars, vars...
Message-Id: <m33d95n2n3.fsf@dhcp9-173.support.tivoli.com>

On Tue, 12 Jun 2001, horst.fickenscher@sealsystems.de wrote:

> Ren Maddox wrote:
> 
>> The reason I shy away from this method is that it allows you to get
>> by with a typo more easily.  Usually, this isn't a problem as the
>> "used only once" warning will still protect you, but I guess I'm
>> just more comfortable with the explicit protection that lexical
>> declarations provide (when combined with strictures, of course).
> 
> Ok, in Your first posting You suggested to use a hash ref $cfg
> with key "timeout" e.g.
> 
> I use this method too sometimes, but one should be aware that it
> doesn't protect against typos at all, not even with the "used only
> once" warning:
> 
> $cfg->{timeuot} ist just undefined.

Oops... how hypocritical of me... :-[

Let's see... how to recover....

I know!  Do what I usually actually do... create a module and use
Importer!

Or, you could use Tie::StrictHash.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 12 Jun 2001 08:51:22 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: What is ${'string'} ?
Message-Id: <slrn9ic42a.f0k.tadmc@tadmc26.august.net>

Gordon.Haverland@gov.ab.ca <Gordon.Haverland@gov.ab.ca> wrote:

>As the subject field says, what is ${'some_string'} ?


A symbolic reference, documented in perlref.pod.


>Would their be any reason why someone would use this, 
                ^^^

Yes. But it nearly never is _required_. There is most often
a Better Way.


>instead of any
>other variable, when their is only 1 unique string used in the entire
>program.


   http://www.plover.com/~mjd/perl/varvarname.html
   http://www.plover.com/~mjd/perl/varvarname2.html
   http://www.plover.com/~mjd/perl/varvarname3.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 12 Jun 2001 15:07:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: What is ${'string'} ?
Message-Id: <hsbcitc2b2elrkrh0mvgf3na8mfd3ta2ts@4ax.com>

Tad McClellan wrote:

>>As the subject field says, what is ${'some_string'} ?
>
>A symbolic reference, documented in perlref.pod.

Notez that even though ${'some_string'} is a symbolic reference,
${some_string} is NOT. strict doesn't complain, and it can be used on
lexicals, where symbolic references ca nonly access globals.

	use strict;
	use vars '$some_string';
	{
		no strict;
	    ${'some_string'} = 123;
	}
	print ${some_string};
	my $abc = 456;
	print ${abc};
-->
	123456

-- 
	Bart.


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

Date: Tue, 12 Jun 2001 10:05:32 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: What is ${'string'} ?
Message-Id: <3B262FBC.BF21A546@home.com>

Gordon.Haverland@gov.ab.ca wrote:
> 
> As the subject field says, what is ${'some_string'} ?

It's a soft (symbolic) reference to the global variable $some_string.
The use of symrefs is highly discouraged. cf.
    http://perl.plover.com/varvarname.html

> Would their be any reason why someone would use this, instead of any
> other variable, when their is only 1 unique string used in the entire
> program.

Without seeing the program, I can't speculate as to why they would have
used it, but it's completely unnecessary. Novices sometimes make
misguided use of symnrefs to allow them to have "variable variable
names" but there is no reason whatsoever to have a symref with a static
name.

-mjc


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

Date: 12 Jun 2001 17:50:09 +0100
From: nobull@mail.com
Subject: Re: What is ${'string'} ?
Message-Id: <u9lmmx1w3i.fsf@wcl-l.bham.ac.uk>

Michael Carman <mjcarman@home.com> writes:

>        ...there is no reason whatsoever to have a symref with a static
> name.

Well, it allows you to use characters in variable names that would
normally be illegal.

That's hardly a _good_ reason but it is a "reason whatsoever".

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 12 Jun 2001 08:00:07 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Win32::OLE Question
Message-Id: <db67a7f3.0106120700.7f44f489@posting.google.com>

Use Spreadsheet::ParseExcel and Spreadsheet::WriteExcel

Ilya

"keng" <keng@spinalfluid.com> wrote in message news:<9g4q7k$j81$1@violet.singnet.com.sg>...
> hi all,
> was wondering if anyone can explain this to me.
> i want to open excel application under win98 but just cannot get it to work.
> however i can open word application instead.
> i am using office 2000 on win98
> pls help
> thanks
> 
> my script as below
> 
> use Win32::OLE;
> #can work
> $ex = Win32::OLE->new('Word.Application') or die "oops\n";
> $ex->{Visible}=1;
> 
> #cannot work
> #$ex = Win32::OLE->new('Excel.Application') or die "oops\n";
> #$ex->{Visible}=1;


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1119
***************************************


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