Re: First line of input file not accessible.

2024-07-17 Thread David Precious
On Wed, 17 Jul 2024 17:41:22 +1000 Peter West via beginners wrote: [...] > $ cat print_file > #!/usr/bin/perl -n > while (<>) { > print "$. $_"; > } > exit; [...] > What happened to line 1? It's eaten by the `while (<>) { ... }` loop that is wrapped around your program because you used `-n` i

Re: Please help: perl run out of memory

2022-04-22 Thread David Precious
On Thu, 21 Apr 2022 07:12:07 -0700 al...@coakmail.com wrote: > OP maybe need the streaming IO for reading files. Which is what they were already doing - they used: while () { ... } Which, under the hood, uses readline, to read a line at a time. (where "HD" is their global fileh

Re: Please help: perl run out of memory

2022-04-21 Thread David Precious
On Thu, 21 Apr 2022 17:26:15 +0530 "M.N Thanishka sree Manikandan" wrote: > Hi wilson > Try this module file::slurp Given that the OP is running into memory issues processing an 80+ million line file, I don't think suggesting a CPAN module designed to read the entire contents of a file into mem

Re: perl script question

2019-10-10 Thread David Precious
The error message "FASEQ can not open" doesn't look like something which could be output by the code you've provided. *Either* you should get the "can not read open $!" message (where the $! will be interpolated to the reason it failed), or the message is coming from whatever the "usearch" tool

Re: Question re remove_tree and symlinks

2019-08-24 Thread David Precious
On Fri, 23 Aug 2019 19:13:15 +0100 Mike Martin wrote: > Am I right in believing that remove_tree from File::Path does not > follow symlinks, ie: does not remove the linked file only the link if > there are links in the direstories removed An obvious way to find out would be to just try it - set

Re: Google Sheets API Data Structure

2019-08-16 Thread David Precious
On Thu, 15 Aug 2019 16:18:57 +0100 James Kerwin wrote: > I'm currently investigating a data structure that it gives me to see > what values I can get from it. Through random experimentation I've > managed to find that it had "title" and "id". > > I wrote this to get the data structure containing

Re: Device::SerialPort on debian Buster

2019-07-11 Thread David Precious
On Wed, 10 Jul 2019 08:51:08 -0500 "Martin McCormick" wrote: > The code below talks to what it thinks is a RS-232 serial > port and controlls a radio scanner so that one can program the > scanner's settings and enter frequency and operational data. > Don't worry about all that. It used to w

Re: proper use of TEMPLATE

2019-03-19 Thread David Precious
On Thu, 14 Mar 2019 12:14:59 -0500 Rick T wrote: > Full Course (1 > credit) > > My code can easily replace the correct var with ‘selected’ and the > other vars on the list with a blank. But what should that blank be? > > Should I make it an empty string, a space, undef, or something else? An e

Re: Syntax "||" before sub

2018-11-24 Thread David Precious
On Thu, 22 Nov 2018 12:33:25 -0800 "John W. Krahn" wrote: > On 2018-11-22 8:08 a.m., David Precious wrote: > > > > > > You'll often see these operators used to provide default values. > > > > e.g. > > > >sub hello { > &g

Re: Syntax "||" before sub

2018-11-22 Thread David Precious
On Thu, 22 Nov 2018 13:48:18 + James Kerwin wrote: > Hi All, > > I'm looking through some Perl files for software we use and I noticed > this in one of the config files: > > $c->{guess_doc_type} ||= sub { > > All other similar config files show a similar structure, but without > the "||" b

Re: Read a huge text file in perl

2018-05-24 Thread David Precious
On Thu, 24 May 2018 20:27:23 +0530 SATYABRATA KARAN wrote: > Hello, > Does anyone guide me how to handle a huge file (>50GB) in perl? Your code should be looping line by line, and shouldn't use much memory, depending of course on how long the lines are, and what you're doing with them. It will

Re: captcha

2018-03-05 Thread David Precious
On Mon, 5 Mar 2018 11:43:48 +0700 Eko Budiharto wrote: > dear all, > > I am trying to put a captcha on my site. I already have public key > and secret key from google. I already put the public key on my html > and secret key on the server respond site. But when I ran it, I got > an error, For se

Re: Checking if a website is up doesn't work correctly

2018-02-24 Thread David Precious
On Sat, 17 Feb 2018 18:21:26 +0100 Manfred Lotz wrote: > Thanks. The attached program does better as https://notabug.org > works. Only http://scripts.sil.org doesn't work. It seems there are > special checks active on that site. Yeah, some sites block user-agents recognised as robots, scripts

Re: Can't use 'defined(@array)'

2018-02-23 Thread David Precious
On Fri, 23 Feb 2018 15:46:14 +0100 "jose cabrera" wrote: > Greetings! > > I am using perl v5.22.1, and I am debugging an old script. The code > is, > > if (defined($$glob)) { > $localconfig{$var} = $$glob; > } > elsif (defined (@$glob)) { >

Re: TLS and Perl

2018-01-25 Thread David Precious
On Thu, 25 Jan 2018 10:19:26 -0800 SurfShop wrote: > I keep getting emails from Authorize.net about their upcoming > disablement of TLS 1.0 and TLS 1.1 and I need to know if that has > anything to do with Perl or not. I don't have any code in SurfShop > that references either SSL or TLS, s

Re: Getting the results of a remote script

2017-11-09 Thread David Precious
On Thu, 9 Nov 2017 12:50:05 -0800 SSC_perl wrote: > > On Nov 8, 2017, at 5:16 PM, thelip sia wrote: > > > > you can use backtick to store the output. > > $list = `ssh usern...@domain.com > > '/usr/bin/perl /path/to/dir-list.pl'`; > > Thanks, Heince. I had mistakenly thought those were

Re: Device::SerialPort Am I Missing Something?

2017-11-04 Thread David Precious
On Fri, 03 Nov 2017 15:12:15 -0500 "Martin McCormick" wrote: > What is needed, however, is to be able to use the are_match > feature which fills a buffer with data until a pattern is > detected which stops the read and gives you a series of bytes > that may not necessarily end with a newline

Re: Problems Receiving this List

2017-11-04 Thread David Precious
On Fri, 03 Nov 2017 15:29:29 -0500 "Martin McCormick" wrote: > I just posted a message to this list about the Device::SerialPort > module. I finally saw my message reflected back to me after > quite a bit of head-scratching and some correspondence with the > list-owner address. All message traf

Re: "Information station" using Perl and Raspberry Pi

2017-07-26 Thread David Precious
On Tue, 25 Jul 2017 12:20:44 -0700 SSC_perl wrote: > My first though was to use HTML, but I don't want to use a browser to > display the text onscreen. Would this require a GUI, such as Tk? FWIW, it might be sensible to not fully discount the HTML option - seting an RPi up to start a browser on

Re: How to match words with a consecutive character

2017-05-06 Thread David Precious
On Sat, 6 May 2017 23:13:04 +0200 David Emanuel da Costa Santiago wrote: > Is there any regular expression, that can match any consecutive > character? You want to use a back-reference - e.g. /(.)\1+/ matches any character followed by one or more of that same character. Demo: [davidp@cloudburst

Re: Problem using Email::Mailer on laptop

2017-03-20 Thread David Precious
On Mon, 20 Mar 2017 11:23:39 -0700 SSC_perl wrote: > Is anyone here successfully using Email::Mailer? I installed > it using cpanm a couple of days ago on my Mac and I can’t get it to > work. It just prints the following output and nothing more: > > postdrop: warning: mail_queue_enter: c

Re: Strange HASH(0x2ced735) values

2017-02-21 Thread David Precious
On Tue, 21 Feb 2017 09:11:10 -0800 SSC_perl wrote: > > On Feb 21, 2017, at 8:34 AM, Uri Guttman > > wrote: > > > > you can't trace it from the value. but you can write code where > > that value is stuffed into the db and look for a reference vs 1 or > > a blank. then you can dump the call stack

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-28 Thread David Precious
On Fri, 17 Jun 2016 14:33:12 -0700 Kenneth Wolcott wrote: > Hi; > > I'm having trouble understanding the built-in Perl sort with regards > to mixed numbers and strings > > I'm looking at http://perldoc.perl.org/functions/sort.html > > I have an array that I want to have sorted numericall

Re: Should I add ExtUtils::MakeMaker as prerequisite to Makefile?

2015-02-27 Thread David Precious
On Fri, 27 Feb 2015 23:41:22 +0100 Alex Becker wrote: > So my idea was to specify EUMM v6.46 as minimum in PREREQ_PM. This > way, I would not have to do all this 'if the EUMM version is greater > than X then add Y to Makefile.PL' stuff. > > So, would it work? Does it make sense? I don't think so;

Re: is faster a regexp with multiple choices or a single one with lower case?

2015-01-08 Thread David Precious
lc_first regex_nocase 2674/s -- -24% lc_first 3509/s 31% -- Of course, YMMV. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/c

Re: LDAP server

2014-12-05 Thread David Precious
an email address? Are you confusing LDAP and IMAP, by any chance? Sounds like you want to log in to an email server by IMAP to confirm the mailbox username and password are correct, not use an LDAP server. http://en.wikipedia.org/wiki/LDAP http://en.wikipedia.org/wiki/IMAP -- David Pre

Re: map vs foreach

2014-09-30 Thread David Precious
On Tue, 30 Sep 2014 14:08:14 -0700 SSC_perl wrote: > Is the output of these two lines equivalent? > > map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; > > $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; [...] > Is one more appropriate than the other in a s

Re: activity indicator

2014-09-28 Thread David Precious
On 27 Sep 2014 19:44:22 - sharda wrote: > retrieving the information from the DB in this time delay i.e the > time it takes to fetch the data from the server i have to show an > ajax activity indicator how can i do this. First off, if your DB query is taking long enough to require a progres

Re: Need to understand what this script does.

2014-08-11 Thread David Precious
On Mon, 11 Aug 2014 11:12:34 +0100 David Precious wrote: > On Sun, 10 Aug 2014 16:40:07 +0530 > Uday Vernekar wrote: > > > i din't understand what the whole script is doing.I need to > > understand first what this script is all about. > > Well, it cal

Re: Need to understand what this script does.

2014-08-11 Thread David Precious
On Sun, 10 Aug 2014 16:40:07 +0530 Uday Vernekar wrote: > i din't understand what the whole script is doing.I need to understand > first what this script is all about. Well, it calls some Oracle stored procedures, so without knowing what they do, we can only really tell you "it does something wi

Re: LWP/UserAgent fail authentication:

2014-07-31 Thread David Precious
'm not sure quite why it worked; GitHub's docs say that, if you're using a token, the username should be set as "$token:x-oauth-basic", and the password being unimportant; maybe this code worked against their older, now withdrawn v2 API. Anyway, I believe the lack of a p

Re: Suddenly this script is not working!

2014-07-30 Thread David Precious
On Wed, 30 Jul 2014 11:55:46 -0400 ESChamp wrote: > Robert Wohlfarth wrote on 7/30/2014 10:31 AM: > > On Wed, Jul 30, 2014 at 1:00 AM, ESChamp > > wrote: > > > > 0D 0A 3C 70 72 65 3E 0D 0A > > > > so no invisible characters. > > > > > Or maybe occurs on

Re: Can't Install Mojolicious on Shared Server

2014-07-30 Thread David Precious
On Tue, 29 Jul 2014 18:25:34 -0500 Mike Flannigan wrote: > I pay about $8 per month for a shared server hosting > at Hostgator. I recently asked Hostgator to install > Mojolicious on my account because I wanted to migrate > away from CGI. > > Hostgator tells me they can't install Mojolicious "on

Re: Suddenly this script is not working!

2014-07-29 Thread David Precious
On Mon, 28 Jul 2014 20:48:51 -0400 Shawn H Corey wrote: > > copy $htmfile, $copy; > > # always check for error > copy $htmfile, $copy or die "could not copy $htmlfile\n"; And even more helpfully, include in the message $! - which will contain the error message to show you what actually went w

Re: module installation error from cpan cli

2014-07-14 Thread David Precious
installing Test::More first should get you going. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-ma

Re: Apologetic request for simple one-off script

2014-07-13 Thread David Precious
mal shell redirection, e.g.: $ perl -lane 'say $F[-1]' in.txt > out.txt -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.u

Re: script to match a valid email id

2014-07-11 Thread David Precious
On Fri, 11 Jul 2014 10:20:10 +0300 Yosef Levy wrote: > 2014-07-10 21:30 GMT+03:00 Sunita Pradhan > : > > > I want to write a script which will verify a valid email address . > > Could anybody give some ideas , how to write a pattern for this ? > \b[\w\.-]+@[\w\.-]+\.\w{2,4}\b > This was taken fr

Re: script to match a valid email id

2014-07-10 Thread David Precious
t an email address you want to accept. However, even that could trip you up. For example, "mickey mouse"@[127.0.0.1] is a valid email address :) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linked

Re: Teach script to look for modules in the same prefix when using MakeMaker

2014-06-16 Thread David Precious
On Sun, 15 Jun 2014 20:37:55 +0200 drupsspen wrote: > I'm building an application in Perl and is looking into using a build > system for it. So far I've looked at ExtUtils::MakeMaker. I have > divided my application like this: > > bin/foo > lib/Foo/Bar.pm > lib/Foo/Baz.pm > > The user runs the p

Re: Failed: PAUSE indexer report JUNIPER/Net-Netconf-0.01.zip

2014-06-02 Thread David Precious
ons to JUNIPER for that module, using: https://pause.perl.org/pause/authenquery?ACTION=share_perms (You can either give JUNIPER co-maint, or transfer primary maintainership.) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin

Re: How to change username in Pause account

2014-05-29 Thread David Precious
On Thu, 29 May 2014 10:59:56 + Priyal Jain wrote: > Hello, > > I want to change my username in PAUSE, how should I do that. I don't think you can change your PAUSE username. After all, it would require all mirrors to know to rename your PAUSE dir, invalidate old links, etc. You can, howev

Re: close dbh in the subroutine

2014-05-08 Thread David Precious
On Thu, 08 May 2014 16:54:32 +0400 Jeff Pang wrote: > Hi, > > I created a $dbh object in the main body, and pass it to a > subroutine, then close the $dbh in the subroutine, does it  influence > the $dbh in the main? Yes. It's a reference to the same DBI object. -- To unsubscribe, e-mail:

Re: [irc Q] how to extract info to disk

2014-05-08 Thread David Precious
r channels by pattern. There's also irc.netsplit.de's IRC server/channel search engine: http://irc.netsplit.de/channels/?net=freenode -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/f

Re: time based test

2014-02-15 Thread David Precious
ng point would be awesome. Anything like that? > Time::Fake on CPAN appears to fit the bill: https://metacpan.org/pod/Time::Fake Install it, then e.g.: perl -MTime::Fake="+20y" yourscript.pl (See the docs for the various options etc.) -- David Precious ("bi

Re: mv Is Not Working the Same Way Under System as Under a Shell.

2014-01-30 Thread David Precious
ct you meant \"$directories/deleted_keys\". Oh, and make sure that the variables you're interpolating there aren't from an untrusted source :) Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin

Re: baby perl to get the right date

2014-01-28 Thread David Precious
>dmy('/'); It's a bit of a slow and heavyweight way to go about it if you're not already planning to use DateTime, though :) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/f

Re: Still Trying to Understand Perl Module Control Process

2014-01-14 Thread David Precious
You can provide the exact one you want, e.g.: cpanp -i NLNETLABS/Net-DNS-0.72.tar.gz (I don't use cpanplus, but I'd imagine that'll work; it does with cpan and cpanm) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb

Re: series of numbers to range notation

2014-01-07 Thread David Precious
On Tue, 7 Jan 2014 13:35:39 -0600 Hal Wigoda wrote: > On Tue, Jan 7, 2014 at 1:28 PM, Rajeev Prasad <.ne...@yahoo.com> > wrote: > > so i have this series of numbers: > > [...] > > there are two ranges in there: 349-396, 425-496 > > > > any hints as to how to write a perl code to represent the ser

Re: Gigantic file size processing error

2014-01-02 Thread David Precious
On Thu, 02 Jan 2014 12:19:16 -0500 Uri Guttman wrote: > On 01/02/2014 12:08 PM, David Precious wrote: > > Oh, I was thinking of a wrapper that would: > > > > (a) open a new temp file > > (b) iterate over the source file, line-by-line, calling the provided > > co

Re: Gigantic file size processing error

2014-01-02 Thread David Precious
t actually write such a thing, as a beginner-friendly "here's how to easily modify a file, line by line, with minimal effort" offering.) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.pre

Re: Gigantic file size processing error

2014-01-02 Thread David Precious
On Thu, 02 Jan 2014 11:18:31 -0500 Uri Guttman wrote: > On 01/02/2014 10:39 AM, David Precious wrote: > > Secondly - do you need to work on the file as a whole, or can you > > just loop over it, making changes, and writing them back out? In > > other words, do you *need* t

Re: Gigantic file size processing error

2014-01-02 Thread David Precious
w(edit_file_lines); my $filename = '/tmp/foo'; edit_file_lines(sub { s/badger/mushroom/g }, $filename); The above would of course replace every occurrence of 'badger' with 'mushroom' in the file. Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.c

Re: inserting a variable server name into code

2013-12-19 Thread David Precious
id several variants I tried. What did the error say? If the above code is verbatim, it's because you missed the trailing semicolon after the variable definition - i.e.: my $server = "newserver"; -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.pres

Re: please help correct my script

2013-11-07 Thread David Precious
s*5\.\.1/ should match. (\s* allowing zero or more whitespace characters before the 5) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/

Re: Help on saving and retrieving data structures

2013-09-13 Thread David Precious
$game{ipl}->{players}->[1]->{name}, "\n"; > print "Role : ", $game{ipl}->{players}->[1]->{role}, "\n"; > print "Country : ", $game{ipl}->{players}->[1]->{country}, "\n"; > [/code] > > I have also tried using &#

Re: handeling multiple tcp connections

2013-09-04 Thread David Precious
ork for you. https://metacpan.org/release/Net-Server -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-mail:

Re: Regular expression help pls !

2013-08-23 Thread David Precious
{ # $port matched one of the ones you wanted. print "$line\n"; } } } Hope that helps? -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk

Re: Need to login/logout for Domain Users

2013-08-14 Thread David Precious
On Wed, 14 Aug 2013 11:08:01 +0530 Frank Vino wrote: > Hi All, > >Here is my requirement could you please help on this. > > I have Domain Controller for 100 users, and i have client PC > (windows 7), i would like to login with multiple users for every 5 > minutes in a same client PC. Wha

Re: Need to login/logout for Domain Users

2013-08-14 Thread David Precious
On Wed, 14 Aug 2013 13:47:37 +0800 Ken Peng wrote: > On 2013-8-14 13:38, Frank Vino wrote: > > Here is my requirement could you please help on this. > > > > I have Domain Controller for 100 users, and i have client PC > > (windows 7), i would like to login with multiple users for every 5 > >

Re: parsing html

2013-08-08 Thread David Precious
On Thu, 8 Aug 2013 22:42:01 +0530 Unknown User wrote: > What would be the best module available for parsing html in your > opinion? My intention is to parse html that contains a table of 5 > columns and any number of rows For parsing HTML tables, you want HTML::TableExtract, IMO. https://metacp

Re: Social network map

2013-07-15 Thread David Precious
o a more succinct question - tell us what you've tried, and what you're stumbling upon, etc. Maybe worth a read: http://www.bbc.co.uk/blogs/blogcollegeofjournalism/posts/How-to-map-your-social-network Cheers Dave P -- David Precious ("bigpresh") http://www.

Re: Who instantiated an object

2013-05-31 Thread David Precious
On Fri, 31 May 2013 13:13:29 + "Weidner, Ron" wrote: > I have and object with a function called new. (seen below). What I > want to do is instead of simply calling die I want to know who called > "new" without the required params. (like a stacktrace) I've tried > confess, longmess, and cal

Re: help with some code

2013-05-23 Thread David Precious
On Thu, 23 May 2013 20:45:05 +0100 Rahim Fakir wrote: > Iam practicing from start and I have a problem with this code: > This is the comment of the console, i coulnd't give a round to it, pls > help... > > > Can't locate Glib.pm in @INC <@INC contains: C:/Dwimperl/perl/site/lib > C:/Dwimperl/p

Re: Spreadsheet::WriteExcel - multi-coloured text in cells

2013-05-15 Thread David Precious
for in Excel or similar yourself? If not, then I very much doubt you can do it via Spreadsheet::WriteExcel. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpan

Re: script dies when Net::DNS resolve fails

2013-05-13 Thread David Precious
ple output suggests that execution gets to your "query failed:" warning in the else block, so something else is happening after that - something which we have no idea, since we're not seeing the whole code. -- David Precious ("bigpresh") http://www.preshweb.co.uk/

Re: How to install non-most recent versions of the module "warnings"

2013-05-09 Thread David Precious
hat you'd want (if you'd wanted to upgrade perl itself, you'd have said so). What makes you think you needed to upgrade 'warnings' ? -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.p

Re: how to retrieve the keys from hash in the sequence in which data is inserted

2013-04-23 Thread David Precious
andom. The Tie::IxHash module on CPAN can be used to obtain the behaviour you're after, though. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.p

Re: Perl Script for parsing log files.

2013-04-13 Thread David Precious
rocessing, then the next 5. What you're talking about sounds a lot like "grep -C5 filename", though - possible wheel re-invention :) Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin

Re: Any alternative for substr() function

2013-04-10 Thread David Precious
On Wed, 10 Apr 2013 08:45:40 -0700 Bob goolsby wrote: > Before you go off on a goose chase, how do you know that substr() is > going to be a problem for you? Have you bench-marked it? If your > file is as large as you say, I strongly suspect that your bottleneck > is going to be I/O and any dif

Re: Trying to parse a URL string

2013-03-24 Thread David Precious
case it > matters, this variable is coming from a db. URI and URI::QueryParam will do exactly what you need: use URI; use URI::QueryParam; my $uri = URI->new($referrer); my $q = $uri->query_param('q'); -- David Precious ("bigpresh") http://www.preshw

Re: First Mech script: entering a form value (another simple thing no doubt)

2013-03-14 Thread David Precious
hat happens. Failing that, you'll have to use the form in your browser while using an addon like Firebug or something, or capturing HTTP traffic off the wire, and see what happens, and make your script do the same. -- David Precious ("bigpresh") http://www.preshweb.co.uk/

Re: Email::Mime not able to send array in mesg body

2013-02-20 Thread David Precious
ements in @array, with a newline after each. If, however, you're trying to send a multi-part message, and the array contains the multiple parts, you want the 'parts' param, not 'body_str'. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.presh

Re: matching certain lines

2013-02-09 Thread David Precious
t'll skip the start & end lines though, so you'll probably want to modify the last regex to include them. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co

Re: Database interface

2013-02-05 Thread David Precious
//metacpan.org/module/Dancer::Plugin::SimpleCRUD (Disclaimer: I wrote it, so consider me biased :) ) Both will allow you to fairly easily provide an interface to list/search/create/edit/delete records in a database table via a web interface. -- David Precious ("bigpresh") h

Re: how to find item that happened once in an array

2013-01-20 Thread David Precious
} == 1 } keys %counts; Yep, that's how I'd do it, but you meant grep, not map :) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/

