[28958] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 202 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 7 18:10:48 2007

Date: Wed, 7 Mar 2007 15:09:26 -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           Wed, 7 Mar 2007     Volume: 11 Number: 202

Today's topics:
    Re: ActiveState Perl User Guide -- how can I add an ent <ben@morrow.me.uk>
    Re: Congratulations Randal <bik.mido@tiscalinet.it>
        How can I access the variables in my script ($main::var <imfeaw5672@pacbell.net>
    Re: LWP Package issue in my script.. <uri@stemsystems.com>
    Re: MIME::Lite, getting a warning. <sigzero@gmail.com>
    Re: Newbie question re initialization <edMbj@aes-intl.com>
    Re: Newbie question re initialization <mritty@gmail.com>
    Re: Newbie question re initialization <edMbj@aes-intl.com>
    Re: Newbie question re initialization <uri@stemsystems.com>
    Re: Newbie question re initialization <edMbj@aes-intl.com>
    Re: Newbie question re initialization <uri@stemsystems.com>
        Perl script fails silently at start, can't debug <jonhendry_usenet@mac.com>
    Re: Perl script fails silently at start, can't debug <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 7 Mar 2007 20:17:29 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: ActiveState Perl User Guide -- how can I add an entry to the list of Programs?
Message-Id: <p7j3c4-9ga.ln1@osiris.mauzo.dyndns.org>


Quoth clyde.ingram@edl.uk.eds.com:
> On 5 Mar, 20:50, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth clyde.ingram@edl.uk.eds.com:
> 
> > > What do I have to configure so that my
> > > new program is picked up in the Programs part of perltoc.html?
> >
> > If you put your HTML page in the correct place (C:\Perl\html\bin), you
> > should be able to run
> >
> >     perl -MActivePerl::DocTools -eActivePerl::DocTools::WriteTOC
> >
> > to just update the TOC.
> Ben, that works for me.  Thank-you.
> 
> A supplementary problem is how to link to other pages in the manual.
> Eventually I want to link to one of my new modules in ActiveState.
> But to start with somethin simple (!), the perlpod page tells me I can
> insert, for example:
> 
> <QUOTE>
> L<name> -- a hyperlink <> >>
> There are various syntaxes, listed below. In the syntaxes given, text,
> name, and section cannot contain the characters '/' and '|'; and any
> '<' or '>' should be matched.
> 
> L<name>
> 
> Link to a Perl manual page (e.g., L<Net::Ping>). Note that name should
> not contain spaces.
> </QUOTE>
> 
> So, I insert this POD paragraph:
> 
> L<Net::Ping>
> 
> just like the man said.  But the link on my new "ckscan" page in
> ActiveState under "Programs" looks like this (underlined):
> 
> the Net::Ping manpage
> 
> but resolves to this URL:
> 
> file:///Net/Ping.html
> 
> That URL does not work.  What should L<Net::Ping> resolve to, and how
> can I make it resolve in this way?

Well, obviously, L<Net::Ping> should resolve to
file:///c:/Perl/html/lib/Net/Ping.html or some such. If you use
UpdateHTML instead of generating the HTML yourself with pod2html it
should get it right; otherwise, see the --htmlroot option to pod2html.

Ben

-- 
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down.       [ben@morrow.me.uk]


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

Date: Wed, 07 Mar 2007 21:20:18 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Congratulations Randal
Message-Id: <pg7uu2hld9vggbe3kcldjn46es6fl5isrg@4ax.com>

On Wed, 07 Mar 2007 01:32:42 -0000, Justin C
<justin.0703@purestblue.com> wrote:

>You mean my most read, most useful book is co-written by a convicted
>felon?!

Not any more. But probably yes: it WERE, depending on the actual book.
One of them: the Llama, IIRC, even actually has a footnote reminding
the fact.


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: Wed, 07 Mar 2007 21:46:25 GMT
From: "Sean" <imfeaw5672@pacbell.net>
Subject: How can I access the variables in my script ($main::var)
Message-Id: <RoGHh.1144$yW.90@newssvr11.news.prodigy.net>

Hi Folks,

I need to access some of the variables in my script. These variables are 
used by methods called in packages that might be nested.
I have used $main::var. This does not seem to do job. Any sugestions?

Thanks,

Sean 




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

Date: Wed, 07 Mar 2007 14:29:00 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: LWP Package issue in my script..
Message-Id: <x7abyodf9f.fsf@mail.sysarch.com>

>>>>> "s" == schimata  <schimata@gmail.com> writes:

  s> use LWP::Simple;
  s> use HTTP::Status;
  s> use LWP::UserAgent;

you don't need all three of those. LWP::Simple will load LWP::UserAgent
which will load HTTP::Status. and by loading all those you are confusing
yourself below.

  s> blah..blah..
  s> blah..

that isn't valid perl code! :)

  s> my $ua = LWP::UserAgent->new;

so you are using the OO style with that module. read ITS docs on what
methods it supports.

  s> $ua->timeout(1000);
  s> $ua->env_proxy;

those are legit methods for that object.

  s> my $url ='http://tracker/cfdocs/proddev/admin/ws/api/
  s> get_all_subfeatures.cfm';

be careful when pasting in emails. that line wrapped and shouldn't have
and if someone cut/pasted it, it would likely fail because of the
newline in the url.

  s> print "hello";
  s> my $response = $ua->get($url);

ahh. is get() a method documented in LWP::UserAgent? no it isn't. it is
an exported sub in LWP::Simple which wraps code around its own $ua. so
you either call get() as a sub or use $ua and its methods. you can't
mix/match them.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 7 Mar 2007 13:19:58 -0800
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: MIME::Lite, getting a warning.
Message-Id: <1173302398.529167.243140@s48g2000cws.googlegroups.com>

On Mar 7, 7:52 am, Justin C <justin.0...@purestblue.com> wrote:
> I have a script that mails a zip file to a user, when I run it a warning
> is generated: no data in this part
>
> Ideally I'd like to have it run 'clean', can someone give me some clues
> on how to make this work without generating a warning?
>
> CODE START
> my $sender = '[edit]' ;
> my $recipient = '[edit]' ;
> my $subject = 'monthly .zip mailing' ;
> my $messageText = "Please find attached a .zip file containing Excel files\n";
> my $fname = glob "pa206_*xls" ;
>
> #       create the message
> my $msg = MIME::Lite->new(
>         From => $sender,
>         To => $recipient,
>         Subject => $subject,
>         Type => 'TEXT',
>         Data => $messageText
>         ) ;
>
> #       attach the zip file
> $msg->attach (
>         Type => 'application/zip',
>         Path => $fname,
>         Filename => $fname
>         ) ;
>
> #       send the message
> $msg->send() ;
>
> CODE END
>
> Thank you for any help you can give with this.
>
>         Justin.
>
> --
> Justin C, by the sea.

I *think* the Path has to be a "path" and not just the file name...

Robert




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

Date: Wed, 07 Mar 2007 12:08:07 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Newbie question re initialization
Message-Id: <nm6uu2l61rfjppsf00k17oh0paunurfd22@4ax.com>

Sherm Pendley scribed:

>Ed Jay <edMbj@aes-intl.com> writes:
>
>> At the start of a script I have (without the line numbers):
>>
>> 17  my $username = param('usrnm');
>> 18  @subList = param('ptList');
>> 19  my $newUsername = $username."{";
>> 20  my $user = $username.",";
>>
>> When I submit my script for testing I receive the following warnings:
>>
>> Use of uninitialized value in concatenation (.) or string at foo.pl line 19.
>> Use of uninitialized value in concatenation (.) or string at foo.pl line 20.
>>
>> I don't understand the message, nor do I know what to do to resolve the
>> issue. Help!
>
>What's not to understand? You're trying to concatenate two strings. One of
>them is uninitialized - i.e. its value is undef. Obviously that isn't going
>to be the "{" or "," strings, so that leaves $username.
>
>Why is $username undef then? Check your form - make sure that it has some-
>thing named 'usrnm' in it. And validate your input; sooner or later someone
>*will* leave that form element blank.
>
The form being submitted does indeed have a field named 'usrnm.' It's value
is _always_ populated onSubmit via javascript. 

The script where I receive the above warnings not only works fine, but it
employs '$username' properly. That's why I don't understand the warnings.
-- 
Ed Jay (remove 'M' to respond by email)


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

Date: 7 Mar 2007 12:15:27 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Newbie question re initialization
Message-Id: <1173298526.960600.14450@c51g2000cwc.googlegroups.com>

On Mar 7, 3:08 pm, Ed Jay <e...@aes-intl.com> wrote:
> Sherm Pendley scribed:
>
>
>
>
>
> >Ed Jay <e...@aes-intl.com> writes:
>
> >> At the start of a script I have (without the line numbers):
>
> >> 17  my $username = param('usrnm');
> >> 18  @subList = param('ptList');
> >> 19  my $newUsername = $username."{";
> >> 20  my $user = $username.",";
>
> >> When I submit my script for testing I receive the following warnings:
>
> >> Use of uninitialized value in concatenation (.) or string at foo.pl line 19.
> >> Use of uninitialized value in concatenation (.) or string at foo.pl line 20.
>
> >> I don't understand the message, nor do I know what to do to resolve the
> >> issue. Help!
>
> >What's not to understand? You're trying to concatenate two strings. One of
> >them is uninitialized - i.e. its value is undef. Obviously that isn't going
> >to be the "{" or "," strings, so that leaves $username.
>
> >Why is $username undef then? Check your form - make sure that it has some-
> >thing named 'usrnm' in it. And validate your input; sooner or later someone
> >*will* leave that form element blank.
>
> The form being submitted does indeed have a field named 'usrnm.' It's value
> is _always_ populated onSubmit via javascript.
>
> The script where I receive the above warnings not only works fine, but it
> employs '$username' properly. That's why I don't understand the warnings.

I'll take a wild guess that in your *real* code, you spelled the
variable name wrong, but subconsciously corrected it when you retyped
it into this post.

Please post a SHORT but COMPLETE script that demonstrates your error -
by copy and pasting it.

Sherm's answer is 100% correct.  If you're claiming the above code
somehow uses $username correctly, but still generates those warnings,
you're flat out wrong.  Sorry.

Paul Lalli



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

Date: Wed, 07 Mar 2007 13:16:01 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Newbie question re initialization
Message-Id: <8o9uu21dpms1v5etsj3pilfpds6i0ncq6u@4ax.com>

Paul Lalli scribed:

>On Mar 7, 3:08 pm, Ed Jay <e...@aes-intl.com> wrote:
>> Sherm Pendley scribed:
>>
>> >Ed Jay <e...@aes-intl.com> writes:
>>
>> >> At the start of a script I have (without the line numbers):
>>
>> >> 17  my $username = param('usrnm');
>> >> 18  @subList = param('ptList');
>> >> 19  my $newUsername = $username."{";
>> >> 20  my $user = $username.",";
>>
>> >> When I submit my script for testing I receive the following warnings:
>>
>> >> Use of uninitialized value in concatenation (.) or string at foo.pl line 19.
>> >> Use of uninitialized value in concatenation (.) or string at foo.pl line 20.
>>
>> >> I don't understand the message, nor do I know what to do to resolve the
>> >> issue. Help!
>>
>> >What's not to understand? You're trying to concatenate two strings. One of
>> >them is uninitialized - i.e. its value is undef. Obviously that isn't going
>> >to be the "{" or "," strings, so that leaves $username.
>>
>> >Why is $username undef then? Check your form - make sure that it has some-
>> >thing named 'usrnm' in it. And validate your input; sooner or later someone
>> >*will* leave that form element blank.
>>
>> The form being submitted does indeed have a field named 'usrnm.' It's value
>> is _always_ populated onSubmit via javascript.
>>
>> The script where I receive the above warnings not only works fine, but it
>> employs '$username' properly. That's why I don't understand the warnings.
>
>I'll take a wild guess that in your *real* code, you spelled the
>variable name wrong, but subconsciously corrected it when you retyped
>it into this post.
>
>Please post a SHORT but COMPLETE script that demonstrates your error -
>by copy and pasting it.
>
>Sherm's answer is 100% correct.  If you're claiming the above code
>somehow uses $username correctly, but still generates those warnings,
>you're flat out wrong.  Sorry.
>
I have no doubt that Sherm's answer is correct. That doesn't, however,
alleviate my angst. :-)

