### Start Session with Defaults Source: https://metacpan.org/pod/session Example of starting an interactive session using all default settings. ```bash session ``` -------------------------------- ### Install dependencies and start MariaDB on Fedora Source: https://metacpan.org/pod/distribution/DBD-MariaDB/lib/DBD/MariaDB/INSTALL.pod Install the required development libraries, compiler, and Perl test modules, then start the MariaDB service to run tests. ```bash yum -y install make gcc mariadb-devel mariadb-libs mariadb-serveryum -y install "perl(Test::Deep)" "perl(Test::More)"systemctl start mariadb.service ``` -------------------------------- ### N Start configuration Source: https://metacpan.org/pod/Math%3A%3APlanePath%3A%3ACorner Example of using n_start to change the starting index of the path. ```text n_start => 0 5 | 25 ... 4 | 16 17 18 19 20 3 | 9 10 11 12 21 2 | 4 5 6 13 22 1 | 1 2 7 14 23Y=0 | 0 3 8 15 24 ----------------- X=0 1 2 3 ``` -------------------------------- ### Configure N Start Source: https://metacpan.org/pod/Math%3A%3APlanePath%3A%3AAnvilSpiral Example of using the 'n_start' parameter to change the starting integer value. ```text n_start => 020-19-18-17-16-15-14-13 ... \ / / 21 4--3--2--1 12 35 \ \ / / / 22 5 0 11 34 / / \ \ 23 6--7--8--9-10 33 / \ 24-25-26-27-28-29-30-31-32 ``` -------------------------------- ### Start Session with Custom Resources Source: https://metacpan.org/pod/session Example of starting an interactive session with 2 CPU cores, 2000 MB of memory, and an 8-hour duration. ```bash session -c 2 -m 2GB -h 8 ``` -------------------------------- ### Vcpkg Quick Start Guide Source: https://metacpan.org/pod/Alien%3A%3ABuild%3A%3APlugin%3A%3AProbe%3A%3AVcpkg Steps to install Vcpkg, configure the environment, and install a package for use with Alien::Build. ```bash # install VcpkgC:\> git clone https://github.com/Microsoft/vcpkg.gitC:\> cd vcpkgC:\vcpkg> .\bootstrap-vcpkg.batC:\vcpkg> .\vcpkg integrate install# update PATH to include the bin directory# so that .DLL files can be found by PerlC:\vcpkg> path c:\vcpkg\installed\x64-windows\bin;%PATH%# install the packages that you wantC:\vcpkg> .\vcpkg install libffi# install the alien that uses itC:\vcpkg> cpanm Alien::FFI ``` -------------------------------- ### Example actions list Source: https://metacpan.org/pod/Rinci%3A%3ATransaction A list of actions involved in the setup_unix_user example. ```perl ['My::adduser', {group=>'bob'}] ['My::addgroup', {group=>'bob'}] ['My::mkdir', {path=>'/home/bob'}] ``` -------------------------------- ### Install Test::HTTP::Server::Simple with CPAN shell Source: https://metacpan.org/pod/Test%3A%3AHTTP%3A%3AServer%3A%3ASimple Install the module using the CPAN shell: start the shell and run the install command. ```Shell perl -MCPAN -e shell install Test::HTTP::Server::Simple ``` -------------------------------- ### line_column() example Source: https://metacpan.org/pod/Marpa%3A%3AR2%3A%3AScanless%3A%3AR Uses pause_span() to get the start location and span length, then calls line_column($start) to obtain the corresponding line and column as a 2-element array. ```Perl my ( $start, $span_length ) = $re->pause_span();my ( $line, $column ) = $re->line_column($start); ``` -------------------------------- ### Install using Makefile.PL Source: https://metacpan.org/pod/Test%3A%3ADistribution Alternative command to initiate installation using Makefile.PL if Module::Build is not available. ```bash perl Makefile.PL ``` -------------------------------- ### Full Parallel Execution Example Source: https://metacpan.org/pod/distribution/GRID-Machine/lib/GRID/Machine/Group.pod A complete script demonstrating the setup of machines, cluster creation, method installation, and parallel execution. ```perl $ cat -n pi8.pl 1 #!/usr/bin/perl -w 2 use strict; 3 use GRID::Machine; 4 use GRID::Machine::Group; 5 use Data::Dumper; 6 7 my @MACHINE_NAMES = split /\s+/, $ENV{MACHINES}; 8 my @m = map { GRID::Machine->new(host => $_, wait => 5, survive => 1) } @MACHINE_NAMES; 9 10 my $c = GRID::Machine::Group->new(cluster => [ @m ]); 11 12 $c->sub(suma_areas => q{ 13 my ($id, $N, $np) = @_; 14 15 my $sum = 0; 16 for (my $i = $id; $i < $N; $i += $np) { 17 my $x = ($i + 0.5) / $N; 18 $sum += 4 / (1 + $x * $x); 19 } 20 $sum /= $N; 21 }); 22 23 my ($N, $np, $pi) = (1000, 4, 0); 24 25 print Dumper($c->suma_areas(args => [ map { [$_, $N, $np] } 0..$np-1 ])); ``` -------------------------------- ### Initialize application and configuration file Source: https://metacpan.org/pod/Mojolicious%3A%3AGuides%3A%3ACookbook Create a new application directory and a default configuration file. ```bash $ mkdir myapp$ cd myapp$ touch myapp.pl$ chmod 744 myapp.pl$ echo '{name => "my Mojolicious application"};' > myapp.conf ``` -------------------------------- ### Install Setup via cpanm Source: https://metacpan.org/pod/Setup Command to install the Setup module using cpanm. ```bash cpanm Setup ``` -------------------------------- ### Basic WebSocket Server Setup Source: https://metacpan.org/pod/AnyEvent%3A%3AWebSocket%3A%3AServer A minimal example demonstrating how to initialize a server and echo received messages back to the client. ```perl use AnyEvent::Socket qw(tcp_server);use AnyEvent::WebSocket::Server;my $server = AnyEvent::WebSocket::Server->new();my $tcp_server;$tcp_server = tcp_server undef, 8080, sub { my ($fh) = @_; $server->establish($fh)->cb(sub { my $connection = eval { shift->recv }; if($@) { warn "Invalid connection request: $@\n"; close($fh); return; } $connection->on(each_message => sub { my ($connection, $message) = @_; $connection->send($message); ## echo }); $connection->on(finish => sub { undef $connection; }); });}; ``` -------------------------------- ### Complete Hello World application Source: https://metacpan.org/pod/distribution/Win32-GUI/GENERATED/Win32/GUI/Tutorial/Part1.pod A complete example combining window creation, label addition, and event handling. ```perl use Win32::GUI(); $main = Win32::GUI::Window->new( -name => 'Main', -width => 100, -height => 100,); $main->AddLabel(-text => "Hello, world"); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { -1; } ``` -------------------------------- ### get Method Example Source: https://metacpan.org/pod/distribution/GRID-Machine/lib/GRID/Machine.pod Example of using the get method to transfer files from a remote machine. ```perl use GRID::Machine;my $m = GRID::Machine->new( host => shift(), startdir => 'tutu',);$m->put([ glob('nes*.pl') ]);$m->run('uname -a; pwd; ls -l n*.pl');print "*******************************\n";my $progs = $m->glob('nes*.pl')->results;$m->get($progs, '/tmp/');system('uname -a; pwd; ls -l n*.pl'); ``` -------------------------------- ### Example Output of Installed Subroutines Source: https://metacpan.org/pod/distribution/GRID-Machine/lib/GRID/Machine/REMOTE.pod The output produced by the previous example showing the list of installed subroutines. ```text $ accessobject.pltarsysteminstalledgetcwdetc. ``` -------------------------------- ### Example file.txt content Source: https://metacpan.org/pod/distribution/App-sorted/script/sorted Initial content for the first example scenario. ```text 123 ``` -------------------------------- ### start([$start]) Source: https://metacpan.org/pod/Set%3A%3AFA%3A%3AElement Get or set the start state. `start` is a parameter to `new([%args])`. ```APIDOC ## start([$start]) ### Description Get or set the start state. `start` is a parameter to `new([%args])`. ### Method start ### Parameters #### Optional Parameters - **$start** - Optional - The start state to set. ### Usage - When called without arguments, returns the current start state. - When called with a value, sets the start state. ``` -------------------------------- ### Configure server modules Source: https://metacpan.org/pod/distribution/Poet/lib/Poet/Manual/Configuring.pod Example of specifying a list of modules to load on server startup. ```text server.load_modules: - DBI - List::Util - MyApp::Foo - MyApp::Bar ``` -------------------------------- ### Manual installation of App::Utils Source: https://metacpan.org/pod/save Installs the distribution manually by running the Makefile, building, and installing. ```bash $ perl Makefile.PL$ make$ make install ``` -------------------------------- ### Install Setup via CPAN shell Source: https://metacpan.org/pod/Setup Commands to install the Setup module using the interactive CPAN shell. ```bash perl -MCPAN -e shell install Setup ``` -------------------------------- ### Manual Installation from Source Source: https://metacpan.org/pod/distribution/DBIx-SQLEngine/SQLEngine/Docs/ReadMe.pod Commands to unpack, configure, test, and install the distribution manually. ```bash tar xzf DBIx-SQLEngine-*.tar.gzcd DBIx-SQLEngine-*perl Makefile.PLmake test && sudo make install ``` -------------------------------- ### $start = $entry->start Source: https://metacpan.org/pod/Stone%3A%3AGB_Sequence Get the start position of the sequence, currently always '1'. ```APIDOC ## $start = $entry->start ### Description Get the start position of the sequence, currently always '1'. ### Method start ### Parameters None ### Returns - **$start** (integer) - The start position of the sequence (always 1). ``` -------------------------------- ### morbo CLI usage examples Source: https://metacpan.org/pod/morbo Examples of starting the Morbo server with various options including custom modes, listen locations, and watched directories. ```text Usage: morbo [OPTIONS] [APPLICATION] morbo ./script/my_app morbo ./myapp.pl morbo -m production -l https://*:443 -l http://[::]:3000 ./myapp.pl morbo -l 'https://*:443?cert=./server.crt&key=./server.key' ./myapp.pl morbo -w /usr/local/lib -w public -w myapp.conf ./myapp.plOptions: -b, --backend Morbo backend to use for reloading, defaults to "Poll" -h, --help Show this message -l, --listen One or more locations you want to listen on, defaults to the value of MOJO_LISTEN or "http://*:3000" -m, --mode Operating mode for your application, defaults to the value of MOJO_MODE/PLACK_ENV or "development" -v, --verbose Print details about what files changed to STDOUT -w, --watch One or more directories and files to watch for changes, defaults to the application script as well as the "lib" and "templates" directories in the current working directory ``` -------------------------------- ### Install from source using Makefile.PL Source: https://metacpan.org/pod/MarpaX%3A%3ADemo%3A%3ASampleScripts Unpack the distribution and use ExtUtils::MakeMaker to install. ```bash perl Makefile.PLmake (or dmake or nmake)make testmake install ``` -------------------------------- ### start Source: https://metacpan.org/pod/Bio%3A%3ARangeI Get or set the start of the range. Returns the start value, optionally accepts a new start value. ```APIDOC ## start ### Description Get/set the start of this range. ### Usage $start = $range->start(); ### Returns The start of this range. ### Arguments Optionally allows the start to be set using $range->start($start). ``` -------------------------------- ### Sample Configuration File Lines Source: https://metacpan.org/pod/distribution/App-Context/lib/App/devguide.pod Example lines from a .conf file showing variable assignments for perlinc, debugmode, showsession, gzip, and configFile. ```text perlinc = /usr/ov/acoc/dev/src/Appx-Blue, /usr/ov/acoc/dev/lib/perl5/5.6.0 debugmode = record showsession = 1 gzip = 1 configFile = app.pl ``` -------------------------------- ### Install MySQL on Debian and start daemon Source: https://metacpan.org/pod/Catalyst%3A%3AManual%3A%3ATutorial%3A%3A10_Appendices Commands for Debian users to install MySQL client and server and start the MySQL daemon. Run as root. ```bash apt-get install mysql-client mysql-server/etc/init.d/mysql start ``` -------------------------------- ### Example Simple Configuration File Source: https://metacpan.org/pod/Plugins%3A%3AStyle1 A sample linear configuration file demonstrating plugin definitions and nested plugin settings. ```text sleeptime 1plugin SyslogScan::Daemon::BlacklistDetector as bld_bld_debug 0bld_plugin SyslogScan::Daemon::BlacklistDetector::Postfix rx_ourIP 127\.0\.0\.1 logpath /var/log/mail.log debug 0bld_plugin SyslogScan::Daemon::BlacklistDetector::EmailNotify debug 1 notify "John " renotify_time 7200 forget_time 3600 sendfrom root clean_time 1800 maxkeep 100 ``` -------------------------------- ### Install MySQL on CentOS and start daemon Source: https://metacpan.org/pod/Catalyst%3A%3AManual%3A%3ATutorial%3A%3A10_Appendices Commands for CentOS users to install MySQL server and client and start the MySQL daemon. Run as root. ```bash yum -y install mysql mysql-serverservice mysqld start ``` -------------------------------- ### ReverseAdd sequence example Source: https://metacpan.org/pod/Math%3A%3ANumSeq%3A%3AReverseAdd An example sequence starting from 1. ```text 1,2,4,8,16,77,154,605,1111,2222,... ``` -------------------------------- ### Implement a basic daemon with Daemon::Generic Source: https://metacpan.org/pod/distribution/Daemon-Generic/lib/Daemon/Generic.pod A minimal example showing how to initialize a daemon, read a configuration file, and run a loop. ```perl my $sleeptime = 1;newdaemon(progname => 'ticktockd',pidfile => '/var/run/ticktockd.pid',configfile => '/etc/ticktockd.conf',);sub gd_preconfig{my ($self) = @_;open(CONFIG, "<$self->{configfile}") or die;while() { $sleeptime = $1 if /^sleeptime\s+(\d+)/;}close(CONFIG);return ();}sub gd_run{while(1) { sleep($sleeptime); print scalar(localtime(time))."\n";}} ``` -------------------------------- ### Initialize Arch::Test::Framework Source: https://metacpan.org/pod/Arch%3A%3ATest%3A%3AFramework Basic usage example showing how to instantiate the framework, create an archive, a version, and a project tree. ```perl use Arch::Test::Framework;my $fw = Arch::Test::Framework->new;my $archive = $fw->make_archive;my $version = $archive->make_version();my $tree = $fw->make_tree($version);## do something with $tree#$tree->import('initial import'); ``` -------------------------------- ### Example URL for Configuration File Selection Source: https://metacpan.org/pod/distribution/App-Context/lib/App/devguide.pod An example URL demonstrating how PATH_INFO is used to select a specific configuration file, such as ecommerce_shop.conf. ```text http://www.officevision.com/cgi-bin/pub/p5ee/app/ecommerce/shop ``` -------------------------------- ### get Method Output Source: https://metacpan.org/pod/distribution/GRID-Machine/lib/GRID/Machine.pod The output produced by the get method example. ```text $ get.pl remoteLinux remote 2.6.15-1-686-smp #2 SMP Mon Mar 6 15:34:50 UTC 2006 i686 GNU/Linux/home/casiano/tutu-rwxr-xr-x 1 casiano casiano 569 2007-05-16 13:45 nested2.pl-rwxr-xr-x 1 casiano casiano 756 2007-05-22 10:10 nested3.pl-rwxr-xr-x 1 casiano casiano 511 2007-06-27 13:08 nested4.pl-rwxr-xr-x 1 casiano casiano 450 2007-06-27 15:20 nested5.pl-rwxr-xr-x 1 casiano casiano 603 2007-05-16 14:49 nested.pl*******************************Linux local 2.4.20-perfctr #6 SMP vie abr 2 18:36:12 WEST 2004 i686 GNU/Linux/tmp-rwxr-xr-x 1 pp2 pp2 569 2007-05-16 13:45 nested2.pl-rwxr-xr-x 1 pp2 pp2 756 2007-05-22 10:10 nested3.pl-rwxr-xr-x 1 pp2 pp2 511 2007-06-27 13:08 nested4.pl-rwxr-xr-x 1 pp2 pp2 450 2007-06-27 15:20 nested5.pl-rwxr-xr-x 1 pp2 pp2 603 2007-05-16 14:49 nested.pl ``` -------------------------------- ### Get start delimiter Source: https://metacpan.org/pod/PPIx%3A%3ARegexp%3A%3ATokenizer Accesses the start delimiter for the regular expression. ```perl my $start_delimiter = $tokenizer->get_start_delimiter(); ``` -------------------------------- ### Build and install from distro using Makefile.PL Source: https://metacpan.org/pod/MarpaX%3A%3ADemo%3A%3AStringParser Alternative manual installation using Makefile.PL: run perl Makefile.PL, then make (or dmake or nmake), then make test, and finally make install. ```shell perl Makefile.PL make (or dmake or nmake) make test make install ``` -------------------------------- ### Complete GUI application example Source: https://metacpan.org/pod/distribution/Win32-GUI/GENERATED/Win32/GUI/Tutorial/Part1.pod A full implementation demonstrating window creation, font styling, label addition, centering on the desktop, and handling resize events. ```perl use Win32::GUI(); $text = defined($ARGV[0]) ? $ARGV[0] : "Hello, world"; $main = Win32::GUI::Window->new( -name => 'Main', -text => 'Perl',); $font = Win32::GUI::Font->new( -name => "Comic Sans MS", -size => 24,); $label = $main->AddLabel( -text => $text, -font => $font, -foreground => [255, 0, 0],); $ncw = $main->Width() - $main->ScaleWidth(); $nch = $main->Height() - $main->ScaleHeight(); $w = $label->Width() + $ncw; $h = $label->Height() + $nch; $desk = Win32::GUI::GetDesktopWindow(); $dw = Win32::GUI::Width($desk); $dh = Win32::GUI::Height($desk); $x = ($dw - $w) / 2; $y = ($dh - $h) / 2; $main->Change(-minsize => [$w, $h]); $main->Resize($w, $h); $main->Move($x, $y); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate {-1; } sub Main_Resize { my $mw = $main->ScaleWidth(); my $mh = $main->ScaleHeight(); my $lw = $label->Width(); my $lh = $label->Height();$label->Left(int(($mw - $lw) / 2));$label->Top(int(($mh - $lh) / 2)); } ``` -------------------------------- ### start Source: https://metacpan.org/pod/Plugin Gets or sets the start percent of the ellipse. Accepts a numeric value. ```APIDOC ## start ### Description Gets or sets the start percent of the ellipse. ### Method start ### Parameters #### Request Body - value (Num) - Optional - The start percent value. ### Request Example $ellipse->start($p); ``` -------------------------------- ### Xenodromes sequence example values Source: https://metacpan.org/pod/Math%3A%3ANumSeq%3A%3AXenodromes Example output showing the start of the sequence. ```text 0, ..., 9, 10, 12, 13, ..., 19, 20, 21, 23, 24, ...# starting i=1 value=0 ``` -------------------------------- ### Initialize and use Net::SSH::Any Source: https://metacpan.org/pod/Net%3A%3ASSH%3A%3AAny Demonstrates creating a new SSH connection, capturing command output, executing system commands, and initiating an SFTP session. ```perl use Net::SSH::Any;my $ssh = Net::SSH::Any->new($host, user => $user, password => $passwd);my @out = $ssh->capture(cat => "/etc/passwd");my ($out, $err) = $ssh->capture2("ls -l /");$ssh->system("foo");my $sftp = $ssh->sftp; # returns Net::SFTP::Foreign object$sftp->put($local_path, $remote_path); ``` -------------------------------- ### Install from source using Build.PL Source: https://metacpan.org/pod/MarpaX%3A%3ADemo%3A%3ASampleScripts Unpack the distribution and use Module::Build to install. ```bash perl Build.PL./Build./Build testsudo ./Build install ``` -------------------------------- ### started_ok [$text] Source: https://metacpan.org/pod/Test%3A%3AHTTP%3A%3AServer%3A%3ASimple Starts the configured server in the background and returns the URL to connect to it. Takes an optional test description. The server must be configured (port set) but not yet run or backgrounded. ```APIDOC ## started_ok [$text] ### Description Starts the server in the background and returns the URL http://localhost:$port to connect to it. Takes an optional test description. The server must be configured (port set) but not yet run or backgrounded. ### Method started_ok ### Parameters - **$text** (scalar) - Optional - Test description. ### Returns - **URL** (string) - The URL http://localhost:$port to connect to the server. ### Notes - The server is forked to run in the background. - The server is killed when the test script dies, even on interrupt. - If the child process dies or never listens, the call hangs. - May not work with a custom Net::Server. ``` -------------------------------- ### Simplified Log::Any::App initialization Source: https://metacpan.org/pod/Log%3A%3AAny%3A%3AApp The concise replacement for manual logging setup using Log::Any::App. ```perl use Log::Any::App '$log'; # plus some other options when necessary ``` -------------------------------- ### HofstadterFigure sequence starting at 5 Source: https://metacpan.org/pod/Math%3A%3ANumSeq%3A%3AHofstadterFigure Example sequence output when initialized with start => 5. ```text 5, 6, 8, 11, 15, 22, 31, 41, 53, 66, ... ``` -------------------------------- ### HofstadterFigure sequence starting at 2 Source: https://metacpan.org/pod/Math%3A%3ANumSeq%3A%3AHofstadterFigure Example sequence output when initialized with start => 2. ```text 2, 3, 7, 12, 18, 26, 35, 45, 56, ... ``` -------------------------------- ### Initialize Squatting app for PSGI Source: https://metacpan.org/pod/Squatting%3A%3AOn%3A%3APSGI Example of an app.psgi file setup to handle requests using the Squatting::On::PSGI adapter. ```perl # app.psgi use App 'On::PSGI'; App->init; my $handler = sub { my $env = shift; App->psgi($env); }; ``` -------------------------------- ### Hexify output with start parameter Source: https://metacpan.org/pod/Data%3A%3AHexify Example of how the output appears when using the start parameter. ```text 0000: 74 61 3a 3a 48 ... 79 3b 0a 0a 75 73 65 ta::Hexify;..use0010: 20 35 2e 30 30 ... 73 65 20 73 74 72 69 5.006;.use stri... and so on ... ``` -------------------------------- ### Run example script Source: https://metacpan.org/pod/Wx%3A%3APerl%3A%3AProcessStream Execute the provided example script from the source root directory. ```bash perl -Ilib example/psexample.pl ``` -------------------------------- ### Usage examples for lcpanm Source: https://metacpan.org/pod/distribution/App-lcpan/script/lcpanm Demonstrates basic usage of lcpanm for installing modules and piping outdated modules from a local mirror. ```bash % lcpanm -n Some::Module ...% cpan-outdated --mirror file:$HOME/cpan | lcpanm -n ``` -------------------------------- ### start Source: https://metacpan.org/pod/Bio%3A%3ALocation%3A%3ACoordinatePolicyI Get the integer-valued start coordinate of the given location as computed by this computation policy. ```APIDOC ## start ### Description Get the integer-valued start coordinate of the given location as computed by this computation policy. ### Usage $start = $policy->start($location); ### Returns A positive integer number. ### Args A Bio::LocationI implementing object. ``` -------------------------------- ### Incorrect setup hook usage Source: https://metacpan.org/pod/distribution/Catalyst-Manual/lib/Catalyst/Manual/CatalystAndMoose.pod Example of an incorrect way to hook into the setup method. ```perl after 'setup' => sub { ... } # wrong ``` -------------------------------- ### Initialize and use Getopt::Complete::Options Source: https://metacpan.org/pod/distribution/Getopt-Complete/lib/Getopt/Complete/Options.pm Demonstrates creating an options object, retrieving option names, specs, and handlers, and triggering shell completion. ```perl my $opts = Getopt::Complete::Options->new( 'myfile=s' => 'f', 'mydir=s@' => 'd', '<>' => ['one','two','three']);$opts->option_names;# myfile mydir$opts->option_spec("mydir")# '=s@'$opts->option_handler("myfile")# 'f'$opts->option_handler("<>")# ['one','two','three'];$opts->handle_shell_completion;# if it detects it is talking to the shell completer, it will respond and then exit# this method is used by the above, then makes a Getopt::Complete::Args.($text_typed,$option_name,$remainder_of_argv) = $self->parse_completion_request($comp_words,$comp_cword); ``` -------------------------------- ### ormrz usage example Source: https://metacpan.org/pod/PDL%3A%3ALinearAlgebra%3A%3AReal A complete example showing the setup of matrices and the application of ormrz. ```perl $a = random (float, 50, 100);$a = transpose($a);$info = null;$tau = zeroes(float, 50);tzrzf($a, $tau, $info);$c = random(70,50);# $c will contain the result$c->reshape(70,100);$c = transpose($c);ormrz($a, $tau, $c, $info); ``` -------------------------------- ### Configure Demo Application Source: https://metacpan.org/pod/CatalystX%3A%3AListFramework Commands to set up the demo application by linking the ExtJS library and starting the development server. ```bash cd t/ln -s /path/to/extjs/ static/extjs-1.1lib/script/testapp_server.pl ``` -------------------------------- ### ormrq usage example Source: https://metacpan.org/pod/PDL%3A%3ALinearAlgebra%3A%3AReal A complete example demonstrating the setup of matrices and the application of ormrq. ```perl $a = random (float, 50, 100);$a = transpose($a);$info = null;$tau = zeroes(float, 50);gerqf($a, $tau, $info);$c = random(70,50);# $c will contain the result$c->reshape(70,100);$c = transpose($c);ormrq($a, $tau, $c, $info); ``` -------------------------------- ### Install using Module::Build Source: https://metacpan.org/pod/Math%3A%3ADisarrange%3A%3AList Standard installation process for modules using Module::Build. ```bash perl Build.PL./Build./Build test./Build install ``` -------------------------------- ### Complete tutorial program Source: https://metacpan.org/pod/distribution/Imager/lib/Imager/Tutorial.pod The full example script combining image creation, drawing, and saving. ```perl use Imager;my $image = Imager->new(xsize => 100, ysize => 100);$image->box(filled => 1, color => 'blue');$image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green');$image->write(file=>'tutorial1.ppm') or die 'Cannot save tutorial1.ppm: ', $image->errstr; ``` -------------------------------- ### ormql usage example Source: https://metacpan.org/pod/PDL%3A%3ALinearAlgebra%3A%3AReal A complete example showing the setup of inputs and the application of ormql. ```perl $a = random (float, 50, 100);$a = transpose($a);$info = null;$tau = zeroes(float, 50);geqlf($a, $tau, $info);$c = random(70,50);# $c will contain the result$c->reshape(70,100);$c = transpose($c);ormql($a, $tau, $c, $info); ``` -------------------------------- ### Synopsis Example Source: https://metacpan.org/pod/Mail%3A%3ABox%3A%3AMbox%3A%3AMessage Demonstrates how to initialize an Mbox folder and retrieve a message. ```perl my $folder = Mail::Box::Mbox->new(folder => $ENV{MAIL}, ...);my $message = $folder->message(0); ``` -------------------------------- ### Install Fey::Loader with CPAN shell Source: https://metacpan.org/pod/Fey%3A%3ALoader%3A%3ADBI Install the module using the CPAN shell: start the shell and then run the install command. ```perl perl -MCPAN -e shell install Fey::Loader ``` -------------------------------- ### Install WWW::SchneierFacts with CPAN shell Source: https://metacpan.org/pod/WWW%3A%3ASchneierFacts Commands to install the module using the CPAN shell: start the shell and then run the install command. ```shell perl -MCPAN -e shell install WWW::SchneierFacts ``` -------------------------------- ### Initialize and run a container Source: https://metacpan.org/pod/Launcher%3A%3ACascade%3A%3AContainer Example showing how to instantiate multiple launchers and run them within a container. ```perl use Launcher::Cascade::Base::...; use Launcher::Cascade::Container; my $launcher1 = new Launcher::Cascade::Base:... ...; my $launcher2 = new Launcher::Cascade::Base:... ...; my $launcher3 = new Launcher::Cascade::Base:... ...; my $container = new Launcher::Cascade::Container-launchers => [ $launcher1, $launcher2, $launcher3 ]; $container->run_session(); ``` -------------------------------- ### Install MooseX::Daemonize with CPAN shell Source: https://metacpan.org/pod/MooseX%3A%3ADaemonize%3A%3APid Use the CPAN shell to install MooseX::Daemonize. Start the shell and then run the install command. ```perl perl -MCPAN -e shell install MooseX::Daemonize ``` -------------------------------- ### Creating a new PkgConfig::LibPkgConf::Client instance Source: https://metacpan.org/pod/PkgConfig%3A%3ALibPkgConf%3A%3AClient Demonstrates how to instantiate the client using either a hash or a hash reference for options. ```perl my $client = PkgConfig::LibPkgConf::Client->new(%opts);my $client = PkgConfig::LibPkgConf::Client->new(\%opts); ``` -------------------------------- ### Install Math::SymbolicX::BigNum with CPAN shell Source: https://metacpan.org/pod/Math%3A%3ASymbolicX%3A%3ABigNum Interactive installation using the CPAN shell: start the shell and run the install command. ```shell perl -MCPAN -e shell install Math::SymbolicX::BigNum ``` -------------------------------- ### Synopsis for Test2::Tools::QuickDB Source: https://metacpan.org/pod/Test2%3A%3ATools%3A%3AQuickDB Example showing how to initialize a PostgreSQL database driver and load a schema for testing. ```perl use Test2::V0 -target => DBIx::QuickDB::Driver::PostgreSQL;use Test2::Tools::QuickDB;skipall_unless_can_db(driver => 'PostgreSQL');my $db = get_db({driver => 'PostgreSQL', load_sql => 't/schema/postgresql.sql'});... ``` -------------------------------- ### xy() method usage example Source: https://metacpan.org/pod/Image%3A%3AXpm Example showing return values for setting and getting colors. ```perl $colour = xy($x, $y); # e.g. #123456 $cc = xy($x, $y, $colour); # e.g. ! ``` -------------------------------- ### Full script example with POD Source: https://metacpan.org/pod/Getopt%3A%3AAuto A complete example demonstrating subroutine mapping for options and POD documentation integration. ```perl use Getopt::Auto;our %options;$VERSION = '1.0';sub add { $count += shift @ARGV; }$count += $options{'--inc'};print "Count: $count\n";=pod=head2 -a, --add - Add integer to count.The integer argument is not checked.=head2 --inc - Bump count by 1=cut ``` -------------------------------- ### Start Session with Special Configuration Source: https://metacpan.org/pod/session Example of starting a session that utilizes the special_session configuration option. ```bash session --special ``` -------------------------------- ### Complete dynamic window sizing example Source: https://metacpan.org/pod/distribution/Win32-GUI/GENERATED/Win32/GUI/Tutorial/Part1.pod A full example that creates a window, adds a label with command-line text, calculates the required size, and displays the window. ```perl use Win32::GUI();$text = defined($ARGV[0]) ? $ARGV[0] : "Hello, world";$main = Win32::GUI::Window->new(-name => 'Main', -text => 'Perl');$label = $main->AddLabel(-text => $text);$ncw = $main->Width() - $main->ScaleWidth();$nch = $main->Height() - $main->ScaleHeight();$w = $label->Width() + $ncw;$h = $label->Height() + $nch;$main->Resize($w, $h);$main->Show();Win32::GUI::Dialog();sub Main_Terminate { -1;} ``` -------------------------------- ### Prohibited shebang example Source: https://metacpan.org/pod/Perl%3A%3ACritic%3A%3APolicy%3A%3AModules%3A%3AProhibitModuleShebang An example of a shebang line at the start of a module file, which is flagged by this policy. ```perl #!/usr/bin/perl -w <-- badpackage Foo;... ``` -------------------------------- ### Build and install from distro using Build.PL Source: https://metacpan.org/pod/MarpaX%3A%3ADemo%3A%3AStringParser Manual installation steps after unpacking the distribution: run perl Build.PL, then ./Build, then ./Build test, and finally sudo ./Build install. ```shell perl Build.PL ./Build ./Build test sudo ./Build install ``` -------------------------------- ### Example GUID string output Source: https://metacpan.org/pod/Data%3A%3AGUID%3A%3AAny An example of the upper-case hex string format returned by default. ```text FA2D5B34-23DB-11DE-B548-0018F34EC37C ``` -------------------------------- ### Initialize and run a basic Gnome2 application Source: https://metacpan.org/pod/Gnome2 A minimal example showing how to initialize the Gnome2 program, create an application window, and start the Gtk2 main loop. ```perl use Gnome2;Gnome2::Program->init ($appname, $appversion);my $app = Gnome2::App->new ($appname);$app->show;Gtk2->main; ``` -------------------------------- ### Install MooseX::Role::MongoDB with CPAN shell Source: https://metacpan.org/pod/MooseX%3A%3ARole%3A%3AMongoDB Install the module using the CPAN shell, which requires entering the install command after starting the shell. ```perl perl -MCPAN -e shell install MooseX::Role::MongoDB ``` -------------------------------- ### Tickit::Window - Basic Usage Source: https://metacpan.org/pod/Tickit%3A%3AWindow Example from the SYNOPSIS showing how to obtain the root window, bind events, set a pen, and run the Tickit main loop. ```APIDOC ## Tickit::Window - Basic Usage ### Description Example from the SYNOPSIS showing how to obtain the root window, bind events, set a pen, and run the Tickit main loop. ### Code ```perl use Tickit; use Tickit::Pen; my $tickit = Tickit->new; my $rootwin = $tickit->rootwin; $rootwin->bind_event( expose => sub { my ( $win, undef, $info ) = @_; my $rb = $info->rb; $rb->clear; $rb->text_at( int( $win->lines / 2 ), int( ($win->cols - 12) / 2 ), "Hello, world" ); }); $rootwin->bind_event( geomchange => sub { shift->expose } ); $rootwin->set_pen( Tickit::Pen->new( fg => "white" ) ); $rootwin->expose; $tickit->run; ``` ``` -------------------------------- ### Initialize a basic Wx application Source: https://metacpan.org/pod/Wx%3A%3APlThreadEvent A minimal example showing how to create a Wx application, a frame, and start the main event loop. ```perl use Wx;my $app = Wx::SimpleApp->new;my $frame = Wx::Frame->new( undef, -1, 'Hello, world!' );$frame->Show;$app->MainLoop; ``` -------------------------------- ### Install with CPAN shell Source: https://metacpan.org/pod/B%3A%3AHooks%3A%3AAtRuntime%3A%3AOnlyCoreDependencies Use the CPAN shell to install the distribution. Start the shell with perl -MCPAN -e shell, then run the install command. ```shell perl -MCPAN -e shell install B::Hooks::AtRuntime::OnlyCoreDependencies ``` -------------------------------- ### Install multiple methods with makemethods Source: https://metacpan.org/pod/distribution/GRID-Machine/lib/GRID/Machine.pod A convenience method to install several methods in a single call. This example installs fork, waitpid, kill, and poll. ```perl $self->makemethods( [ 'fork', filter=>'result', around => sub { my $self = shift; my $r = $self->call( 'fork', @_ ); $r->{machine} = $self; $r }, ], [ 'waitpid', filter=>'result', ], [ 'kill', filter=>'result', ], [ 'poll', filter=>'result', ],); ``` -------------------------------- ### Basic WebSocket Server Implementation Source: https://metacpan.org/pod/Net%3A%3AAsync%3A%3AWebSocket%3A%3AServer A complete example showing how to initialize a server, handle text frames, and run the IO::Async loop. ```perl use Future::AsyncAwait;use IO::Async::Loop;use Net::Async::WebSocket::Server;my $server = Net::Async::WebSocket::Server->new( on_client => sub { my ( undef, $client ) = @_; $client->configure( on_text_frame => sub { my ( $self, $frame ) = @_; $self->send_text_frame( $frame ); }, ); });my $loop = IO::Async::Loop->new;$loop->add( $server );await $server->listen( service => 3000,);$loop->run; ``` -------------------------------- ### Get start index Source: https://metacpan.org/pod/String%3A%3ATagged%3A%3AExtent Returns the start index of the extent, which is the index of the first character within the extent. ```perl $extent->start; ``` -------------------------------- ### Synopsis for Net::DNS::Async Source: https://metacpan.org/pod/Net%3A%3ADNS%3A%3AAsync Basic usage example showing how to initialize the helper, add queries, and await results. ```perl use Net::DNS::Async;my $c = new Net::DNS::Async(QueueSize => 20, Retries => 3);for (...) { $c->add(\&callback, @query);}$c->await();sub callback { my $response = shift; ...} ``` -------------------------------- ### App->continue(%options) Source: https://metacpan.org/pod/Squatting%3A%3AOn%3A%3AContinuity Starts a Continuity-based web server for the Squatting app. Options are passed directly to Continuity, such as specifying the port. ```APIDOC ## App->continue(%options) ### Description Starts a Continuity-based web server for the Squatting app. The options are passed straight through to Continuity, allowing you to specify settings like the port. ### Method continue ### Endpoint App->continue ### Parameters #### Options - **port** (integer) - Optional - The port to run the server on. ### Request Example App->continue(port => 2012); ### Response No explicit response is documented. ``` -------------------------------- ### Odd Integer Sequence Example Source: https://metacpan.org/pod/Math%3A%3ANumSeq%3A%3AOdd Displays the start of the odd integer sequence starting at index 0. ```text 1, 3, 5, 7, 9, 11, ...starting i=0 ``` -------------------------------- ### Create setup script Source: https://metacpan.org/pod/Code%3A%3ATidyAll%3A%3AGit%3A%3APrecommit Create a setup script in git/setup.sh to make the hook executable and link it into the .git/hooks directory. ```bash #!/bin/bashchmod +x git/hooks/pre-commitcd .git/hooksln -s ../../git/hooks/pre-commit ``` -------------------------------- ### Install a module using cpanm-script Source: https://metacpan.org/pod/App%3A%3Acpanm%3A%3Ascript Example of using the cpanm-script command to install a module by its script name. ```bash % cpanm-script -n csvutil ``` -------------------------------- ### start() Source: https://metacpan.org/pod/Perinci%3A%3AAccess%3A%3ASimple%3A%3AServer%3A%3ASocket Alias for run(). Starts the server. ```APIDOC ## start() ### Description Alias for run(). Starts the server. ### Method start ### Parameters None ### Returns No return value specified. ``` -------------------------------- ### Example CGI Application URL Source: https://metacpan.org/pod/distribution/App-Context/lib/App/devguide.pod An example of a URL path where the application program is installed as a CGI executable. ```text http://www.officevision.com/cgi-bin/pub/p5ee/app ``` -------------------------------- ### Install from source Source: https://metacpan.org/pod/App%3A%3AOffice%3A%3AContacts Build and install the module from the unpacked distribution. ```shell perl Makefile.PL make (or dmake) make test make install ``` -------------------------------- ### Install Class::Accessor::Installer with CPAN shell Source: https://metacpan.org/pod/Class%3A%3AAccessor%3A%3AInstaller Use these commands in the CPAN shell to install the module. First start the shell, then run the install command. ```shell perl -MCPAN -e shell install Class::Accessor::Installer ``` -------------------------------- ### Start Session with Time String Source: https://metacpan.org/pod/session Example of starting an interactive session using a runjob-style time string for duration. ```bash session -c 2 -m 2GB -t 1d ``` -------------------------------- ### Create sample application and HTML view Source: https://metacpan.org/pod/distribution/CatalystX-SimpleLogin/lib/CatalystX/SimpleLogin/Manual.pod Initialize a new Catalyst application and create a Template Toolkit view. ```bash catalyst.pl MyApp cd MyApp script/myapp_create.pl view HTML TT ``` -------------------------------- ### Build and install App software Source: https://metacpan.org/pod/distribution/App-Context/lib/App/installguide.pod Commands to build, test, and install the App software from the source directory. ```bash cd $PREFIX/src/p5ee/App make make test make install ``` -------------------------------- ### Wildcard pattern matching example Source: https://metacpan.org/pod/Module%3A%3AList%3A%3AWildcard Example of using a wildcard pattern to list modules starting with Module::P. ```perl list_modules("Module::P*", {wildcard=>1, list_modules=>1}); ``` -------------------------------- ### Collapse initialization and load Source: https://metacpan.org/pod/Win32%3A%3AShortcut Demonstrates that creating and loading a shortcut can be done in one step. ```perl $LINK = Win32::Shortcut->new();$LINK->Load("test.lnk"); ``` ```perl $LINK = Win32::Shortcut->new("test.lnk"); ``` -------------------------------- ### Install Lingua::ES::Numeros Source: https://metacpan.org/pod/CPAN%3A%3AAutoINC Example of using CPAN::AutoINC to install Spanish number conversion modules. ```bash perl -MCPAN::AutoINC -MLingua::Num2Word=cardinal -le 'print cardinal("es", 42)' ``` -------------------------------- ### Install Lingua::DE::Num2Word Source: https://metacpan.org/pod/CPAN%3A%3AAutoINC Example of using CPAN::AutoINC to install German number conversion modules. ```bash perl -MCPAN::AutoINC -MLingua::Num2Word=cardinal -le 'print cardinal("de", 42)' ``` -------------------------------- ### Initialize and use Passwd::Keyring::Gnome Source: https://metacpan.org/pod/Passwd%3A%3AKeyring%3A%3AGnome Example showing how to instantiate the keyring, retrieve a password, and store it if not found. ```perl use Passwd::Keyring::Gnome;my $keyring = Passwd::Keyring::Gnome->new( app=>"blahblah scraper", group=>"Johnny web scrapers",);my $username = "John"; # or get from .ini, or from .argv...my $password = $keyring->get_password($username, "blahblah.com");unless( $password ) { $password = ; # securely save password for future use $keyring->set_password($username, $password, "blahblah.com");}login_somewhere_using($username, $password);if( password_was_wrong ) { $keyring->clear_password($username, "blahblah.com");} ``` -------------------------------- ### gges usage example Source: https://metacpan.org/pod/PDL%3A%3ALinearAlgebra%3A%3AReal Example demonstrating the setup of arguments and the invocation of the gges function with a custom selection subroutine. ```perl sub my_select{ my ($zr, $zi, $d) = @_; # stable generalized eigenvalues for continuous time return ( ($zr < 0 && $d > 0 ) || ($zr > 0 && $d < 0) ) ? 1 : 0;}$a = random(5,5);$b = random(5,5);$sdim = null;$alphar = zeroes(5);$alphai = zeroes(5);$beta = zeroes(5);$vsl = zeroes(5,5);$vsr = zeroes(5,5);gges($a, 1, 1, 1, $b, $alphar, $alphai, $beta, $vsl, $vsr, $sdim,($info=null), \&my_select); ``` -------------------------------- ### WordStartPosition Source: https://metacpan.org/pod/distribution/Win32-GUI/Win32-GUI_Scintilla/Scintilla.pod Gets the position of the start of a word. ```APIDOC ## WordStartPosition ### Description Get position of start of word. ### Method WordStartPosition ### Parameters - **pos** (integer) - Required - The position. - **onlyWordCharacters** (boolean) - Required - Whether to consider only word characters. ### Returns The start position of the word. ```