Re: reducing perl cpu usage

2013-01-14 Thread David Precious
vel::NYTProf can be awesome to see where your code is spending most of its time, so you know where to focus. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpan

Re: Hi

2013-01-10 Thread David Precious
t-Unsubscribe: <mailto:beginners-unsubscr...@perl.org> Drop a blank email to that email address, and it should do the trick. Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/fac

Re: check processes accessing file system

2013-01-10 Thread David Precious
On Thu, 10 Jan 2013 05:01:38 -0800 (PST) "Paul.G" wrote: > Linux/Unix you would use. > > eg: > fuser -c /tmp > or > lsof could also be used. > > > I was wondering if there was a perl module that does the same thing. See Unix::Lsof then, as per my reply - it should do what you need. -- To u

Re: File:: Find help

2013-01-10 Thread David Precious
r code to simply use File::Find::Rule exclusively. Alternatively, call File::Find::find() instead of just find(). -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpan

Re: check processes accessing file system

2013-01-10 Thread David Precious
use Unix::Lsof; my ($output,$error) = Unix::Lsof::lsof("afile.txt"); my @pids = keys %$output; (Checking for error is left as an exercise to the reader.) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedi

Re: finding head and tail in data structure

2013-01-10 Thread David Precious
ad then follow the path > as above? Many thanks. What have you tried so far? What have you got stuck on? How do you know where the start of the route is? (Rememeber, hash keys will come back in essentially random order; so, where do you start?) If you need to start following from the firs