The first script generates a list and associated links:

for ($i=0;$i<$arraySize;$i++) {
  $line = $subList[$i];
  $username = substr($line,0,index($line,","));
  print "<div><a
href=\"javascript:makeList('$username');\">$regName;</a></div>\n";
}

The js makeList is used to populate a hidden form element named 'usrnm.':

function makeList(who) {
  document.form1.usrnm.value = who;
  document.forms['form1'].submit();
}

where:

print "<form id='form1' name='form1' action=\"foo.pl\" method=\"post\">\n";
print "<input type='hidden' name='usrnm' value=''>\n";
print "</form>\n";

The form element 'usrnm' is submitted to foo.pl:

my $username = param('usrnm');
my $newUsername = $username."{";
my $user = $username.",";

and $username is employed as follows: 

chdir $rptPath;
seek(T2FILE, 0, 0);	#rewind registry.html
$filename2 = "registry.html"; 
open (T2FILE,"<$filename2") or die "Can't open $filename2. $!";
while (<T2FILE>) {
if(substr($_,0,length($newUsername)) eq $newUsername) {$c_value=$_;}
}
@c_array = split(/{/,$c_value);
$regName=$c_array[2];
$refer_clinic=$c_array[1];
close(T2FILE) or die "Could not close Registry: $!";

$cookie = $query->cookie(-name=>$username,
		 -value=>$c_value,
		 -domain=>'$myURL'
		 -path=>'/');
print header(-cookie => $cookie);

The cookie is properly set with the name $username.
-- 
Ed Jay (remove 'M' to respond by email)


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

Date: Wed, 07 Mar 2007 16:56:07 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Newbie question re initialization
Message-Id: <x7bqj4btvs.fsf@mail.sysarch.com>

>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:

  EJ> The first script generates a list and associated links:

  EJ> for ($i=0;$i<$arraySize;$i++) {
  EJ>   $line = $subList[$i];

foreach my $line ( @subList ) {

don't use c style for loops like that.

  EJ>   $username = substr($line,0,index($line,","));
  EJ>   print "<div><a
  EJ> href=\"javascript:makeList('$username');\">$regName;</a></div>\n";
  EJ> }

  EJ> The js makeList is used to populate a hidden form element named 'usrnm.':

  EJ> function makeList(who) {
  EJ>   document.form1.usrnm.value = who;
  EJ>   document.forms['form1'].submit();
  EJ> }

  EJ> where:

  EJ> print "<form id='form1' name='form1' action=\"foo.pl\" method=\"post\">\n";
use alternate quote delimiters for that backwacky stuff:

	print qq{<form id='form1' name='form1' action="foo.pl" method="post">\n}";

  EJ> print "<input type='hidden' name='usrnm' value=''>\n";
  EJ> print "</form>\n";

even better, use a here doc and one print. makes it all much cleaner and
easier to edit:

print <<HTML ;
<form id='form1' name='form1' action="foo.pl" method="post">
	<input type='hidden' name='usrnm' value=''>
</form>
HTML

now you can read it and see the html structure.

  EJ> The form element 'usrnm' is submitted to foo.pl:

  EJ> my $username = param('usrnm');

but you still don't validate that you have a username. you may THINK you
do but there could be a problem. always check values from html
forms. remember they can always be filled in by another program which
you didn't write (eg. via an LWP program).

  EJ> and $username is employed as follows: 

  EJ> chdir $rptPath;
  EJ> seek(T2FILE, 0, 0);	#rewind registry.html

why are you seeking on a file you haven't opened yet? seek only means
something on an open handle.

  EJ> $filename2 = "registry.html"; 
  EJ> open (T2FILE,"<$filename2") or die "Can't open $filename2. $!";

all files when opened for reading start at the beginning. no need for
the above (and not working) seek.

  EJ> while (<T2FILE>) {
  EJ> if(substr($_,0,length($newUsername)) eq $newUsername) {$c_value=$_;}
  EJ> }

you need to learn some regexes soon. that may work but is clunky.

	if ( /^\Q$newUsername/ ) {

that is the same test. somewhat simpler and clearer IMO.

  EJ> @c_array = split(/{/,$c_value);

and what if no username was matched? $c_value has no value. 

  EJ> $regName=$c_array[2];
  EJ> $refer_clinic=$c_array[1];

why not assign those directly from split:

my( undef, $refer_clinic, $regName ) = split( /{/, $c_value );


  EJ> $cookie = $query->cookie(-name=>$username,
  EJ> 		 -value=>$c_value,
  EJ> 		 -domain=>'$myURL'
  EJ> 		 -path=>'/');

whitespace is free. use more of it. squished code is hard to read.

  EJ> print header(-cookie => $cookie);

you use whitespace there around => so why not in the previous code?

  EJ> The cookie is properly set with the name $username.

but you say you are still getting a warning on that line which has
$username. so it must be empty in some way. i think see the bug. since
you have an empty username, it will match the first line of T2FILE and
so $c_value will be set to that name and the cookie is set from that. so
you are getting proper results from a series of bugs that seem to cancel
each other out. try using a username that is not in the file or the
second one in the file and see if it still works. my bet is it
fails. which means you aren't getting the username from the form
properly.

and why are you using javascript just to make hidden variables? you can
do that with html much easier.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Wed, 07 Mar 2007 14:33:17 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Newbie question re initialization
Message-Id: <b0fuu2htavgrhl2qa4f0ipb9gaefcbsds5@4ax.com>

Uri Guttman scribed:

>>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:
>
>  EJ> The first script generates a list and associated links:
>
>  EJ> for ($i=0;$i<$arraySize;$i++) {
>  EJ>   $line = $subList[$i];
>
>foreach my $line ( @subList ) {
>
>don't use c style for loops like that.

Did I mention that I'm a newbie? :-)
>
>  EJ>   $username = substr($line,0,index($line,","));
>  EJ>   print "<div><a
>  EJ> href=\"javascript:makeList('$username');\">$regName;</a></div>\n";
>  EJ> }
>
>  EJ> The js makeList is used to populate a hidden form element named 'usrnm.':
>
>  EJ> function makeList(who) {
>  EJ>   document.form1.usrnm.value = who;
>  EJ>   document.forms['form1'].submit();
>  EJ> }
>
>  EJ> where:
>
>  EJ> print "<form id='form1' name='form1' action=\"foo.pl\" method=\"post\">\n";
>use alternate quote delimiters for that backwacky stuff:
>
>	print qq{<form id='form1' name='form1' action="foo.pl" method="post">\n}";
>
>  EJ> print "<input type='hidden' name='usrnm' value=''>\n";
>  EJ> print "</form>\n";
>
>even better, use a here doc and one print. makes it all much cleaner and
>easier to edit:
>
>print <<HTML ;
><form id='form1' name='form1' action="foo.pl" method="post">
>	<input type='hidden' name='usrnm' value=''>
></form>
>HTML
>
>now you can read it and see the html structure.

I didn't post the HTML stuff...I presumed (mea culpa) it would be understood
it was all there.
>
>  EJ> The form element 'usrnm' is submitted to foo.pl:
>
>  EJ> my $username = param('usrnm');
>
>but you still don't validate that you have a username. you may THINK you
>do but there could be a problem. always check values from html
>forms. remember they can always be filled in by another program which
>you didn't write (eg. via an LWP program).

Makes sense.
>
>  EJ> and $username is employed as follows: 
>
>  EJ> chdir $rptPath;
>  EJ> seek(T2FILE, 0, 0);	#rewind registry.html
>
>why are you seeking on a file you haven't opened yet? seek only means
>something on an open handle.

Again, I simply didn't show the opening...or that I skip the first 12 lines
of the file. 
>
>  EJ> $filename2 = "registry.html"; 
>  EJ> open (T2FILE,"<$filename2") or die "Can't open $filename2. $!";
>
>all files when opened for reading start at the beginning. no need for
>the above (and not working) seek.
>
>  EJ> while (<T2FILE>) {
>  EJ> if(substr($_,0,length($newUsername)) eq $newUsername) {$c_value=$_;}
>  EJ> }
>
>you need to learn some regexes soon. that may work but is clunky.
>
>	if ( /^\Q$newUsername/ ) {
>
>that is the same test. somewhat simpler and clearer IMO.

Agreed.
>
>  EJ> @c_array = split(/{/,$c_value);
>
>and what if no username was matched? $c_value has no value.

There will always be a match. The links are derived from the file containing
all valid usernames. 
>
>  EJ> $regName=$c_array[2];
>  EJ> $refer_clinic=$c_array[1];
>
>why not assign those directly from split:

Haven't got that far in Perl yet.
>
>my( undef, $refer_clinic, $regName ) = split( /{/, $c_value );
>
>
>  EJ> $cookie = $query->cookie(-name=>$username,
>  EJ> 		 -value=>$c_value,
>  EJ> 		 -domain=>'$myURL'
>  EJ> 		 -path=>'/');
>
>whitespace is free. use more of it. squished code is hard to read.
>
>  EJ> print header(-cookie => $cookie);
>
>you use whitespace there around => so why not in the previous code?

Different day...
>
>  EJ> The cookie is properly set with the name $username.
>
>but you say you are still getting a warning on that line which has
>$username. so it must be empty in some way. i think see the bug. since
>you have an empty username, it will match the first line of T2FILE and
>so $c_value will be set to that name and the cookie is set from that. so
>you are getting proper results from a series of bugs that seem to cancel
>each other out. try using a username that is not in the file or the
>second one in the file and see if it still works. my bet is it
>fails. which means you aren't getting the username from the form
>properly.

I am able to select any username by link and it works as planned.
>
>and why are you using javascript just to make hidden variables? you can
>do that with html much easier.
>
If I did it using only HTML I would only get the last username in the list. 

Thanks very much for the pointers/education.
-- 
Ed Jay (remove 'M' to respond by email)


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

Date: Wed, 07 Mar 2007 17:58:08 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Newbie question re initialization
Message-Id: <x73b4gbr0f.fsf@mail.sysarch.com>

>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:

  >> even better, use a here doc and one print. makes it all much cleaner and
  >> easier to edit:
  >> 
  >> print <<HTML ;
  >> <form id='form1' name='form1' action="foo.pl" method="post">
  >> <input type='hidden' name='usrnm' value=''>
  >> </form>
  >> HTML
  >> 
  >> now you can read it and see the html structure.

  EJ> I didn't post the HTML stuff...I presumed (mea culpa) it would be
  EJ> understood it was all there.

i didn't say anything about missing html. i said to use a here doc to
print the html so you can then read it more easily and edit it. reading
and editing quoted strings with backwhacked quotes is insane.

  EJ> Again, I simply didn't show the opening...or that I skip the first
  EJ> 12 lines of the file.

then you shouldn't have shown the seek line.

  >> and what if no username was matched? $c_value has no value.

  EJ> There will always be a match. The links are derived from the file
  EJ> containing all valid usernames.

but if an invalid username was entered it could screw things up. also i
didn't notice if you chomped the lines from that file which could also
lead to a problem with matching them later. this still isn't addressing
the fact that you seem to have an undef in $username.

  >> whitespace is free. use more of it. squished code is hard to read.
  >> 
  EJ> print header(-cookie => $cookie);
  >> 
  >> you use whitespace there around => so why not in the previous code?

  EJ> Different day...

consistancy in style will help you 100 days from now when you go back to
read your code. coding is about discipline.

  EJ> The cookie is properly set with the name $username.
  >> 
  >> but you say you are still getting a warning on that line which has
  >> $username. so it must be empty in some way. i think see the bug. since
  >> you have an empty username, it will match the first line of T2FILE and
  >> so $c_value will be set to that name and the cookie is set from that. so
  >> you are getting proper results from a series of bugs that seem to cancel
  >> each other out. try using a username that is not in the file or the
  >> second one in the file and see if it still works. my bet is it
  >> fails. which means you aren't getting the username from the form
  >> properly.

  EJ> I am able to select any username by link and it works as planned.
  >> 
  >> and why are you using javascript just to make hidden variables? you can
  >> do that with html much easier.
  >> 
  EJ> If I did it using only HTML I would only get the last username in the list. 

huh??? you can generates as many hidden fields as you want in html and
use the same param name for them all. each will be sent in the POST and
if you are using CGI.pm they will be parsed out properly. you have a
misconception about html and posting hidden values. remember, html was
around and doing this way before javascript came along. i would
recommend using pure html over unneeded javascript because then you CAN
automate using your site for robots or testing or whatever. it is much
harder to do that if you use javascript (and in this case it serves no
purpose).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 7 Mar 2007 14:43:14 -0800
From: "Jon Hendry" <jonhendry_usenet@mac.com>
Subject: Perl script fails silently at start, can't debug
Message-Id: <1173307394.117985.147560@j27g2000cwj.googlegroups.com>

Hi,

I'm working on some perl scripts - one longish script and some
short .pm's containing object classes (one each).

This morning I was able to run the script. After lunch, it stopped
working for no apparent reason. It just fails, silently.

If I try running it in the debugger, the script terminates instantly,
with no error messages.

perl -wc reveals no problems with any of the files.

For a while, after experimenting with commenting out use statements, I
was able to get it to a point where it would fail and report that one
of the .pm's didn't return true, but that wasn't true either - all the
pm's included a terminal 1;.

Has anyone seen this before? Can anyone suggest a course of action? I
suspect it has something to do with 'use'd code.

I'm on OS X 10.4.8

Thanks!



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

Date: Wed, 07 Mar 2007 18:01:19 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl script fails silently at start, can't debug
Message-Id: <x7vehcacao.fsf@mail.sysarch.com>

>>>>> "JH" == Jon Hendry <jonhendry_usenet@mac.com> writes:

  JH> I'm working on some perl scripts - one longish script and some
  JH> short .pm's containing object classes (one each).

  JH> This morning I was able to run the script. After lunch, it stopped
  JH> working for no apparent reason. It just fails, silently.

what did you have for lunch? were there any bugs in it?

  JH> If I try running it in the debugger, the script terminates instantly,
  JH> with no error messages.

  JH> perl -wc reveals no problems with any of the files.

  JH> For a while, after experimenting with commenting out use
  JH> statements, I was able to get it to a point where it would fail
  JH> and report that one of the .pm's didn't return true, but that
  JH> wasn't true either - all the pm's included a terminal 1;.

i trust perl more than i trust what you say. :)

if perl says one module is false then there must be something in there
that you don't see at the end. or some other issue you can't see but
perl can.

  JH> Has anyone seen this before? Can anyone suggest a course of action? I
  JH> suspect it has something to do with 'use'd code.

no idea. you should try to reduce this to a small example which shows
the same problems and post that here.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

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 V11 Issue 202
**************************************


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