[25381] in Perl-Users-Digest
Perl-Users Digest, Issue: 7626 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 10 11:05:57 2005
Date: Mon, 10 Jan 2005 08:05:27 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 Jan 2005 Volume: 10 Number: 7626
Today's topics:
Re: 20050119: quoting strings <steve@holdenweb.com>
Re: CGI::upload() fails to return valid handle <zen13097@zen.co.uk>
Re: copying values from a hash into CGI.pm via tied has <tomi.hasa@gmail.com>
Re: CRYPT:RC5 problem, can't unencrypt derekg0@gmail.com
Re: DOM newbie problem, please help! <nobull@mail.com>
Re: FAQ 4.30: How do I capitalize all the words on one <abigail@abigail.nl>
Re: FAQ 4.30: How do I capitalize all the words on one <bik.mido@tiscalinet.it>
Re: FAQ 4.30: How do I capitalize all the words on one <tadmc@augustmail.com>
Re: File::Find::find() is depth-first? <bik.mido@tiscalinet.it>
Re: HELP needed for a small script <Some.One@hotmail.com>
Re: HELP needed for a small script <noreply@gunnar.cc>
Re: HELP needed for a small script <tadmc@augustmail.com>
How to create phone dialer (DUN) app in perl for win32 <noway@notarealemail.com>
I don't get what this is de-referencing. <cdalten@gmail.com>
Re: I don't get what this is de-referencing. <tassilo.von.parseval@rwth-aachen.de>
Re: I don't get what this is de-referencing. <mritty@gmail.com>
Interactive shell from system()? bh_ent@hotmail.com
Re: Loading module in another module <vito_corleone@godfather.com>
Re: Loading module in another module <shawn.corey@sympatico.ca>
Re: pack and unpack ? ineverlookatthis@yahoo.com
Re: pack and unpack ? ineverlookatthis@yahoo.com
passing $cgi object in hash. <sam.wun@authtec.com>
Re: passing $cgi object in hash. <sam.wun@authtec.com>
Re: passing $cgi object in hash. <mritty@gmail.com>
Re: perl tutorial <bik.mido@tiscalinet.it>
portable no warnings "uninitialized" <uffesterner@spamhole.com>
Re: portable no warnings "uninitialized" (Peter Scott)
Re: portable no warnings "uninitialized" <noreply@gunnar.cc>
Re: shutdown of linux box from cron perl script <sjs@sonic.net>
Tk: Call subroutine when MainWindow is realized? <josef.moellers@fujitsu-siemens.com>
Re: Tk: Call subroutine when MainWindow is realized? <zentara@highstream.net>
Re: XML::Smart, how to print out tree <bart@NOSPAM.tvreclames.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 10 Jan 2005 05:35:27 -0500
From: Steve Holden <steve@holdenweb.com>
Subject: Re: 20050119: quoting strings
Message-Id: <QXsEd.71628$Jk5.68279@lakeread01>
Xah Lee wrote:
> #strings are enclosed in double quotes quotes. e.g.
> a="this and that"
> print a
>
> #multiple lines must have an escape backslash at the end:
> b="this\n\
> and that"
> print b
>
> #One can use r"" for raw string.
> c=r"this\n\
> and that"
> print c
>
> #To avoid the backslash escape, one can use triple double quotes to
> print as it is:
> d="""this
> and
> that"""
> print d
>
> ---------------
> # in Perl, strings in double quotes acts as Python's triple """.
> # String is single quote is like Python's raw r"".
> # Alternatively, they can be done as qq() or q() respectively,
> #and the bracket can be just about any character,
> # matching or not. (so that escapes can be easy avoided)
>
> $a=q(here, everthing is literal, $what or \n or what not.);
> $b=qq[this is
> what ever including variables $a that will be
> evaluated, and "quotes" needn't be quoted.];
> print "$a\n$b";
>
> #to see more about perl strings, do on shell prompt
> #perldoc -tf qq
> Xah
> xah@xahlee.org
> http://xahlee.org/PageTwo_dir/more.html
>
Well, that gets that sorted out, then.
Tomorrow: using single quotes. Using single quotes. The larch.
regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
------------------------------
Date: 10 Jan 2005 09:09:51 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: CGI::upload() fails to return valid handle
Message-Id: <41e2465f$0$14258$db0fefd9@news.zen.co.uk>
On Sun, 09 Jan 2005 23:27:51 +0100,
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>
> Anyway, as I suspected the problem is in the form. Try
>
> start_form(-enctype => 'multipart/form-data')
>
Aha! Thanks Gunnar, that fixed it.
Your post got me to read (yet again!) the CGI.pm docs, and I found
this:
"filefield() will return a file upload field for Netscape 2.0
browsers. In order to take full advantage of this you must use the
new multipart encoding scheme for the form. You can do this either
by calling start_form() with an encoding type of &CGI::MULTIPART,
or by calling the new method start_multipart_form() instead of
vanilla start_form()."
Don't know how I missed that the first 10 times. :-/
Anway, using start_multipart_form() as suggested above solved my
problem.
Many thanks.
------------------------------
Date: 10 Jan 2005 05:22:39 -0800
From: "=?iso-8859-1?B?VG9taSBI5HPk?=" <tomi.hasa@gmail.com>
Subject: Re: copying values from a hash into CGI.pm via tied hash reference
Message-Id: <1105363359.694486.301320@c13g2000cwb.googlegroups.com>
ioneabu@yahoo.com wrote:
>
> Regarding my poor posting practices recently, specifically
> improper quoting, this is due to Google's new beta version of
> groups.google.com.
> [...]
>
> I hope that Google fixes this, I don't know exactly who to
> complain to.
If you want to report problems with Google Groups Beta, you can use
this feedback page:
http://groups-beta.google.com/support/bin/request.py
Or you can send email to Google Groups Beta:
labs-groups2@google.com (labs-groups2 @ google.com)
Or you can post a message to this discussion group:
http://groups-beta.google.com/group/google-labs-groups2
This message contains a list of some the bugs and problems that have
been reported so far:
http://groups-beta.google.com/group/google-labs-groups2/msg/b54c12517c75eb24
More info in this FAQ:
http://www.geocities.com/googlepubsupgenfaq/#groupsproblems
------------------------------
Date: 10 Jan 2005 08:00:18 -0800
From: derekg0@gmail.com
Subject: Re: CRYPT:RC5 problem, can't unencrypt
Message-Id: <1105372818.443491.326470@c13g2000cwb.googlegroups.com>
Found the problem, looks like if the string you are encrypting is less
then 8 characters it gets all screwy, if you use a 8 character+ string
it works ok. Guess i'll just have to pad my password before encrypting
it.
thanks for the help.
------------------------------
Date: Mon, 10 Jan 2005 12:45:00 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: DOM newbie problem, please help!
Message-Id: <crtt2m$ip4$1@sun3.bham.ac.uk>
jet.jetpac@gmail.com wrote:
> I've tried to write an application using XML::DOM in perl. I'm not able
> to getNoddeValue at text node.
You are not correctly interpreting your problem.
> XML FILE:
> ---
> <sample param="some param">
> <text_node> Test data. </text_node>
> </sample>
> ---
>
> My perl portion:
> ---
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use XML::DOM;
>
> my $parser = XML::DOM::Parser->new;
> my $document = $parser->parsefile("test.xml");
> my $value=$document->getDocumentElement->getFirstChild->getNodeValue;
>
> print "$value\n";
> ----
>
> The problem is, that $value is not set, getNodeValue returns null,
'null' is not a Perl concept. In Perl there is undef and there is empty
string. However in your test program getNodeValue does not return
either of these. It returns a string consisting of a newline character.
> getNodeName returns '#text'. Can anybody PLEASE tell me, what am I
> doing wrong? I'm almost ill of the testing...
You do not understand DOM. The element called <text_node> is not a text
node an element node that just happens to be called "text_node". The
text itself is in a text node that is a decendant of this element.
The DOM tree of your document (ignoring the attribute nodes) looks like
Document
\-Element name="sample" <-- this is the documentElement
|-Text data="\n" <-- this is the node you selected
|-Element name="text_node"
| \-Text data=" Test data. "
\-Text data="\n"
------------------------------
Date: 10 Jan 2005 08:42:27 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: FAQ 4.30: How do I capitalize all the words on one line?
Message-Id: <slrncu4fvj.ucb.abigail@alexandra.abigail.nl>
brian d foy (comdog@panix.com) wrote on MMMMCL September MCMXCIII in
<URL:news:090120052013463708%comdog@panix.com>:
() In article <slrncu3gv8.4it.news@maki.homeunix.net>, Martin Kissner
() <news@chaos-net.de> wrote:
()
() > > "Martin Kissner" <news@chaos-net.de> wrote in message
() > > news:slrncu27vh.2hj.news@maki.homeunix.net...
()
() > >> How about:
() > >> $text =~ tr/a-zäöü/A-ZÄÖÜ/;
() > >> This does the Job.
()
() > I can't see whats wrong with my solution if you have to deal with those.
()
() A good solution will work for as many languages as possible. The
() uc() function can respect the locale settings so we don't have to
() know those things. :)
Yeah, but that's a bit of an action at a distance, and setting your
locale effects the entire program - including any modules you use -
not just the one action you want to perform.
It's a bit like having to set $*, $[ or $/. Their effect is also global.
Abigail
--
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
------------------------------
Date: Mon, 10 Jan 2005 15:34:33 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.30: How do I capitalize all the words on one line?
Message-Id: <9vu4u0dpmcan1c80ddfjkqjpt237j4qs75@4ax.com>
On 10 Jan 2005 03:50:34 GMT, Martin Kissner <news@chaos-net.de> wrote:
>This didn't work as I expected:
> $ $ echo $LANG
>
> $ perl -e 'use locale; $ENV{LANG}="de_DE.ISO8859-1"; \
> print $ENV{LANG}; print "\n"; print uc("ü");print "\n"'
> de_DE.ISO8859-1
> ü
>
>When $LANG is set _in_ the script, it seems not to get use.
>How can I set $LANG in the script?
Wild guess: isn't it that it must be set suitably _before_ locale.pm
is loaded? If so, then
BEGIN { $ENV{LANG}='de_DE.ISO8859-1' }
use locale;
_may_ (untested!) do the job.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 10 Jan 2005 08:03:12 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: FAQ 4.30: How do I capitalize all the words on one line?
Message-Id: <slrncu52p0.6tp.tadmc@magna.augustmail.com>
Martin Kissner <news@chaos-net.de> wrote:
> Matt Garrish wrote :
>> "Martin Kissner" <news@chaos-net.de> wrote in message
>> news:slrncu27vh.2hj.news@maki.homeunix.net...
>>> $text =~ tr/a-zäöü/A-ZÄÖÜ/;
>> But what about àáâãçèé, etc.?
>>
>> That's why the solution posted is so very, very wrong. Please read the faq.
> I can't see whats wrong with my solution if you have to deal with those.
> If there is a better solution in the FAQ, I have missed it.
> Please help me find the point.
perldoc perllocale
uc() and \U know about that and will respect its settings.
tr/// does not.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 Jan 2005 15:34:34 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: File::Find::find() is depth-first?
Message-Id: <v5v4u0dbo3aoulele236i545sj1vpof9pb@4ax.com>
On Mon, 10 Jan 2005 00:00:33 GMT, gargoyle <gargoyle@no.spam> wrote:
>#!/usr/bin/perl -w
As side notes: better
use warnings;
nowadays. Also,
use strict;
always!
>use File::Find;
>
>@dirs = @ARGV;
>find({ wanted => \&wanted, follow => 0, no_chdir => 1 }, @dirs);
Why not
find({ wanted => \&wanted, follow => 0, no_chdir => 1 }, @ARGV);
incidentally?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 10 Jan 2005 08:29:36 GMT
From: Muller <Some.One@hotmail.com>
Subject: Re: HELP needed for a small script
Message-Id: <Q1rEd.34254$k4.656899@news1.nokia.com>
david@prosl.com (David) wrote in news:dd02b68d.0501091432.213f51c4
@posting.google.com:
> First off all, my apologies if this message has no direct concern with
> this group
> I'm actually looking for help with a script for my website I couldn't
> find on the web
>
> In order for my customers to track their orders, the script would open
> a txt file looking like:
>
>
> 00001;we are preparing your order
> 00002;we are preparing your order
> 00003;your order has been shipped
> 00004;we are preparing your order
> 00005;we are waiting for your payment
> 00006......
>
> The customer gives his order reference (field 1) in a "search" text
> box, the script checks out the txt file and the page then returns
> order status (field 2)- If order reference does not exist, page
> returns for exemple "Order does not exist"
>
> As I'm a newbie (sorrrry ;-), how do I place this script in my html
> page ? Do I have to create a .cgi file ? Cut & Paste in my page ???
> What about CHMOD ???
>
> I'm not asking for a complete course but I would be so grateful for
> your help regarding this matter !
>
> Thanks in advance guys ;-)
>
> David
>
If you are dying then you should choke in "perl", otherwise people here
will not help you
try 911
------------------------------
Date: Mon, 10 Jan 2005 09:41:30 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: HELP needed for a small script
Message-Id: <34etd9F47l4s3U1@individual.net>
Muller wrote:
> If you are dying then you should choke in "perl", otherwise people here
> will not help you
> try 911
He did get help, both from wana and me.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 10 Jan 2005 08:20:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HELP needed for a small script
Message-Id: <slrncu53ou.6tp.tadmc@magna.augustmail.com>
David <david@prosl.com> wrote:
[ snip: needs a CGI program ]
> how do I place this script in my html
> page ?
Don't you have the horse before the cart?
You first have to _get_ a script before you need to know how
to use it. Take smaller steps.
It appears that you do not understand how the web works, because
you do not put your script in the HTML, you do put a URL to
the script in there though. The script itself is on the web *server*,
not in the web page.
If you are going to do this yourself rather than hire someone who
already knows what needs to be known, then you should take a step
back and get the big picture before delving into the details.
The question above is not a Perl question, if you were using
Python or Java the answer would be the same.
> Do I have to create a .cgi file ?
That is not a Perl question.
It is a question about how to setup a CGI program (which depends
on how your web server happens to be configured).
Questions about web server configuration should be asked in:
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
Questions about the CGI environment should be asked in:
comp.infosystems.www.authoring.cgi
Questions about Perl should be asked in this newsgroup.
> What about CHMOD ???
I have never heard of "CHMOD", only "chmod". Case matters.
What permissions are needed is also not a Perl question, it
depends on how the web server has been configured.
> I'm not asking for a complete course but I would be so grateful for
> your help regarding this matter !
None of your questions were about Perl, they were all about web
servers and CGI programs.
Nonetheless, there are some Perl FAQs that are likely to help you:
perldoc -q CGI
Where can I learn about CGI or Web programming in Perl?
My CGI script runs from the command line but not the browser. (500
Server Error)
How can I get better error messages from a CGI program?
How do I decode a CGI form?
perldoc -q HTML
How do I automate an HTML form submission?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 Jan 2005 11:45:42 GMT
From: Ed W <noway@notarealemail.com>
Subject: How to create phone dialer (DUN) app in perl for win32
Message-Id: <GVtEd.505737$O24.79747@news.easynews.com>
I have a bunch of users with satellite phones. To connect to the
internet they need to dial a special phone number, pass in some AT setup
commands, username/pass, then startup PPP. Does anyone know how to do
all this stuff under win32 from perl?
I have found win32::RASE on perl which would at least let me configure
normal windows dial up networking to dial this connection. Any other
modules that I should look at?
Thanks for any help
Ed W
------------------------------
Date: 10 Jan 2005 02:13:36 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: I don't get what this is de-referencing.
Message-Id: <1105352016.196851.25600@c13g2000cwb.googlegroups.com>
I have question about line 10 for the following code.
1 #!/usr/bin/perl
2
3 { package Horse;
4 @ISA = qw(Animal);
5 sub sound {"neigh" }
6 sub names {
7 print $_[0] , "\n";
8 $self = shift;
9 #print @_ , "\n";
10 $$self;
11 }
12 sub named {
13 $class = shift;
14 $name = shift;
15 bless \$name, $class;
16 }
17 }
18
19 my $tv_horse = Horse->named("Mr. Ed");
20 print $tv_horse->names, "\n";
21 print Horse->named("Mr. Ed"), "\n";
What is $$self actually de-referencing? I thought it was de-referencing
$name. But when I replace $$self; with $self->{'name'};, I get "Not
HASH reference at ./9-horse.pl line 10."
Chad
------------------------------
Date: Mon, 10 Jan 2005 13:06:29 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: I don't get what this is de-referencing.
Message-Id: <slrncu4ru5.rg.tassilo.von.parseval@localhost.localdomain>
Also sprach grocery_stocker:
> I have question about line 10 for the following code.
>
> 1 #!/usr/bin/perl
> 2
> 3 { package Horse;
> 4 @ISA = qw(Animal);
> 5 sub sound {"neigh" }
> 6 sub names {
> 7 print $_[0] , "\n";
> 8 $self = shift;
> 9 #print @_ , "\n";
> 10 $$self;
> 11 }
> 12 sub named {
> 13 $class = shift;
> 14 $name = shift;
> 15 bless \$name, $class;
> 16 }
> 17 }
> 18
> 19 my $tv_horse = Horse->named("Mr. Ed");
> 20 print $tv_horse->names, "\n";
> 21 print Horse->named("Mr. Ed"), "\n";
>
> What is $$self actually de-referencing? I thought it was de-referencing
> $name. But when I replace $$self; with $self->{'name'};, I get "Not
> HASH reference at ./9-horse.pl line 10."
$$self denotes that $self is a reference to a plain scalar. Note that in
Horse::named() (your constructor), you do:
bless \$name, $class;
That means you are not blessing a reference to a hash but a reference to
a scalar.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Mon, 10 Jan 2005 13:23:18 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: I don't get what this is de-referencing.
Message-Id: <alvEd.1086$SS6.897@trnddc07>
"Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> wrote in
message news:slrncu4ru5.rg.tassilo.von.parseval@localhost.localdomain...
> Also sprach grocery_stocker:
>
> > I have question about line 10 for the following code.
> >
> > 1 #!/usr/bin/perl
> > 2
> > 3 { package Horse;
> > 4 @ISA = qw(Animal);
> > 5 sub sound {"neigh" }
> > 6 sub names {
> > 7 print $_[0] , "\n";
> > 8 $self = shift;
> > 9 #print @_ , "\n";
> > 10 $$self;
> > 11 }
> > 12 sub named {
> > 13 $class = shift;
> > 14 $name = shift;
> > 15 bless \$name, $class;
> > 16 }
> > 17 }
> > 18
> > 19 my $tv_horse = Horse->named("Mr. Ed");
> > 20 print $tv_horse->names, "\n";
> > 21 print Horse->named("Mr. Ed"), "\n";
> >
> > What is $$self actually de-referencing? I thought it was
de-referencing
> > $name. But when I replace $$self; with $self->{'name'};, I get "Not
> > HASH reference at ./9-horse.pl line 10."
>
> $$self denotes that $self is a reference to a plain scalar. Note that
in
> Horse::named() (your constructor), you do:
>
> bless \$name, $class;
>
> That means you are not blessing a reference to a hash but a reference
to
> a scalar.
If I'm not mistaken, this is code from Randal Schwartz's "Learning Perl
Objects References and Modules". I would encourage the OP to continue
reading. The author introduces classes with this concept of creating a
class object as a reference to a scalar, but quickly moves on to the far
more common practice of using references to hashes instead.
Paul Lalli
------------------------------
Date: 10 Jan 2005 07:39:37 -0800
From: bh_ent@hotmail.com
Subject: Interactive shell from system()?
Message-Id: <1105371577.284149.230290@c13g2000cwb.googlegroups.com>
Hi all,
After reading the documentation for "system()" I understand perl
launches the arguments via "sh -c" or whatever my system equivalent is.
I've written a series of ksh scripts I'd like to launch from my perl
script, but the ksh scripts are interactive (ie, prompts the user, and
reads their input), however, this obviously doesn't work via system()
from within my perl script.
Any suggestions how I might accomplish this?
------------------------------
Date: Mon, 10 Jan 2005 17:41:48 +0900
From: Vito Corleone <vito_corleone@godfather.com>
Subject: Re: Loading module in another module
Message-Id: <20050110174148.2931ca43.vito_corleone@godfather.com>
Hi Gunnar,
Thank your for your fast reply.
------------------------------
Date: Mon, 10 Jan 2005 08:15:20 -0500
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: Loading module in another module
Message-Id: <4cvEd.13776$b64.238691@news20.bellglobal.com>
Vito Corleone wrote:
> Hi,
>
> Sorry if this is newbie question. I am a bit confused about loading
> module in another module. Let's say I have a script that look like this.
>
> ## script.pl
> use strict;
> use Module1;
> use Module2;
> my $m1 = Module1::->new();
> print $m1->func1();
> my $m2 = Module2::->new(); ## Module2 is also using Module1
> print $m2->func2();
>
> ## Module2.pm
> use strict;
> use Module1;
> ...
>
> The problem is I "use Module1" 2 times, in script.pl and in Module2. I
> just wonder is it the right way to do it? Will it takes double memory
> (because Module1 is used twice)? Is it better if I only "use Module1" in
> script.pl and then pass the reference to Module2 (so I don't need to
> "use Module1" in Module2)?
>
> Please enlight me. Thank you in advance.
>
> --Vito
Perl stores all modules it loads in the hash %INC. It uses this to
determine if a module is already loaded and does not reload it. The
second 'use Module1;' does not do anything since you did not change
package; you are using modules as libraries, as oppose modules as
packages (different name spaces) or modules as objects.
--- Shawn
------------------------------
Date: 10 Jan 2005 03:38:35 -0800
From: ineverlookatthis@yahoo.com
Subject: Re: pack and unpack ?
Message-Id: <1105357115.234604.273950@c13g2000cwb.googlegroups.com>
OK, here is the data I see. The numbers are all generated by
ord(character)
Note that 2 temeratures are being sent, an internal and an external
(probe) temp.
All degrees Centigrade. All were taken when the system was stable
EXCEPT the two
marked as approx.
internal 27.33 external 26.330
corresponding data looks like this:
3 10 80 72 113 88 126 12 72 123 109 53 117
internal 24* approx external 0
3 10 80 72 113 88 127 12 72 123 47 61 117
internal 16.5* approx external 0
3 10 80 72 113 89 127 12 72 123 47 86 117
internal 27.33 external -24
3 10 80 72 113 88 127 12 72 123 14 53 117
internal 27.33 external -50
3 10 80 72 113 88 127 12 72 123 4 53 117
Thanks
------------------------------
Date: 10 Jan 2005 06:31:06 -0800
From: ineverlookatthis@yahoo.com
Subject: Re: pack and unpack ?
Message-Id: <1105367466.515685.242810@c13g2000cwb.googlegroups.com>
Here's more. I should have done this sytematically before.
It may be relevant that the scale of the external reading is -50 to
+100
and of the internal reading -30 to +50.
6.5 l 0
3 10 80 72 113 90 127 12 72 123 47 121 117
5.25 0
3 10 80 72 113 91 127 12 72 123 47 125 117
21.67 50
3 10 80 72 113 88 126 12 72 123 33 68 117
27.33 88
3 10 80 72 113 88 127 12 72 123 74 53 117
27.67 96
3 10 80 72 113 88 127 12 72 123 78 52 117
------------------------------
Date: Mon, 10 Jan 2005 20:34:19 +0800
From: sam <sam.wun@authtec.com>
Subject: passing $cgi object in hash.
Message-Id: <crtuak$gu1$1@news.hgc.com.hk>
Hi,
I would like to pass the $cgi object to a subroutine from a hash object,
somehting like this:
#!/bin/usr/perl -w
use CGI;
sub testing
{
my ($obj1ref, $obj2ref, $str1, $str2, $cgi) = @_
$cgi->submit($str1.$str2);
}
$cgi = new CGI;
test($obj1,$obj2, "my", "string", $cgi);
Is it possible?
Thanks
Sam
------------------------------
Date: Mon, 10 Jan 2005 20:38:28 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: passing $cgi object in hash.
Message-Id: <crtuid$h3m$1@news.hgc.com.hk>
sam wrote:
> Hi,
>
> I would like to pass the $cgi object to a subroutine from a hash object,
> somehting like this:
>
> #!/bin/usr/perl -w
>
> use CGI;
>
> sub testing
> {
> my ($obj1ref, $obj2ref, $str1, $str2, $cgi_hash) = @_
> $cgi_hash->{'cgi'}->submit($str1.$str2);
> }
>
> $cgi = new CGI;
>
> test($obj1,$obj2, "my", "string", $cgi);
>
> Is it possible?
>
Sorry, this is of course possible. I forgot pass it in a hash object
like below:
$cgi = new CGI;
my %_hash = ('cgi' => $cgi);
test($obj1,$obj2, "my", "string", \%_hash);
> Thanks
> Sam
------------------------------
Date: Mon, 10 Jan 2005 13:28:12 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: passing $cgi object in hash.
Message-Id: <MpvEd.1087$SS6.442@trnddc07>
"sam" <sam.wun@authtec.com> wrote in message
news:crtuid$h3m$1@news.hgc.com.hk...
> sam wrote:
>
> > I would like to pass the $cgi object to a subroutine from a hash
object,
> > somehting like this:
> >
> > #!/bin/usr/perl -w
> >
> > use CGI;
> >
> > sub testing
> > {
> > my ($obj1ref, $obj2ref, $str1, $str2, $cgi_hash) = @_
> > $cgi_hash->{'cgi'}->submit($str1.$str2);
> > }
> >
> > $cgi = new CGI;
> >
> > test($obj1,$obj2, "my", "string", $cgi);
> >
> > Is it possible?
> >
> Sorry, this is of course possible. I forgot pass it in a hash object
> like below:
>
> $cgi = new CGI;
> my %_hash = ('cgi' => $cgi);
> test($obj1,$obj2, "my", "string", \%_hash);
The obvious answer to a question of "is this possible" is "What happened
when you tried it?" If it worked, you're done. If not, you should be
asking "What does this error message mean?" or "Why didn't this work
correctly?" or "What is the correct way of doing this?"
So... what happened when you tried it?
Paul Lalli
------------------------------
Date: Mon, 10 Jan 2005 15:34:35 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: perl tutorial
Message-Id: <r7l4u05qufa7l4d1scqogen6oif45o47sg@4ax.com>
On 9 Jan 2005 22:35:36 -0800, "sandhyapochiraju@gmail.com"
<sandhyapochiraju@gmail.com> wrote:
>iam a new member of this group. I would like to learn PERL. Please let
>me know about some sites which give free and easy to understand
>tutorials on PERL.
1st lesson: lc 'PERL'. See
perldoc -q '"perl" and "Perl"'
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 10 Jan 2005 07:26:11 -0800
From: "DKW" <uffesterner@spamhole.com>
Subject: portable no warnings "uninitialized"
Message-Id: <1105370771.900222.167420@c13g2000cwb.googlegroups.com>
Hi
I'm writing a script which should be as portable as possible.
The version I'm programming in is v5.6.1
and here I can use the following code:
no warnings "uninitialized";
When I try to use that code on another site, where they have an older
version of perl, it complains about this code
(I can't give you the details 'cause I don't have access to that site
right now)
How can I make it portable, so the script avoid the code:
no warnings "uninitialized";
if it's not available (as in older perl)
(I can live with the "uninitialized"-warnings for the older perl)
tia
------------------------------
Date: Mon, 10 Jan 2005 15:36:47 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: portable no warnings "uninitialized"
Message-Id: <jixEd.44138$Xk.22470@pd7tw3no>
In article <1105370771.900222.167420@c13g2000cwb.googlegroups.com>,
"DKW" <uffesterner@spamhole.com> writes:
>Hi
>
>I'm writing a script which should be as portable as possible.
>
>The version I'm programming in is v5.6.1
>and here I can use the following code:
>
>no warnings "uninitialized";
>
>
>When I try to use that code on another site, where they have an older
>version of perl, it complains about this code
>(I can't give you the details 'cause I don't have access to that site
>right now)
>
>How can I make it portable, so the script avoid the code:
>no warnings "uninitialized";
Replace that line with
local $^W = 0;
--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
------------------------------
Date: Mon, 10 Jan 2005 16:45:22 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: portable no warnings "uninitialized"
Message-Id: <34fm9kF4akrlqU1@individual.net>
DKW wrote:
> I'm writing a script which should be as portable as possible.
>
> The version I'm programming in is v5.6.1
> and here I can use the following code:
>
> no warnings "uninitialized";
>
> When I try to use that code on another site, where they have an older
> version of perl, it complains about this code
> (I can't give you the details 'cause I don't have access to that site
> right now)
>
> How can I make it portable, so the script avoid the code:
> no warnings "uninitialized";
> if it's not available (as in older perl)
The options I can see are to either fix the code so it doesn't generate
uninitialized warnings, or turn off warnings in the production code (but
keep it enabled during development and maintenance).
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 10 Jan 2005 15:50:50 GMT
From: Steven_Smith <sjs@sonic.net>
Subject: Re: shutdown of linux box from cron perl script
Message-Id: <uvxEd.1073$m31.12926@typhoon.sonic.net>
Joe Smith wrote:
> Eric Peterson wrote:
>
>> runs automatically from cron, the shutdown command seems to be ignored
>
>
> The perl answer to this problem is to add a line to your script:
>
> $ENV{PATH} .= ':/sbin:/usr/sbin' unless $ENV{PATH} =~ /sbin/;
>
> -Joe
Or in general to use the absolute path to the executable if
there can be problems. Actually, for scripts used by many
people I've been bitten by not using the absolute path
several times, so generally I use it. The problem of course
is that then you can become platform specific...
Steve S.
------------------------------
Date: Mon, 10 Jan 2005 09:17:24 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Tk: Call subroutine when MainWindow is realized?
Message-Id: <crtdi2$bpc$1@nntp.fujitsu-siemens.com>
Hi,
In a small(ish) application that communicates with a smart card reader,=20
I'd like to test the link at the beginning. Since the MainLoop is not=20
yet called, I seem to be unable to create a Dialog to tell the user.
Is there any way to call a sub the first thing after the MainWindow is=20
created?
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Mon, 10 Jan 2005 09:45:40 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Tk: Call subroutine when MainWindow is realized?
Message-Id: <f635u0ln5c7ls4gf6ikif5n8dopbhnpm77@4ax.com>
On Mon, 10 Jan 2005 09:17:24 +0100, Josef Moellers
<josef.moellers@fujitsu-siemens.com> wrote:
>Hi,
>
>In a small(ish) application that communicates with a smart card reader,
>I'd like to test the link at the beginning. Since the MainLoop is not
>yet called, I seem to be unable to create a Dialog to tell the user.
>
>Is there any way to call a sub the first thing after the MainWindow is
>created?
In perldoc Tk::Widget there is
$mw->waitVisibility;
and
$mw->waitVariable(\$var);
and
$mw->waitWindow;
There are alot of ways you could probably work them into
your script.
Maybe the easiest thing would be to have 2 mainwindows? The first
opens to inform the user the link test is occuring. When the test is
successful, close it, and open $mw1, and packing it differently
depending on whether the link is good or not?
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = MainWindow->new( -title=>"Link Test");
my $mw1;
$mw->Label(-text => "Testing Link")->pack();
my $link = 0;
$mw->after(5000, sub { &check_init() } );
MainLoop;
sub check_init {
$link = 1; #comment out to test
if($link == 1){
$mw1 = MainWindow->new();
$mw1->Label(-text => "Link Good")->pack();
$mw1->Button(-text => 'Exit', -command => sub{exit})->pack();
$mw->destroy;
}else{
$mw1 = MainWindow->new();
$mw1->Label(-text => "Link Bad, check your connections")->pack();
$mw1->Button(-text => 'Exit', -command => sub{exit})->pack();
$mw->destroy;
}
}
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Mon, 10 Jan 2005 13:58:47 +0100
From: "Bart van den Burg" <bart@NOSPAM.tvreclames.nl>
Subject: Re: XML::Smart, how to print out tree
Message-Id: <crtufc$8ud$1@reader13.wxs.nl>
never mind, got it
"Bart van den Burg" <bart@NOSPAM.tvreclames.nl> schreef in bericht
news:crrnu1$ktv$1@reader08.wxs.nl...
> Hi,
>
> I wish to use XML::Smart to make a website with (rather than XML::Simple,
> which is really slow), but there's one thing I just cannot figure out: how
> do I print out the whole tree?
>
> Thanks,
> Bart
>
>
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7626
***************************************