Re: bool test return issues

2013-01-07 Thread David Precious
with problems with Perl, but stuff specific to psh would be better taken up with the psh project directly. You could raise an issue on GitHub: https://github.com/gnp/psh/issues Or find the psh mailing lists at: http://sourceforge.net/mail/?group_id=475 Hope that helps a little? -- David Pre

Re: bool test return issues

2013-01-05 Thread David Precious
1 ) . "\n"); ... would still have provided the result you were expecting. (I do of course agree that excessive use of parenthesis where not needed can instead hurt readability - just providing an example of where they could have helped.) The sections in perldoc perlop on precedence a

Re: Array vs List output

2013-01-02 Thread David Precious
ay elements, don't use the array in double quotes. You can send it to print without them: print @lines; -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/face

Re: Building a small web-app in Perl

2013-01-02 Thread David Precious
in::Auth::Extensible ... which is one of mine, so consider that recommendation biased of course :) I'm fairly sure there's something similar for Mojolicious too. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/li

Re: Regex help

2012-12-22 Thread David Precious
oreach my $vcard ( $address_book->vcards() ) { print "Got card for " . $vcard->fullname() . "\n"; } It will ignore the non-vcard content in the example you provided, and just provide you easy access to the data from each vcard. That's a much nicer app

Re: Tutorial for a menu driven perl script

2012-12-21 Thread David Precious
help you here, I think. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: hash help !

2012-11-15 Thread David Precious
27;, @{ $hash{'22:5a'} }; Is that what you're looking for? -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To

Re: Date::Manip question

2012-11-08 Thread David Precious
On Thu, 8 Nov 2012 12:53:31 +0100 Rob Coops wrote: > Something like the below would do perfectly fine... > > my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = > localtime(time); > > my @months = ( 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', > 'SEP', 'OCT', 'NOV', 'DEC' ); >

Re: Array elements in Hash

2012-10-04 Thread David Precious
? Where did you get stuck? Hint: it should be pretty easy to loop over @match, use substr() to get the first two chars, then look for that key in the hash. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.p

Re: Module deleted from cpan

2012-09-29 Thread David Precious
decided there were better options out there, and no longer wished to maintain their module. Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpan

Re: how to deal with columns in perl

2012-09-17 Thread David Precious
my $avg = List::Util::sum( @{ $values_by_genename{$genename} } ) / scalar @{ $values_by_genename{$genename} }; print "$avg,$genename\n"; } Of course, you'd be better off parsing the input using Text::CSV, but the above should give you som

Re: Clarification re Perl Script out of control

2012-09-14 Thread David Precious
can trace and record the execution flow of your program. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-ma

Re: POD and Perldoc

2012-09-13 Thread David Precious
... } =item alive Checks whether this badger is alive. =cut sub alive { my $self = shift; return $self->has_pulse; } ... etc. (Hopefully you get the idea.) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co

Re: expect.pm not recognising match string

2012-09-06 Thread David Precious
s (depending on whether you need to capture just STDOUT or STDOUT and STDERR from the process). For example: for my $command (@commands) { my $result = $ssh->capture($command); } I believe that should work, no? -- David Precious ("bigpresh") http://ww

Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?

2012-07-05 Thread David Precious
On Thu, 5 Jul 2012 09:30:01 -0400 Phil Pinkerton wrote: > ok using the example input file I got errors > > Use of uninitialized value $current_resource in string eq > at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. [...] > Invalid resource format in ! (format 'repo:/path')! Ah, I recall no

Re: Something mojolicious

2012-07-05 Thread David Precious
On Thu, 5 Jul 2012 18:03:07 +0800 lina wrote: > But on my two webbrowers when I tried localhost:3000 it failed to > open. As in connection failed, or gave some other error? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http:

Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?

2012-07-04 Thread David Precious
./getACLinfo.pl aborted due to compilation errors. Whoops - as Chris pointed out, 'say' requires perl 5.10 or newer; I should have included 'use 5.010' in the script to indicate that, but forgot to (I have $PERL5OPT set to '-M5.010' on most boxes). Chris's mail c

Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?

2012-07-03 Thread David Precious
If you install SVN::Access, the above should work for you, and should produce mostly what you need, e.g.: ritched2~repo1:/~repo1_devs~r appalas~repo1:/~repo1_devs~r Handing the _admn groups as a special case is left as an exercise to you, but should be reasonably easy given the above as a st

Re: hash sort on value

2012-07-02 Thread David Precious
On Mon, 2 Jul 2012 11:42:44 -0500 Chris Stinemetz wrote: > I have a 3 deminsional hash that I would like to sort on the value in > descending order. I can't quite seem to figure it out > > The portion of the program I can't get figured out: > ## body > foreach my $frameNo ( keys %RNC ) { > fore

  1   2   >